-
-
Notifications
You must be signed in to change notification settings - Fork 24
167 lines (149 loc) · 4.69 KB
/
test.yml
File metadata and controls
167 lines (149 loc) · 4.69 KB
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
name: Django CI
on:
pull_request:
branches:
- master
push:
branches:
- master
workflow_dispatch:
jobs:
uv-lock-check:
runs-on: ubuntu-latest
name: "UV Lockfile Sync Validation 🔒"
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@v5
with:
persist-credentials: false
- name: Install uv
uses: astral-sh/setup-uv@v6
- name: Check uv.lock sync status
run: uv lock --locked
ruff:
runs-on: ubuntu-latest
name: "ruff on code"
permissions:
contents: read
steps:
- uses: actions/checkout@v5
with:
persist-credentials: false
- name: Run Ruff Linting 🧹
uses: astral-sh/ruff-action@v3
- name: Run Ruff Formatting 🧽
run: ruff format --check .
test-regular:
needs: ["ruff", "uv-lock-check"]
runs-on: ubuntu-latest
name: "Tests py${{ matrix.python-version }}/dj${{ matrix.django-version }}/${{ matrix.broker }}"
strategy:
fail-fast: false
max-parallel: 6
matrix:
python-version: ["3.11", "3.12", "3.13", "3.14", "3.14t"]
django-version: ["5.2.5"]
broker: ["redis", "fakeredis", "valkey"]
include:
- python-version: "3.14t"
django-version: "5.2.5"
broker: "redis"
coverage: yes
permissions:
pull-requests: write
services:
redis:
image: redis:8.0.0
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
valkey:
image: valkey/valkey:8.0
ports:
- 6380:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
outputs:
version: ${{ steps.getVersion.outputs.VERSION }}
steps:
- uses: actions/checkout@v5
with:
persist-credentials: false
- name: Install uv
uses: astral-sh/setup-uv@v6
- uses: actions/setup-python@v6
with:
cache-dependency-path: uv.lock
python-version: "${{ matrix.python-version }}"
allow-prereleases: true
- name: Install Django version
shell: bash
run: |
if [ ${{ matrix.broker == 'valkey' }} == true ]; then
additional_args="--extra valkey"
fi
uv sync --extra yaml $additional_args
uv pip install django==${{ matrix.django-version }}
- name: Get version
id: getVersion
shell: bash
run: |
VERSION=$(uv version --short)
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
- name: Check for missing migrations
run: |
cd testproject
uv run python manage.py makemigrations --check
- name: Run Tests without coverage
if: ${{ matrix.coverage != 'yes' }}
run: |
cd testproject
export FAKEREDIS=${{ matrix.broker == 'fakeredis' }}
if [ ${{ matrix.broker == 'valkey' }} == true ]; then
export BROKER_PORT=6380
else
export BROKER_PORT=6379
fi
uv run python manage.py test --exclude-tag multiprocess scheduler
# Steps for coverage check
- name: Run tests with coverage
uses: ./.github/actions/test-coverage
if: ${{ matrix.coverage == 'yes' }}
with:
pythonVer: ${{ matrix.python-version }}
djangoVer: ${{ matrix.django-version }}
repoToken: ${{ secrets.GITHUB_TOKEN }}
- name: Create coverage badge
if: ${{ matrix.coverage == 'yes' && github.event_name == 'push' }}
uses: schneegans/dynamic-badges-action@7142847813c746736c986b42dec98541e49a2cea
with:
auth: ${{ secrets.GIST_SECRET }}
gistID: b756396efb895f0e34558c980f1ca0c7
filename: django-tasks-scheduler-4.json
label: coverage
message: ${{ env.COVERAGE }}%
color: green
# Prepare a draft release for the GitHub Releases page for manual verification
# If accepted and published, the release workflow would be triggered
update_release_draft:
permissions:
# write permission is required to create a GitHub release
contents: write
# write permission is required for auto-labeler
# otherwise, read permission is required at least
pull-requests: write
needs: test-regular
runs-on: ubuntu-latest
steps:
- uses: release-drafter/release-drafter@b1476f6e6eb133afa41ed8589daba6dc69b4d3f5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}