Skip to content

Commit c27c622

Browse files
authored
Merge branch 'dev/remove-codecov' into dev/speed-tests
2 parents 2b040cb + 9ea2987 commit c27c622

9 files changed

Lines changed: 158 additions & 124 deletions

File tree

.github/workflows/main.yml

Lines changed: 99 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
pull_request:
1010

1111
concurrency:
12-
group: ci-main-${{ github.ref }}
12+
group: ${{ github.workflow }}-${{ github.ref }}
1313
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
1414

1515
env:
@@ -25,77 +25,9 @@ jobs:
2525
timeout-minutes: 15
2626
permissions:
2727
contents: read
28-
strategy:
29-
fail-fast: false
30-
matrix:
31-
include:
32-
- name: linting,docs
33-
python: '3.13'
34-
allow_failure: false
35-
use_factor: false
36-
37-
- name: py313-sqlite-xdist-coverage
38-
python: '3.13'
39-
allow_failure: false
40-
use_factor: true
41-
42-
# start:Speeding up tests by running them in parallel.
43-
- name: py312-djmain-sqlite-xdist-coverage
44-
python: '3.12'
45-
allow_failure: false
46-
use_factor: false
47-
48-
- name: py312-dj52-sqlite-xdist-coverage
49-
python: '3.12'
50-
allow_failure: false
51-
use_factor: false
52-
53-
- name: py312-dj51-sqlite-xdist-coverage
54-
python: '3.12'
55-
allow_failure: false
56-
use_factor: false
57-
58-
- name: py312-dj42-sqlite-xdist-coverage
59-
python: '3.12'
60-
allow_failure: false
61-
use_factor: false
62-
# end: Speeding up tests by running them in parallel.
63-
64-
- name: py311-sqlite-xdist-coverage
65-
python: '3.11'
66-
allow_failure: false
67-
use_factor: true
68-
69-
- name: py310-sqlite-xdist-coverage
70-
python: '3.10'
71-
allow_failure: false
72-
use_factor: true
73-
74-
- name: py39-sqlite-xdist-coverage
75-
python: '3.9'
76-
allow_failure: false
77-
use_factor: true
78-
79-
- name: py313-djmain-postgres-coverage
80-
python: '3.13'
81-
allow_failure: false
82-
use_factor: false
83-
84-
- name: py313-djmain-mysql-coverage
85-
python: '3.13'
86-
allow_failure: false
87-
use_factor: false
88-
89-
- name: py313-djmain-sqlite-pytestmin
90-
python: '3.13'
91-
allow_failure: false
92-
use_factor: false
93-
94-
# pypy3: not included with coverage reports (much slower then).
95-
- name: pypy3-dj52-sqlite
96-
python: 'pypy3.11'
97-
allow_failure: false
98-
use_factor: false
28+
security-events: write
29+
env:
30+
TOXENV: ${{ matrix.name }}
9931
steps:
10032
- uses: actions/checkout@v4
10133
with:
@@ -124,7 +56,18 @@ jobs:
12456
uv tool install tox==4.26.0 --with tox-uv
12557
12658
- name: Run tox
127-
run: tox ${{ matrix.use_factor && '-f' || '-e' }} ${{ matrix.name }}
59+
run: tox
60+
61+
- name: Upload zizmor SARIF report into the GitHub repo code scanning
62+
if: contains(matrix.name, 'linting')
63+
uses: github/codeql-action/upload-sarif@v3
64+
with:
65+
sarif_file: zizmor.sarif
66+
category: zizmor
67+
68+
- name: Prepare coverage file for upload
69+
if: contains(matrix.name, 'coverage')
70+
run: mv .coverage coverage.${TOXENV}
12871

12972
- name: Upload temporary coverage artifact
13073
if: contains(matrix.name, 'coverage')
@@ -135,6 +78,84 @@ jobs:
13578
retention-days: 1
13679
include-hidden-files: true
13780

