1
- name : Django Tests CI
2
-
1
+ name : " CI"
3
2
on :
4
3
push :
5
4
branches : ["master", "develop"]
6
5
pull_request :
7
- branches : ["develop"]
6
+
7
+ concurrency :
8
+ group : check-${{ github.ref }}
9
+ cancel-in-progress : true
8
10
9
11
jobs :
10
12
formatting :
13
+ name : " Check Code Formatting"
11
14
runs-on : ubuntu-latest
12
15
steps :
13
16
- uses : actions/checkout@v4
17
20
- run : " ruff format --check --diff"
18
21
19
22
linting :
23
+ name : " Check Code Linting"
20
24
runs-on : ubuntu-latest
21
25
steps :
22
26
- uses : actions/checkout@v4
@@ -25,24 +29,33 @@ jobs:
25
29
args : " --version"
26
30
- run : " ruff check --diff"
27
31
28
- tests :
32
+ test_matrix_prep :
33
+ name : " Prepare Test Matrix"
34
+ runs-on : ubuntu-latest
35
+ outputs :
36
+ matrix : " ${{ steps.set-matrix.outputs.matrix }}"
37
+ steps :
38
+ - uses : actions/checkout@v4
39
+ - uses : astral-sh/setup-uv@v3
40
+ - run : uv tool install tox
41
+ - id : set-matrix
42
+ run : |
43
+ matrix=$(tox -l | jq -Rc 'select(test("^py\\d+.*django\\d+")) | capture("^py(?<python>\\d+).*django(?<django>\\d+)") | {"python": (.python | tostring | .[0:1] + "." + .[1:]), "django": (.django | tostring | .[0:1] + "." + .[1:])}' | jq -sc '{include: .}')
44
+ echo "matrix=$matrix" >> $GITHUB_OUTPUT
45
+
46
+ test :
47
+ name : " Test Django ${{ matrix.django }} | Python ${{ matrix.python }}"
48
+ needs : test_matrix_prep
29
49
runs-on : ubuntu-latest
50
+ strategy :
51
+ fail-fast : false
52
+ matrix : ${{ fromJson(needs.test_matrix_prep.outputs.matrix) }}
30
53
steps :
31
54
- uses : actions/checkout@v4
55
+ - uses : astral-sh/setup-uv@v3
56
+ - run : uv tool install tox
32
57
- uses : actions/setup-python@v4
33
58
with :
34
- python-version : |
35
- 3.8
36
- 3.9
37
- 3.10
38
- 3.11
39
- 3.12
40
- 3.13
41
- - name : Install tox
42
- run : |
43
- python -m pip install --upgrade pip
44
- pip install tox
59
+ python-version : ${{ matrix.python }}
45
60
- name : Run tox
46
- # we skip the 'ruff' env here, because we are running it in a separate
47
- # parallel job already
48
- run : tox --skip-env ruff
61
+ run : tox run -e py$(echo "${{ matrix.python }}" | tr -d '.')-django$(echo "${{ matrix.django }}" | tr -d '.')
0 commit comments