| 1 |
# GitHub Actions workflow for testing and continuous integration. |
| 2 |
# |
| 3 |
# This file performs testing using tox and tox.ini to define and configure the test environments. |
| 4 |
|
| 5 |
name: CI Tests |
| 6 |
|
| 7 |
on: |
| 8 |
push: |
| 9 |
branches: |
| 10 |
- main |
| 11 |
pull_request: |
| 12 |
branches: # only build on PRs against 'main' if you need to further limit when CI is run. |
| 13 |
- main |
| 14 |
|
| 15 |
concurrency: |
| 16 |
group: ${{ github.workflow }}-${{ github.ref }} |
| 17 |
cancel-in-progress: true |
| 18 |
|
| 19 |
jobs: |
| 20 |
# Github Actions supports ubuntu, windows, and macos virtual environments: |
| 21 |
# https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners |
| 22 |
ci_tests: |
| 23 |
name: ${{ matrix.name }} |
| 24 |
runs-on: ${{ matrix.os }} |
| 25 |
strategy: |
| 26 |
matrix: |
| 27 |
include: |
| 28 |
- name: Code style checks |
| 29 |
os: ubuntu-latest |
| 30 |
python: 3.x |
| 31 |
toxenv: codestyle |
| 32 |
|
| 33 |
- name: Python 3.7 with minimal dependencies |
| 34 |
os: ubuntu-latest |
| 35 |
python: 3.7 |
| 36 |
toxenv: py37-test |
| 37 |
|
| 38 |
- name: OS X - Python 3.9 with minimal dependencies |
| 39 |
os: macos-latest |
| 40 |
python: 3.9 |
| 41 |
toxenv: py39-test |
| 42 |
|
| 43 |
- name: Windows - Python 3.11 with all optional dependencies |
| 44 |
os: windows-latest |
| 45 |
python: 3.11 |
| 46 |
toxenv: py11-test-alldeps |
| 47 |
|
| 48 |
- name: Python 3.11 with remote data, all dependencies, and coverage |
| 49 |
os: ubuntu-latest |
| 50 |
python: 3.11 |
| 51 |
toxenv: py11-test-alldeps-cov |
| 52 |
toxposargs: --remote-data |
| 53 |
|
| 54 |
- name: Python 3.11 with latest dev versions of key dependencies |
| 55 |
os: ubuntu-latest |
| 56 |
python: 3.11 |
| 57 |
toxenv: py11-test-devdeps |
| 58 |
|
| 59 |
- name: Test building of Sphinx docs |
| 60 |
os: ubuntu-latest |
| 61 |
python: 3.x |
| 62 |
toxenv: build_docs |
| 63 |
|
| 64 |
steps: |
| 65 |
- name: Checkout code |
| 66 |
uses: actions/checkout@v1 |
| 67 |
with: |
| 68 |
fetch-depth: 0 |
| 69 |
- name: Set up python ${{ matrix.python }} on ${{ matrix.os }} |
| 70 |
uses: actions/setup-python@v4 |
| 71 |
with: |
| 72 |
python-version: ${{ matrix.python }} |
| 73 |
- name: Install base dependencies |
| 74 |
run: | |
| 75 |
python -m pip install --upgrade pip |
| 76 |
python -m pip install tox codecov |
| 77 |
- name: Install graphviz dependency |
| 78 |
if: ${{ contains(matrix.toxenv, 'build_docs') }} |
| 79 |
run: sudo apt-get -y install graphviz |
| 80 |
- name: Test with tox |
| 81 |
run: | |
| 82 |
tox -e ${{ matrix.toxenv }} |