Skip to content

Commit

Permalink
build: add compile-requirements make target
Browse files Browse the repository at this point in the history
  • Loading branch information
pomegranited committed Aug 29, 2024
1 parent dbb9dac commit b4a924f
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export BROWSER_PYSCRIPT
BROWSER := python -c "$$BROWSER_PYSCRIPT"

.PHONY: clean, coverage, diff_cover, docs, help, dev_requirements, test, test_quality, test_requirements, upgrade,\
check_keywords
compile-requirements check_keywords

help: ## Display this help message
@echo "Please use \`make <target>' where <target> is one of"
Expand Down Expand Up @@ -51,24 +51,27 @@ $(COMMON_CONSTRAINTS_TXT):
wget -O "$(@)" https://raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt || touch "$(@)"
echo "$(COMMON_CONSTRAINTS_TEMP_COMMENT)" | cat - $(@) > temp && mv temp $(@)

export CUSTOM_COMPILE_COMMAND = make upgrade
upgrade: piptools $(COMMON_CONSTRAINTS_TXT) ## update the requirements/*.txt files with the latest packages satisfying requirements/*.in
compile-requirements: export CUSTOM_COMPILE_COMMAND = make upgrade
compile-requirements: piptools $(COMMON_CONSTRAINTS_TXT) ## update the requirements/*.txt files with the latest packages satisfying requirements/*.in
# Make sure to compile files after any other files they include!
pip-compile --upgrade --allow-unsafe --rebuild -o requirements/pip.txt requirements/pip.in
pip-compile --upgrade --verbose --rebuild -o requirements/pip-tools.txt requirements/pip-tools.in
pip-compile ${COMPILE_OPTS} --allow-unsafe --rebuild -o requirements/pip.txt requirements/pip.in
pip-compile ${COMPILE_OPTS} --verbose --rebuild -o requirements/pip-tools.txt requirements/pip-tools.in
pip install -qr requirements/pip.txt
pip install -qr requirements/pip-tools.txt
pip-compile --upgrade --verbose --rebuild -o requirements/base.txt requirements/base.in
pip-compile --upgrade --verbose --rebuild -o requirements/docs.txt requirements/docs.in
pip-compile --upgrade --verbose --rebuild -o requirements/test.txt requirements/test.in
pip-compile --upgrade --verbose --rebuild -o requirements/dev.txt requirements/dev.in
pip-compile --upgrade --verbose --rebuild -o requirements/tox.txt requirements/tox.in
pip-compile --upgrade --verbose --rebuild -o requirements/ci.txt requirements/ci.in
pip-compile ${COMPILE_OPTS} --verbose --rebuild -o requirements/base.txt requirements/base.in
pip-compile ${COMPILE_OPTS} --verbose --rebuild -o requirements/docs.txt requirements/docs.in
pip-compile ${COMPILE_OPTS} --verbose --rebuild -o requirements/test.txt requirements/test.in
pip-compile ${COMPILE_OPTS} --verbose --rebuild -o requirements/dev.txt requirements/dev.in
pip-compile ${COMPILE_OPTS} --verbose --rebuild -o requirements/tox.txt requirements/tox.in
pip-compile ${COMPILE_OPTS} --verbose --rebuild -o requirements/ci.txt requirements/ci.in
# Let tox control the Django and DRF versions for tests
sed -i.tmp '/^django==/d' requirements/test.txt
sed -i.tmp '/^djangorestframework==/d' requirements/test.txt
rm requirements/test.txt.tmp

upgrade: ## update the pip requirements files to use the latest releases satisfying our constraints
$(MAKE) compile-requirements COMPILE_OPTS="--upgrade"

test: clean ## Run tests in the current virtualenv
pytest

Expand Down

0 comments on commit b4a924f

Please sign in to comment.