81+
strategy:
82+
fail-fast: false
83+
matrix:
84+
include:
85+
- name: linting,docs
86+
python: '3.13'
87+
allow_failure: false
88+
89+
# Explicitly test min pytest.
90+
- name: py313-dj52-sqlite-pytestmin-coverage
91+
python: '3.13'
92+
allow_failure: false
93+
94+
- name: py313-dj52-postgres-xdist-coverage
95+
python: '3.13'
96+
allow_failure: false
97+
98+
- name: py313-dj51-postgres-xdist-coverage
99+
python: '3.13'
100+
allow_failure: false
101+
102+
- name: py312-dj42-postgres-xdist-coverage
103+
python: '3.12'
104+
allow_failure: false
105+
106+
- name: py311-dj50-postgres-xdist-coverage
107+
python: '3.11'
108+
allow_failure: false
109+
110+
- name: py311-dj42-postgres-xdist-coverage
111+
python: '3.11'
112+
allow_failure: false
113+
114+
- name: py310-dj52-postgres-xdist-coverage
115+
python: '3.10'
116+
allow_failure: false
117+
118+
- name: py310-dj51-postgres-xdist-coverage
119+
python: '3.10'
120+
allow_failure: false
121+
122+
- name: py310-dj42-postgres-xdist-coverage
123+
python: '3.10'
124+
allow_failure: false
125+
126+
- name: py311-dj51-mysql-coverage
127+
python: '3.11'
128+
allow_failure: false
129+
130+
- name: py310-dj42-mysql-coverage
131+
python: '3.10'
132+
allow_failure: false
133+
134+
- name: py39-dj42-mysql-xdist-coverage
135+
python: '3.9'
136+
allow_failure: false
137+
138+
- name: py313-djmain-sqlite-coverage
139+
python: '3.13'
140+
allow_failure: true
141+
142+
- name: py313-dj52-sqlite-coverage
143+
python: '3.13'
144+
allow_failure: true
145+
146+
- name: py312-dj51-sqlite-xdist-coverage
147+
python: '3.12'
148+
allow_failure: false
149+
150+
- name: py311-dj42-sqlite-xdist-coverage
151+
python: '3.11'
152+
allow_failure: false
153+
154+
# pypy3: not included with coverage reports (much slower then).
155+
- name: pypy3-dj42-postgres
156+
python: 'pypy3.9'
157+
allow_failure: false
158+
138159
report-coverage:
139160
name: Report Combined Coverage
140161
runs-on: ubuntu-24.04
@@ -166,16 +187,18 @@ jobs:
166187
coverage combine coverage-artifact-*
167188
coverage xml
168189
coverage html
169-
coverage report --format=markdown >> $GITHUB_STEP_SUMMARY
190+
coverage report --show-missing --format=markdown >> $GITHUB_STEP_SUMMARY
170191
171192
- name: Determine retention days
172193
id: determine-retention-days
173194
run: |
174-
if [ "${{ github.ref }}" = "refs/heads/main" ] || [[ "${{ github.ref }}" == refs/tags/* ]]; then
195+
if [ "${GITHUB_REF}" = "refs/heads/main" ] || [[ "${GITHUB_REF}" == refs/tags/* ]]; then
175196
echo "retention_days=90" >> $GITHUB_OUTPUT
176197
else
177198
echo "retention_days=3" >> $GITHUB_OUTPUT
178199
fi
200+
env:
201+
GITHUB_REF: ${{ github.ref }}
179202

180203
- name: Upload combined .coverage file
181204
uses: actions/upload-artifact@v4
@@ -193,7 +216,7 @@ jobs:
193216
retention-days: ${{ steps.determine-retention-days.outputs.retention_days }}
194217

195218
- name: Delete temporary coverage artifacts from run
196-
uses: geekyeggo/delete-artifact@v5
219+
uses: geekyeggo/delete-artifact@f275313e70c08f6120db482d7a6b98377786765b # 5.1.0
197220
with:
198221
name: coverage-artifact-*
199222

.github/zizmor.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
rules:
2+
unpinned-uses:
3+
config:
4+
policies:
5+
actions/*: ref-pin
6+
codecov/codecov-action: ref-pin
7+
github/*: ref-pin

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,4 @@ _build
1818
*.egg
1919
# autogenerated by setuptools-scm
2020
/pytest_django/_version.py
21+
zizmor.sarif

Makefile

Lines changed: 0 additions & 13 deletions
This file was deleted.

pyproject.toml

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ classifiers = [
4040
dependencies = [
4141
"pytest>=7.0.0",
4242
]
43-
[project.optional-dependencies]
43+
[dependency-groups]
4444
docs = [
4545
"sphinx",
4646
"sphinx_rtd_theme",
@@ -49,6 +49,24 @@ testing = [
4949
"Django",
5050
"django-configurations>=2.0",
5151
]
52+
coverage = [
53+
"coverage[toml]",
54+
"coverage-enable-subprocess",
55+
]
56+
postgres = [
57+
"psycopg[binary]",
58+
]
59+
mysql = [
60+
"mysqlclient==2.1.0",
61+
]
62+
xdist = [
63+
"pytest-xdist",
64+
]
65+
linting = [
66+
"mypy==1.15.0",
67+
"ruff==0.9.5",
68+
"zizmor==1.9.0",
69+
]
5270
[project.urls]
5371
Documentation = "https://pytest-django.readthedocs.io/"
5472
Repository = "https://github.com/pytest-dev/pytest-django"
@@ -104,7 +122,7 @@ include = [
104122
"tests/*",
105123
]
106124
omit = [
107-
"pytest_django/_version.py",
125+
"pytest_django/_version.py", # coverage fails when the file stops existing randomly, see .gitignore
108126
]
109127
skip_covered = true
110128
exclude_lines = [
@@ -140,8 +158,6 @@ extend-select = [
140158
ignore = [
141159
"PLR0913", # Too many arguments in function definition
142160
"PLR2004", # Magic value used in comparison, consider replacing 3 with a constant variable
143-
"PT001", # Use `@pytest.fixture()` over `@pytest.fixture`
144-
"PT023", # Use `@pytest.mark.django_db()` over `@pytest.mark.django_db`
145161
]
146162

147163
[tool.ruff.lint.isort]

0 commit comments

Comments
 (0)