Added Python 3.12 to CI (#159) #454
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test | |
on: | |
workflow_dispatch: | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
branches: | |
- main | |
paths: | |
- 'src/**' | |
- 'tests/**' | |
- '!**.pyi' | |
- 'tox.ini' | |
- 'pyproject.toml' | |
- 'pdm.lock' | |
- '.github/codecov.yml' | |
- '.github/actions/setup-tox/**' | |
- '.github/workflows/test.yml' | |
push: | |
branches: | |
- main | |
tags-ignore: | |
- '*' | |
paths: | |
- 'src/**' | |
- 'tests/**' | |
- '!**.pyi' | |
- 'tox.ini' | |
- 'pyproject.toml' | |
- 'pdm.lock' | |
- '.github/codecov.yml' | |
- '.github/actions/setup-tox/**' | |
- '.github/workflows/test.yml' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} | |
cancel-in-progress: true | |
jobs: | |
unit-tests: | |
if: | | |
(github.event_name != 'push' || !startsWith(github.event.head_commit.message, 'Bump version:')) | |
&& (github.event_name != 'pull_request' || github.event.pull_request.draft != true) | |
runs-on: ubuntu-22.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
python_version: ['3.11', '3.12'] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup tox (python ${{ matrix.python_version }}) | |
uses: ./.github/actions/setup-tox | |
with: | |
python-version: ${{ matrix.python_version }} | |
- name: Launch tests | |
run: tox run -f py$(echo ${{ matrix.python_version }} | tr -d .)-unit -- -v | |
- name: Generate coverage report | |
if: hashFiles('.coverage.*') != '' # Rudimentary `file.exists()` | |
run: | | |
tox run -e coverage | |
tox exec -e coverage -- coverage xml | |
- name: Upload coverage to codecov | |
if: hashFiles('coverage.xml') != '' # Rudimentary `file.exists()` | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
flags: >- # Mark which lines are covered by which envs | |
test-unit, | |
Py-${{ matrix.python_version }} | |
functional-tests: | |
if: | | |
(github.event_name != 'push' || !startsWith(github.event.head_commit.message, 'Bump version:')) | |
&& (github.event_name != 'pull_request' || github.event.pull_request.draft != true) | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-22.04, windows-2022, macos-12] | |
python_version: ['3.11', '3.12'] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup tox (python ${{ matrix.python_version }}) | |
uses: ./.github/actions/setup-tox | |
with: | |
python-version: ${{ matrix.python_version }} | |
- name: Launch tests | |
timeout-minutes: 20 # Even if 10 minutes is already too big | |
run: tox run -f py$(echo ${{ matrix.python_version }} | tr -d .)-functional -- -v | |
- name: Generate coverage report | |
if: hashFiles('.coverage.*') != '' # Rudimentary `file.exists()` | |
run: | | |
tox run -e coverage | |
tox exec -e coverage -- coverage xml | |
- name: Upload coverage to codecov | |
if: hashFiles('coverage.xml') != '' # Rudimentary `file.exists()` | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
flags: >- # Mark which lines are covered by which envs | |
test-functional, | |
OS-${{ runner.os }}, | |
Py-${{ matrix.python_version }} | |
other-tests: | |
if: | | |
(github.event_name != 'push' || !startsWith(github.event.head_commit.message, 'Bump version:')) | |
&& (github.event_name != 'pull_request' || github.event.pull_request.draft != true) | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup tox | |
uses: ./.github/actions/setup-tox | |
with: | |
python-version: '3.11' | |
- name: Launch tests | |
run: tox run -f py311-other -- -v |