Skip to content

Commit 9db5398

Browse files
committed
Add tox env to validate requirements
This will check that our requirements are appropriately compiled.
1 parent c5630a1 commit 9db5398

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

.github/workflows/backend.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,23 @@ on:
55
paths:
66
- '**.py'
77
- 'requirements/**.txt'
8+
- 'requirements/**.in'
89
- '**.html'
910
- '**.mo'
1011
- '**.po'
1112
pull_request:
1213
paths:
1314
- '**.py'
1415
- 'requirements/**.txt'
16+
- 'requirements/**.in'
1517
- '**.html'
1618
- '**.mo'
1719
- '**.po'
1820
merge_group:
1921
paths:
2022
- '**.py'
2123
- 'requirements/**.txt'
24+
- 'requirements/**.in'
2225
- '**.html'
2326
- '**.mo'
2427
- '**.po'
@@ -34,6 +37,7 @@ jobs:
3437
- validate-migrations
3538
- validate-assets
3639
- validate-translations
40+
- validate-requirements
3741
- unittest
3842

3943
services:

tox.ini

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ commands=
172172
# Invoke with: tox -e validate-translations
173173
# Ensure that there are no changes to translatable strings that aren't
174174
# contained in the comitted portable object files.
175-
# This ultimate tests whether the generated django.mo file has changed
175+
# This ultimately tests whether the generated django.mo file has changed
176176
# (the django.po file will change because it includes the date it was
177177
# generated).
178178
# NOTE: Requires gettext. Will overwrite any existing
@@ -191,6 +191,24 @@ commands=
191191
git diff --quiet */locale/*/LC_MESSAGES/django.mo
192192

193193

194+
[testenv:validate-requirements]
195+
# Invoke with: tox -e validate-requirements
196+
# Ensure that there are no changes to dependencies in our requirements/*.in
197+
# files that haven't been compiled to the requirements/*.txt files.
198+
# NOTE: Will overwrite any existing requirements/*.txt files
199+
recreate=False
200+
envdir={toxworkdir}/unittest
201+
deps=
202+
{[unittest-config]deps}
203+
setenv={[unittest-config]setenv}
204+
allowlist_externals=
205+
./compile-requirements.sh
206+
git
207+
commands=
208+
./compile-requirements.sh
209+
git diff --quiet requirements/*.txt
210+
211+
194212
[testenv:coverage]
195213
# Invoke with: tox -e coverage
196214
# Report out the coverage of changes on the current branch against the main

0 commit comments

Comments
 (0)