-
-
Notifications
You must be signed in to change notification settings - Fork 322
137 lines (132 loc) · 4.44 KB
/
test.yml
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
name: Test
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
concurrency:
group: test-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
name: >-
Test ${{ matrix.py || matrix.tox_env }} on
${{ matrix.os == 'windows-latest' && 'Windows' || (matrix.os == 'macos-latest' && 'macOS' || 'Ubuntu') }}
strategy:
fail-fast: false
matrix:
py: ["3.13", "3.12", "3.11", "3.10", "3.9", "3.8"]
os: [ubuntu-24.04, windows-latest, macos-latest]
tox_env: ['']
include:
- tox_env: py3.12-black24
- tox_env: py3.12-black23
- tox_env: py3.12-black22
- tox_env: py3.9-black19
- tox_env: py3.8-pydantic18
- tox_env: py3.8-isort4
runs-on: ${{ matrix.os == '' && 'ubuntu-24.04' || matrix.os }}
env:
OS: ${{ matrix.os == '' && 'ubuntu-24.04' || matrix.os}}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v5
- name: Install tox
run: uv tool install --python-preference only-managed --python 3.13 tox --with tox-uv
- name: Setup Python test environment
run: tox run -vv --notest --skip-missing-interpreters false -e ${{ matrix.py || matrix.tox_env }}
env:
UV_PYTHON_PREFERENCE: "only-managed"
- name: Run test suite
run: tox run --skip-uv-sync --skip-pkg-install -e ${{ matrix.py || matrix.tox_env }}
env:
UV_PYTHON_PREFERENCE: "only-managed"
- name: Rename coverage report file
run: |
import os; import sys
os.rename(f".tox/.coverage.${{ matrix.py || matrix.tox_env }}", f".tox/.coverage.${{ matrix.py || matrix.tox_env}}-${{ matrix.os }}")
shell: python
- name: Upload coverage data
uses: actions/upload-artifact@v4
with:
include-hidden-files: true
name: .coverage.${{ matrix.py || matrix.tox_env }}-${{ matrix.os == '' && 'ubuntu-24.04' || matrix.os }}
path: ".tox/.coverage.*"
retention-days: 3
coverage:
name: Combine coverage
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v5
with:
enable-cache: true
cache-dependency-glob: "pyproject.toml"
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install hatch
run: uv tool install --python-preference only-managed --python 3.13 tox --with tox-uv
- name: Build package to generate version
run: uv build --python 3.13 --python-preference only-managed --wheel . --out-dir dist
- name: Setup coverage tool
run: tox run -e coverage --notest
env:
UV_PYTHON_PREFERENCE: only-managed
- name: Download coverage data
uses: actions/download-artifact@v4
with:
path: .tox
pattern: .coverage.*
merge-multiple: true
- name: Combine and report coverage
run: tox run -e coverage --skip-uv-sync --skip-pkg-install
env:
UV_PYTHON_PREFERENCE: only-managed
- name: Upload HTML report
uses: actions/upload-artifact@v4
with:
name: html-report
path: .tox/htmlcov
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
flags: unittests
files: .tox/coverage.xml
fail_ci_if_error: true
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
check:
name: Run ${{ matrix.tox_env }} check
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
tox_env:
- type
- dev
- docs
- pkg_meta
- readme
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install the latest version of uv
uses: astral-sh/setup-uv@v5
- name: Install tox
run: uv tool install --python-preference only-managed --python 3.13 tox --with tox-uv
- name: Setup check suite
run: tox r -vv --notest --skip-missing-interpreters false -e ${{ matrix.tox_env }}
env:
UV_PYTHON_PREFERENCE: "only-managed"
- name: Run check for ${{ matrix.tox_env }}
run: tox run --skip-uv-sync --skip-pkg-install -e ${{ matrix.tox_env }}
env:
UV_PYTHON_PREFERENCE: "only-managed"