|
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 |
| - tests: |
| 12 | + formatting: |
| 13 | + name: "Check Code Formatting" |
| 14 | + runs-on: ubuntu-latest |
| 15 | + steps: |
| 16 | + - uses: actions/checkout@v4 |
| 17 | + - uses: astral-sh/ruff-action@v3 |
| 18 | + with: |
| 19 | + args: "--version" |
| 20 | + - run: "ruff format --check --diff" |
| 21 | + |
| 22 | + linting: |
| 23 | + name: "Check Code Linting" |
| 24 | + runs-on: ubuntu-latest |
| 25 | + steps: |
| 26 | + - uses: actions/checkout@v4 |
| 27 | + - uses: astral-sh/ruff-action@v3 |
| 28 | + with: |
| 29 | + args: "--version" |
| 30 | + - run: "ruff check --diff" |
| 31 | + |
| 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 |
11 | 49 | runs-on: ubuntu-latest
|
| 50 | + strategy: |
| 51 | + fail-fast: false |
| 52 | + matrix: ${{ fromJson(needs.test_matrix_prep.outputs.matrix) }} |
12 | 53 | steps:
|
13 |
| - - uses: actions/checkout@v3 |
| 54 | + - uses: actions/checkout@v4 |
| 55 | + - uses: astral-sh/setup-uv@v3 |
| 56 | + - run: uv tool install tox |
14 | 57 | - uses: actions/setup-python@v4
|
15 | 58 | with:
|
16 |
| - python-version: | |
17 |
| - 3.8 |
18 |
| - 3.9 |
19 |
| - 3.10 |
20 |
| - 3.11 |
21 |
| - - name: Install tox |
22 |
| - run: | |
23 |
| - python -m pip install --upgrade pip |
24 |
| - pip install tox |
| 59 | + python-version: ${{ matrix.python }} |
25 | 60 | - name: Run tox
|
26 |
| - run: tox |
| 61 | + run: tox run --skip-missing-interpreters=false -e py$(echo "${{ matrix.python }}" | tr -d '.')-django$(echo "${{ matrix.django }}" | tr -d '.') |
0 commit comments