build: Set Django version for tests more safely; drop support for non-GHA (#31387)
We have a need to lock the version of Django for production and tests, but also to test on newer versions of Django so that we can get the repo ready for long-term-support releases. We've been doing that by extracting the `django==x.y.z` from the pip-compiled files and moving it to a django.txt that is then co-installed but can be overridden during tests. The problem is that this can result in broken packages. The approach here is to have `make test-requirements` continue to ensure a consistent set of packages, and then install a different Django on top of that in the CI script -- and call `pip check` to make sure that combination isn't broken. Adding Django 4.0 to the unit-tests.yml matrix will now correctly result in this error and a failing job: `django-splash 1.2.1 has requirement Django<4.0, but you have django 4.0.8.` The other half of this is to change other CI runners to remove their ability to control the Django version, since it's complicated to make this work, and we probably only need it in unit-tests.yml. Convert them to just use `make test-requirements`. Also: - Simplify handling of `pip --src` by setting `PIP_SRC` (rather than our own `PIP_SRC_DIR`, which pip ignores because `--src-dir` isn't an option that it knows). This is needed to allow `make test-requirements` to do the pip calls. An alternative would be to set a pip-options env var for the make target to use, but `PIP_SRC` already exists. - Remove outdated modifications to common_constraints - Add comment explaining why pylint tests need dev-requirements
This commit is contained in:
11
Makefile
11
Makefile
@@ -118,12 +118,6 @@ $(COMMON_CONSTRAINTS_TXT):
|
||||
|
||||
compile-requirements: export CUSTOM_COMPILE_COMMAND=make upgrade
|
||||
compile-requirements: $(COMMON_CONSTRAINTS_TXT) ## Re-compile *.in requirements to *.txt
|
||||
@# This is a temporary solution to override the real common_constraints.txt
|
||||
@# In edx-lint, until the pyjwt constraint in edx-lint has been removed.
|
||||
@# See BOM-2721 for more details.
|
||||
sed 's/Django<2.3//g' requirements/common_constraints.txt > requirements/common_constraints.tmp
|
||||
mv requirements/common_constraints.tmp requirements/common_constraints.txt
|
||||
|
||||
pip install -q pip-tools
|
||||
pip-compile --allow-unsafe --upgrade -o requirements/edx/pip.txt requirements/edx/pip.in
|
||||
|
||||
@@ -139,11 +133,6 @@ compile-requirements: $(COMMON_CONSTRAINTS_TXT) ## Re-compile *.in requirements
|
||||
pip install -qr requirements/edx/pip.txt
|
||||
pip install -qr requirements/edx/pip-tools.txt
|
||||
|
||||
# Let tox control the Django version for tests
|
||||
grep -e "^django==" requirements/edx/base.txt > requirements/edx/django.txt
|
||||
sed '/^[dD]jango==/d' requirements/edx/testing.txt > requirements/edx/testing.tmp
|
||||
mv requirements/edx/testing.tmp requirements/edx/testing.txt
|
||||
|
||||
upgrade: pre-requirements ## update the pip requirements files to use the latest releases satisfying our constraints
|
||||
$(MAKE) compile-requirements COMPILE_OPTS="--upgrade"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user