From 74128b067efa16f985a1bea803e68ab7cd97bcb3 Mon Sep 17 00:00:00 2001 From: Will Barton Date: Fri, 1 Dec 2023 14:02:37 -0500 Subject: [PATCH] Add tox env to validate requirements This will check that our requirements are appropriately compiled. --- .github/workflows/backend.yml | 7 ++++--- tox.ini | 20 +++++++++++++++++++- 2 files changed, 23 insertions(+), 4 deletions(-) diff --git a/.github/workflows/backend.yml b/.github/workflows/backend.yml index 900bc2a8210..454469c58fa 100644 --- a/.github/workflows/backend.yml +++ b/.github/workflows/backend.yml @@ -4,21 +4,21 @@ on: workflow_dispatch: paths: - '**.py' - - 'requirements/**.txt' + - 'requirements/**.in' - '**.html' - '**.mo' - '**.po' pull_request: paths: - '**.py' - - 'requirements/**.txt' + - 'requirements/**.in' - '**.html' - '**.mo' - '**.po' merge_group: paths: - '**.py' - - 'requirements/**.txt' + - 'requirements/**.in' - '**.html' - '**.mo' - '**.po' @@ -34,6 +34,7 @@ jobs: - validate-migrations - validate-assets - validate-translations + - validate-requirements - unittest services: diff --git a/tox.ini b/tox.ini index ef33c4a9e58..564efe0f2ee 100644 --- a/tox.ini +++ b/tox.ini @@ -172,7 +172,7 @@ commands= # Invoke with: tox -e validate-translations # Ensure that there are no changes to translatable strings that aren't # contained in the comitted portable object files. -# This ultimate tests whether the generated django.mo file has changed +# This ultimately tests whether the generated django.mo file has changed # (the django.po file will change because it includes the date it was # generated). # NOTE: Requires gettext. Will overwrite any existing @@ -191,6 +191,24 @@ commands= git diff --quiet */locale/*/LC_MESSAGES/django.mo +[testenv:validate-requirements] +# Invoke with: tox -e validate-requirements +# Ensure that there are no changes to dependencies in our requirements/*.in +# files that haven't been compiled to the requirements/*.txt files. +# NOTE: Will overwrite any existing requirements/*.txt files +recreate=False +envdir={toxworkdir}/unittest +deps= + {[unittest-config]deps} +setenv={[unittest-config]setenv} +allowlist_externals= + ./compile-requirements.sh + git +commands= + ./compile-requirements.sh + git diff --quiet requirements/*.txt + + [testenv:coverage] # Invoke with: tox -e coverage # Report out the coverage of changes on the current branch against the main