Skip to content

Test

Test #1401

Workflow file for this run

name: Test
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
schedule:
- cron: "0 5 * * *"
# Cancel previous runs that have not completed
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
pytest:
strategy:
matrix:
os:
- macos-latest
- ubuntu-latest
- windows-latest
python:
# llvmlite (thus numba, thus sparse) usually lags the latest Python
# release. Only test SparseDataArray where possible.
# Earliest version supported by genno = earliest Python that has not
# reached EOL
- {version: "3.8", extras: ",sparse"}
- {version: "3.9", extras: ",sparse"}
- {version: "3.10", extras: ",sparse"}
- {version: "3.11", extras: ",sparse"}
# Latest release / latest supported by genno / testable on GHA
- {version: "3.12", extras: ""}
# For fresh releases and development versions of Python, compiled binary
# wheels are not available for some dependencies, e.g. numpy, pandas.
# Compiling these on the job runner requires a more elaborate build
# environment, currently out of scope for genno. Exclude these versions
# from CI.
# - {version: "3.13.0-rc.1", extras: ""} # Development version
fail-fast: false
runs-on: ${{ matrix.os }}
name: ${{ matrix.os }}-py${{ matrix.python.version }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: ${{ env.depth }}
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python.version }}
cache: pip
cache-dependency-path: "**/pyproject.toml"
- uses: ts-graphviz/setup-graphviz@v1
with:
macos-skip-brew-update: true
- name: Install the Python package and dependencies
run: pip install --upgrade --upgrade-strategy=eager .[tests${{ matrix.python.extras }}]
- name: Run test suite using pytest
run: |
pytest genno \
--trace-config --color=yes --verbose \
--cov-report=xml --cov-report=term \
--numprocesses auto
shell: bash
- name: Upload test coverage to Codecov.io
uses: codecov/codecov-action@v3
pre-commit:
name: Code quality
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- name: Force recreation of pre-commit virtual environment for mypy
if: github.event_name == 'schedule' # Comment this line to run on a PR
run: gh cache list -L 999 | cut -f2 | grep pre-commit | xargs -I{} gh cache delete "{}" || true
env: { GH_TOKEN: "${{ github.token }}" }
- uses: pre-commit/[email protected]