tests #427
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: tests | |
on: | |
push: | |
branches: [master] | |
paths-ignore: | |
- "README.md" | |
pull_request: | |
branches: [master] | |
paths-ignore: | |
- "README.md" | |
schedule: | |
# Run every Sunday | |
- cron: "0 0 * * 0" | |
workflow_dispatch: | |
jobs: | |
code-quality: | |
name: Code Quality | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.11" | |
cache: "pip" | |
cache-dependency-path: | | |
pyproject.toml | |
dev-requirements.txt | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
make requirements | |
- name: Lint | |
run: | | |
make lint | |
- name: Build documentation | |
run: | | |
make docs | |
tests: | |
name: Tests (${{ matrix.os }}, Python ${{ matrix.python-version }}) | |
needs: code-quality | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
python-version: [3.9, "3.10", "3.11", "3.12", "3.13"] | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
allow-prereleases: true | |
cache: "pip" | |
cache-dependency-path: | | |
pyproject.toml | |
dev-requirements.txt | |
- name: Set up Miniconda | |
uses: conda-incubator/setup-miniconda@v3 | |
with: | |
auto-activate-base: true | |
activate-environment: "" | |
- name: Set up Pixi | |
uses: prefix-dev/[email protected] | |
with: | |
cache: false | |
run-install: false | |
- name: Set up Poetry | |
uses: abatilo/actions-poetry@v3 | |
with: | |
poetry-version: latest | |
- name: Cache conda packages | |
uses: actions/cache@v4 | |
env: | |
# Increase this value to reset cache explicitly | |
CACHE_NUMBER: 0 | |
with: | |
path: ~/conda_pkgs_dir | |
key: | |
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ | |
hashFiles('ccds/hook_utils/dependencies.py') }} | |
- name: Setup for Windows | |
if: ${{ matrix.os == 'windows-latest' }} | |
run: | | |
# Install GNU make | |
choco install --verbose make | |
# Add conda binaries directory to PATH so that conda is accessible | |
echo "${CONDA}\Scripts" >> $GITHUB_PATH | |
# Set bash executable explicitly since Make may pick wrong shell | |
echo "BASH_EXECUTABLE=$(which bash)" >> "$GITHUB_ENV" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
make requirements | |
- name: Check dependencies | |
run: | | |
if [[ -z "${BASH_EXECUTABLE}" ]]; then | |
bash --version | |
else | |
echo $BASH_EXECUTABLE | |
$BASH_EXECUTABLE --version | |
fi | |
which make | |
make --version | |
which conda | |
conda --version | |
which pipenv | |
pipenv --version | |
which virtualenv | |
virtualenv --version | |
which pixi | |
pixi --version | |
which poetry | |
poetry --version | |
which python | |
python --version | |
python -c "import platform; print(f'Python architecture: {platform.architecture()}')" | |
- name: Run tests | |
run: | | |
make test |