| 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 |
| 6 |
|
| 7 |
on: |
| 8 |
push: |
| 9 |
branches: |
| 10 |
- main # GitHub now defaults to 'main' as the name of the primary branch. Change this as needed. |
| 11 |
# tags: # run CI if specific tags are pushed |
| 12 |
pull_request: |
| 13 |
# branches: # only build on PRs against 'main' if you need to further limit when CI is run. |
| 14 |
# - main |
| 15 |
|
| 16 |
jobs: |
| 17 |
# Github Actions supports ubuntu, windows, and macos virtual environments: |
| 18 |
# https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners |
| 19 |
ci_tests: |
| 20 |
name: ${{ matrix.name }} |
| 21 |
runs-on: ${{ matrix.os }} |
| 22 |
strategy: |
| 23 |
matrix: |
| 24 |
include: |
| 25 |
- name: Code style checks |
| 26 |
os: ubuntu-latest |
| 27 |
python: 3.x |
| 28 |
toxenv: codestyle |
| 29 |
|
| 30 |
- name: Python 3.10 with minimal dependencies |
| 31 |
os: ubuntu-latest |
| 32 |
python: '3.10' |
| 33 |
toxenv: py310-test |
| 34 |
|
| 35 |
- name: Python 3.11 with all optional dependencies and coverage checking |
| 36 |
os: ubuntu-latest |
| 37 |
python: '3.11' |
| 38 |
toxenv: py311-test-alldeps-cov |
| 39 |
|
| 40 |
- name: macOS - Python 3.11 with all optional dependencies |
| 41 |
os: macos-latest |
| 42 |
python: '3.11' |
| 43 |
toxenv: py311-test-alldeps |
| 44 |
|
| 45 |
- name: Windows - Python 3.11 with minimal dependencies |
| 46 |
os: windows-latest |
| 47 |
python: '3.11' |
| 48 |
toxenv: py311-test |
| 49 |
|
| 50 |
- name: Python 3.12 with all optional dependencies and pre-releases |
| 51 |
os: ubuntu-latest |
| 52 |
python: '3.12' |
| 53 |
toxenv: py312-test-alldeps-predeps |
| 54 |
|
| 55 |
- name: Python 3.10 with oldest supported version of all dependencies |
| 56 |
os: ubuntu-22.04 |
| 57 |
python: '3.10' |
| 58 |
toxenv: py310-test-oldestdeps |
| 59 |
|
| 60 |
- name: Python 3.13 with latest dev versions of key dependencies |
| 61 |
os: ubuntu-latest |
| 62 |
python: '3.13' |
| 63 |
toxenv: py313-test-devdeps |
| 64 |
|
| 65 |
# - name: Test building of Sphinx docs |
| 66 |
# os: ubuntu-latest |
| 67 |
# python: 3.x |
| 68 |
# toxenv: build_docs |
| 69 |
|
| 70 |
steps: |
| 71 |
- name: Checkout code |
| 72 |
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 |
| 73 |
with: |
| 74 |
fetch-depth: 0 |
| 75 |
- name: Set up Python ${{ matrix.python }} on ${{ matrix.os }} |
| 76 |
uses: actions/setup-python@42375524e23c412d93fb67b49958b491fce71c38 # v5.4.0 |
| 77 |
with: |
| 78 |
python-version: ${{ matrix.python }} |
| 79 |
- name: Install base dependencies |
| 80 |
run: | |
| 81 |
python -m pip install --upgrade pip |
| 82 |
python -m pip install tox |
| 83 |
- name: Test with tox |
| 84 |
run: | |
| 85 |
tox -e ${{ matrix.toxenv }} |
| 86 |
- name: Upload coverage to codecov |
| 87 |
if: "contains(matrix.toxenv, '-cov')" |
| 88 |
uses: codecov/codecov-action@13ce06bfc6bbe3ecf90edbbf1bc32fe5978ca1d3 # v5.3.1 |
| 89 |
with: |
| 90 |
file: ./coverage.xml |