Skip to content

Commit 748cdca

Browse files
committed
fixes CI workflow
1 parent 16eb585 commit 748cdca

File tree

1 file changed

+39
-71
lines changed

1 file changed

+39
-71
lines changed

.github/workflows/test.yml

Lines changed: 39 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,13 @@
11
name: Test
22

33
on:
4+
workflow_dispatch:
45
push:
5-
branches:
6-
- '**' # matches every branch
7-
8-
9-
defaults:
10-
run:
11-
shell: bash
12-
13-
permissions:
14-
id-token: write
15-
attestations: write
16-
6+
branches: [ "develop" ]
7+
tags-ignore: [ "**" ]
8+
pull_request:
9+
schedule:
10+
- cron: "0 8 * * *"
1711

1812
jobs:
1913
changes:
@@ -23,68 +17,51 @@ jobs:
2317
run:
2418
shell: bash
2519
outputs:
26-
run_tests: ${{steps.changes.outputs.run_tests }}
27-
lint: ${{steps.changes.outputs.lint }}
20+
run_tests: ${{ steps.changes.outputs.run_tests }}
2821
steps:
2922
- name: Checkout code
30-
uses: actions/checkout@v4.1.7
23+
uses: actions/checkout@v4
3124
- id: changes
3225
name: Check for file changes
33-
uses: dorny/[email protected].2
26+
uses: dorny/paths-filter@0bc4621a3135347011ad047f9ecf449bf72ce2bd # v3.0.0
3427
with:
3528
base: ${{ github.ref }}
3629
token: ${{ github.token }}
3730
filters: .github/file-filters.yml
3831

39-
ci:
32+
test:
4033
needs: [ changes ]
41-
if: needs.changes.outputs.run_tests
42-
runs-on: ubuntu-latest
43-
name: Test py${{ matrix.python-version }}/dj${{matrix.django-version}}
44-
defaults:
45-
run:
46-
shell: bash
34+
if: needs.changes.outputs.run_tests == 'true'
4735
services:
48-
postgres:
49-
image: postgres:14
50-
env:
51-
POSTGRES_USER: postgres
52-
POSTGRES_PASSWORD: postgres
53-
POSTGRES_DB: adminfilters
54-
ports:
55-
- 5432:5432
56-
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
36+
redis:
37+
image: redis
38+
39+
runs-on: ubuntu-latest
5740
strategy:
58-
max-parallel: 1
41+
fail-fast: false
5942
matrix:
60-
python: [ "3.13", "3.11"]
61-
django: [ "52", "42"]
62-
exclude:
63-
- django: 32
64-
python: 3.13
65-
- django: 52
66-
python: 3.9
67-
fail-fast: true
43+
django: [ "52", "42"]
44+
python: [ "3.13", "3.11" ]
45+
6846
env:
69-
DOCKER_DEFAULT_PLATFORM: linux/amd64
70-
DATABASE_URL: postgres://postgres:postgres@localhost:5432/adminfilters
47+
CELERY_BROKER_URL: redis://redis:6379/0
48+
CELERY_ALWAYS_EAGER: true
7149
steps:
72-
- name: Checkout code
73-
uses: actions/[email protected]
74-
- name: Set up Python ${{ matrix.python }}
75-
uses: actions/setup-python@v5
50+
- uses: actions/checkout@v5
7651
with:
77-
python: ${{ matrix.python }}
78-
architecture: 'x64'
79-
- name: Restore cached venv
80-
id: cache-venv-restore
81-
uses: actions/cache/restore@v4
82-
with:
83-
path: |
84-
.cache-uv/
85-
.venv/
86-
key: ${{ matrix.python }}-${{matrix.django}}-${{ hashFiles('pyproject.toml') }}-venv
52+
fetch-depth: 0
8753

54+
- name: Install the latest version of uv
55+
uses: astral-sh/setup-uv@v7
56+
with:
57+
version: "latest"
58+
enable-cache: true
59+
cache-dependency-glob: |
60+
pyproject.toml
61+
uv.lock
62+
cache-suffix: ${{ matrix.python }}-${{ matrix.django }}
63+
github-token: ${{ secrets.GITHUB_TOKEN }}
64+
python-version: ${{ matrix.python }}
8865

8966
- name: Install tox
9067
run: uv tool install --python-preference only-managed --python 3.13 tox --with tox-uv --with tox-gh-actions
@@ -99,30 +76,21 @@ jobs:
9976
- name: Run test suite d${{ matrix.django }}-py${{ matrix.python }}
10077
run: tox -e d${{ matrix.django }}-py$(echo ${{ matrix.python }} | sed 's/\.//')
10178

102-
- name: Cache venv
103-
if: steps.cache-venv-restore.outputs.cache-hit != 'true'
104-
id: cache-venv-save
105-
uses: actions/cache/save@v4
106-
with:
107-
path: |
108-
.cache-uv/
109-
.venv/
110-
key: ${{ matrix.python-version }}-${{matrix.django-version}}-${{ hashFiles('pyproject.toml') }}-venv
111-
11279
- name: Upload pytest test results
11380
uses: actions/upload-artifact@v4
11481
with:
115-
name: pytest-results-${{ matrix.python-version }}-${{matrix.django-version}}
116-
path: junit-${{ matrix.python-version }}-${{matrix.django-version}}.xml
82+
name: pytest-results-${{ matrix.python }}-${{matrix.django}}
83+
path: junit-${{ matrix.python }}-${{matrix.django}}.xml
11784
if: ${{ always() }}
11885

11986
- name: Upload coverage to Codecov
120-
uses: codecov/codecov-action@v4
121-
if: matrix.python-version == 3.12
87+
uses: codecov/codecov-action@v5
88+
if: matrix.python == 3.12
12289
continue-on-error: true
12390
with:
12491
env_vars: OS,PYTHON
12592
fail_ci_if_error: true
93+
slug: saxix/django-smart-admin
12694
flags: unittests
12795
files: ./coverage.xml
12896
verbose: false

0 commit comments

Comments
 (0)