Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
92 lines (75 loc) · 3 KB
/
Copy pathMakefile
File metadata and controls
92 lines (75 loc) · 3 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
SHELL := /bin/bash
DOCKER := $(shell which docker)
DOCKER_COMPOSE := ${DOCKER} compose
ARGS_TESTS ?=
# Targets like `format`, `migrations`, `upgrade-requirements` and `build-js`
# write into the bind-mounted working copy, so the container runs as the caller.
# `docker compose` cannot shell out for the uid, so pass it along here. Not
# named `UID`, which zsh reserves and refuses to let you override.
APP_UID ?= $(shell id -u)
export APP_UID
SUITE_STAMP=.test-use-suite
INSUITE=$(shell cat ${SUITE_STAMP} 2>/dev/null)
ifeq (${INSUITE}, 1)
BASE_COMMAND := docker exec -ti suite-lando-1
else
BASE_COMMAND := ${DOCKER_COMPOSE} run --volume ./coverage.xml:/app/coverage.xml --rm lando
endif
# This target needs to be the first in the file, so it's called by default.
# Any target with an inline comment introduced with `##` will be shown here.
# Keeping `##` markers aligned in this file will ensure the output is aligned, too.
.PHONY: help
help: ## show this message and exit
@${DOCKER} --version
@${DOCKER_COMPOSE} version
@echo "usage: make <target>"
@echo
@echo "target is one of:"
@sed -n 's/\(^[^ :]*\+\):\s*##\s*\(.*\)$$/ :\1:\2/p' Makefile | column --table --separator :
.PHONY: add-requirements
add-requirements: ## update requirements.txt with new requirements
${BASE_COMMAND} lando generate_requirements
.PHONY: attach
attach: ## attach for debugging (ctrl-p ctrl-q to detach)
ifeq (${INSUITE}, 1)
-@docker attach suite-lando-1 ||:
else
-@${DOCKER_COMPOSE} attach lando ||:
endif
.PHONY: build
build: ## build the container images
${DOCKER_COMPOSE} build
.PHONY: format
format: ## run ruff and djLint on source code
${BASE_COMMAND} lando format
.PHONY: migrations
migrations: ## generates migration files to reflect model changes in the database
${BASE_COMMAND} lando makemigrations
.PHONY: test
test: ## run the Python and JavaScript test suites
test: test-py test-js
.PHONY: test-js
test-js: ## run the JavaScript test suite (Vitest)
${BASE_COMMAND} npm test
.PHONY: build-js
build-js: ## build the Vue frontend bundle (output dir set by `build.outDir` in vite.config.ts)
${BASE_COMMAND} npm run build
.PHONY: test-py
test-py: ##run the Python test suite
touch coverage.xml
${BASE_COMMAND} lando tests -- ${ARGS_TESTS}
.PHONY: test-use-local
test-use-local: ## run the testsuite using the local environment
rm -f ${SUITE_STAMP}
.PHONY: test-use-suite
test-use-suite: ## run the testsuite using the conduit-suite environment
echo 1 > ${SUITE_STAMP}
.PHONY: upgrade-npm-packages
upgrade-npm-packages: ## update package-lock.json
# npm >= 11.x has support for min-release-age=7 in `.npmrc`,
# but we are still on 10.x from bookworm.
${BASE_COMMAND} npm install --before="$(shell date -I -d '7 days ago')"
.PHONY: upgrade-requirements
upgrade-requirements: UPGRADE_ARGS=--upgrade
upgrade-requirements: ## upgrade packages in requirements.txt. Pass `UPGRADE_ARGS=` to the `make` call to only regenerate the file without upgrades. `--no-cooldown` Is also available.
${BASE_COMMAND} lando generate_requirements ${UPGRADE_ARGS}