-
Notifications
You must be signed in to change notification settings - Fork 23
66 lines (58 loc) · 1.87 KB
/
Copy pathtest.yml
File metadata and controls
66 lines (58 loc) · 1.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
name: Test & Lint
# Inspired by https://github.com/wagtail/wagtail-bakery/blob/0bfff2a7446e6119156279d22cfac2137960145d/.github/workflows/test.yml
on:
push:
branches:
- main
pull_request:
workflow_call: # Allow for the publish workflows to run the tests by calling this workflow
jobs:
pre-commit:
name: Pre-commit
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0
persist-credentials: false
- name: Set up Python 3.14
uses: actions/setup-python@v6
with:
python-version: 3.14
- name: Run pre-commit
run: |
python -m pip install pre-commit
pre-commit install
pre-commit run --all-files
test:
name: Python ${{ matrix.python}} ${{ matrix.toxenv }}
runs-on: ubuntu-latest
strategy:
matrix:
python: ["3.10", "3.11", "3.12", "3.13", "3.14"]
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0
persist-credentials: false
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python }}
- name: Install dependencies
run: |
python -m pip install tox coverage
- name: Run tox targets for Python ${{ matrix.python }}
run: |
# Run only the tox environments that match the Python version
tox run -f py$(echo ${{ matrix.python }} | tr -d .)
coverage combine
coverage report
# Codecov does not support the .coverage file generated by coverage, so we convert it to xml
coverage xml
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v6
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}