| 1 |
name: Test |
| 2 |
|
| 3 |
on: |
| 4 |
push: |
| 5 |
branches: [main] |
| 6 |
pull_request: |
| 7 |
branches: [main] |
| 8 |
|
| 9 |
permissions: |
| 10 |
contents: read |
| 11 |
|
| 12 |
env: |
| 13 |
# turns off tox's output redirection so we can debug package installation |
| 14 |
TOX_OPTIONS: -vv |
| 15 |
|
| 16 |
jobs: |
| 17 |
lint: |
| 18 |
runs-on: ubuntu-latest |
| 19 |
# https://github.community/t/github-actions-does-not-respect-skip-ci/17325/8 |
| 20 |
if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')" |
| 21 |
steps: |
| 22 |
- uses: actions/checkout@v6 |
| 23 |
- name: Set up Python 3.x |
| 24 |
uses: actions/setup-python@v6 |
| 25 |
with: |
| 26 |
python-version: "3.x" |
| 27 |
- name: Install packages |
| 28 |
run: pip install tox |
| 29 |
- name: Run Tox |
| 30 |
run: tox $TOX_OPTIONS -e lint,package_readme |
| 31 |
|
| 32 |
test: |
| 33 |
runs-on: ${{ matrix.platform }} |
| 34 |
if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')" |
| 35 |
strategy: |
| 36 |
fail-fast: false |
| 37 |
matrix: |
| 38 |
# Oldest supported, 'Stable' supported, Newest supported |
| 39 |
python-version: ["3.10", "3.12", "3.13", "3.14"] |
| 40 |
platform: [ubuntu-latest] |
| 41 |
include: # Only test on the latest supported stable Python on macOS and Windows. |
| 42 |
- platform: macos-latest |
| 43 |
python-version: 3.14 |
| 44 |
- platform: windows-latest |
| 45 |
python-version: 3.14 |
| 46 |
steps: |
| 47 |
- uses: actions/checkout@v6 |
| 48 |
- name: Set up Python ${{ matrix.python-version }} |
| 49 |
uses: actions/setup-python@v6 |
| 50 |
with: |
| 51 |
python-version: ${{ matrix.python-version }} |
| 52 |
allow-prereleases: true |
| 53 |
- name: Install packages |
| 54 |
run: pip install tox coverage |
| 55 |
- name: Run Tox |
| 56 |
run: tox $TOX_OPTIONS -e py-cov |
| 57 |
- name: Run Tox without extra dependencies |
| 58 |
run: tox $TOX_OPTIONS -e py-cov-noextra |
| 59 |
- name: Produce coverage files |
| 60 |
run: | |
| 61 |
coverage combine |
| 62 |
coverage xml |
| 63 |
- name: Upload coverage to Codecov |
| 64 |
uses: codecov/codecov-action@v5 |
| 65 |
with: |
| 66 |
file: coverage.xml |
| 67 |
flags: unittests |
| 68 |
name: codecov-umbrella |
| 69 |
# TODO(anthrotype): Set fail_ci_if_error: true if/when Codecov becomes less flaky |
| 70 |
fail_ci_if_error: false |
| 71 |
# see https://github.com/codecov/codecov-action/issues/557 |
| 72 |
token: ${{ secrets.CODECOV_TOKEN }} |
| 73 |
|
| 74 |
test-cython: |
| 75 |
runs-on: ${{ matrix.platform }} |
| 76 |
if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')" |
| 77 |
strategy: |
| 78 |
fail-fast: false |
| 79 |
matrix: |
| 80 |
platform: [ubuntu-latest, macos-latest] |
| 81 |
python-version: ["3.14"] |
| 82 |
steps: |
| 83 |
- uses: actions/checkout@v6 |
| 84 |
- name: Set up Python ${{ matrix.python-version }} |
| 85 |
uses: actions/setup-python@v6 |
| 86 |
with: |
| 87 |
python-version: ${{ matrix.python-version }} |
| 88 |
- name: Install packages |
| 89 |
run: pip install tox |
| 90 |
- name: Run Tox |
| 91 |
run: tox $TOX_OPTIONS -e py-cy |
| 92 |
|
| 93 |
test-pypy3: |
| 94 |
runs-on: ubuntu-latest |
| 95 |
if: "! contains(toJSON(github.event.commits.*.message), '[skip ci]')" |
| 96 |
steps: |
| 97 |
- uses: actions/checkout@v6 |
| 98 |
- name: Set up Python pypy3 |
| 99 |
uses: actions/setup-python@v6 |
| 100 |
with: |
| 101 |
python-version: "pypy-3.11" |
| 102 |
- name: Install packages |
| 103 |
run: pip install tox |
| 104 |
- name: Run Tox |
| 105 |
run: tox $TOX_OPTIONS -e pypy3 |