|
| 1 | +name: CI using tox |
| 2 | + |
| 3 | +# A reusable github workflow to run CI through tox and tox-gh: |
| 4 | +# The CI workflow is configured in the tox-gh config (eg. pyproject.toml). |
| 5 | +# See https://github.com/tox-dev/tox-gh. |
| 6 | +# |
| 7 | +# Accepts the following inputs: |
| 8 | +# - `os`: A json string containing the list of operating systems on which to |
| 9 | +# run tests. Default is `["ubuntu-latest", "windows-latest", |
| 10 | +# "macos-latest"]`. |
| 11 | +# - `python-version`: A json string containing the list of python versions on |
| 12 | +# which to run tests. Default is `["3.9", "3.10", "3.11", "3.12", "3.13"]`. |
| 13 | +# |
| 14 | +# Assumes the configurations for all tools (`mypy`, `uv`, `ruff`, `pytest`, |
| 15 | +# ...) are fully specified in config files (eg `pyproject.toml`). |
| 16 | +# |
| 17 | +# Uses `uv run tox` to run the checks and tests. |
| 18 | + |
| 19 | +on: |
| 20 | + workflow_call: |
| 21 | + inputs: |
| 22 | + os: |
| 23 | + description: >- |
| 24 | + A json string containing the list of operating systems on which to |
| 25 | + run the test matrix. |
| 26 | + default: '["ubuntu-latest", "windows-latest", "macos-latest"]' |
| 27 | + type: string |
| 28 | + required: false |
| 29 | + python-version: |
| 30 | + description: >- |
| 31 | + A json string containing the list of python versions on |
| 32 | + which to run the test matrix. |
| 33 | + default: '["3.9", "3.10", "3.11", "3.12", "3.13"]' |
| 34 | + type: string |
| 35 | + required: false |
| 36 | + |
| 37 | +jobs: |
| 38 | + tests: |
| 39 | + name: ci-tox py${{ matrix.python-version }}-${{ matrix.os }} |
| 40 | + strategy: |
| 41 | + matrix: |
| 42 | + os: ${{ fromJson(inputs.os) }} |
| 43 | + python-version: ${{ fromJson(inputs.python-version) }} |
| 44 | + runs-on: ${{ matrix.os }} |
| 45 | + steps: |
| 46 | + - uses: actions/checkout@v4 |
| 47 | + |
| 48 | + - name: Checkout and setup python environment ${{ matrix.python-version }} |
| 49 | + uses: glenn20/python-ci/setup@v1 |
| 50 | + with: |
| 51 | + python-version: ${{ matrix.python-version }} |
| 52 | + |
| 53 | + - name: Setup tests # Setup the tox environment for the tests |
| 54 | + run: uv run --frozen tox run -vv --notest --skip-missing-interpreters false |
| 55 | + |
| 56 | + - name: Run tests # Use `tox` to run the tests |
| 57 | + run: uv run --frozen tox run --skip-pkg-install |
| 58 | + |
| 59 | + build: |
| 60 | + name: Build |
| 61 | + uses: glenn20/python-ci/.github/workflows/build.yaml@v1 |
0 commit comments