@@ -16,6 +16,9 @@ LAMBDA_LAYER_PYTHON_PATH=python/lib/python$(PYTHON_VERSION)/site-packages
1616
1717ZIP_BASE_PATH = ./$(LAMBDAS_BUILD_PATH ) /$(lambda_name ) /tmp
1818ZIP_COMMON_FILES = lambdas/utils lambdas/models lambdas/services lambdas/repositories lambdas/enums lambdas/scripts
19+ CONTAINER ?= false
20+
21+ .PHONY : install clean help format list requirements ruff
1922
2023default : help
2124
@@ -70,33 +73,62 @@ download-api-certs: ## Downloads mTLS certificates (use with dev envs only). Usa
7073 ./scripts/aws/download-api-certs.sh $(WORKSPACE )
7174
7275test-api-e2e :
76+ ifeq ($(CONTAINER ) , true)
77+ cd ./lambdas && PYTHONPATH=. poetry run pytest tests/e2e/api --ignore=tests/e2e/api/fhir -vv
78+ else
7379 cd ./lambdas && ./venv/bin/python3 -m pytest tests/e2e/api --ignore=tests/e2e/api/fhir -vv
80+ endif
7481
75- test-fhir-api-e2e : # # Runs FHIR API E2E tests. Usage: make test-fhir-api-e2e WORKSPACE=<workspace>
76- ./scripts/test/run-e2e-fhir-api-tests.sh --workspace $(WORKSPACE )
82+ test-fhir-api-e2e : # # Runs FHIR API E2E tests. Usage: make test-fhir-api-e2e WORKSPACE=<workspace> CONTAINER=<true|false>
83+ ./scripts/test/run-e2e-fhir-api-tests.sh --workspace $(WORKSPACE ) --container $( CONTAINER )
7784 rm -rf ./lambdas/mtls_env_certs/$(WORKSPACE )
7885
7986test-apim-e2e : # # Runs APIM E2E tests for National Document Repository FHIR R4 API against ndr-dev.
80- ./scripts/test/run-apim-e2e-tests.sh
87+ ./scripts/test/run-apim-e2e-tests.sh --container $( CONTAINER )
8188
8289test-api-e2e-snapshots :
90+ ifeq ($(CONTAINER ) , true)
91+ cd ./lambdas && PYTHONPATH=. poetry run pytest tests/e2e/api --ignore=tests/e2e/api/fhir --snapshot-update
92+ else
8393 cd ./lambdas && ./venv/bin/python3 -m pytest tests/e2e/api --ignore=tests/e2e/api/fhir --snapshot-update
94+ endif
8495
8596test-bulk-upload-e2e :
97+ ifeq ($(CONTAINER ) , true)
98+ cd ./lambdas && PYTHONPATH=. poetry run pytest tests/e2e/bulk_upload -vv
99+ else
86100 cd ./lambdas && ./venv/bin/python3 -m pytest tests/e2e/bulk_upload -vv
101+ endif
87102
88103test-unit :
104+ ifeq ($(CONTAINER ) , true)
105+ cd ./lambdas && \
106+ PYTHONPATH=. poetry run pytest tests/unit ../scripts/github/checklist_validator/tests
107+ else
89108 cd ./lambdas && \
90109 PYTHONPATH=.. ./venv/bin/python3 -m pytest tests/unit ../scripts/github/checklist_validator/tests
110+ endif
91111
92112test-unit-coverage :
113+ ifeq ($(CONTAINER ) , true)
114+ cd ./lambdas && PYTHONPATH=. poetry run pytest tests/unit --cov=. --cov-report xml:coverage.xml
115+ else
93116 cd ./lambdas && ./venv/bin/python3 -m pytest tests/unit --cov=. --cov-report xml:coverage.xml
117+ endif
94118
95119test-unit-coverage-html :
120+ ifeq ($(CONTAINER ) , true)
121+ cd ./lambdas && poetry run coverage run --source=. --omit="tests/*" -m pytest -v tests/unit && coverage report && coverage html
122+ else
96123 cd ./lambdas && coverage run --source=. --omit="tests/*" -m pytest -v tests/unit && coverage report && coverage html
124+ endif
97125
98126test-unit-collect :
127+ ifeq ($(CONTAINER ) , true)
128+ cd ./lambdas && PYTHONPATH=. poetry run pytest tests/unit --collect-only
129+ else
99130 cd ./lambdas && ./venv/bin/python3 -m pytest tests/unit --collect-only
131+ endif
100132
101133env :
102134 @echo " Removing old venv."
@@ -164,6 +196,23 @@ install-pdfjs:
164196 unzip -o -d ./app/public/pdfjs ./app/public/pdfjs/pdfjs.zip
165197 rm ./app/public/pdfjs/pdfjs.zip
166198
199+ # Environment tooling targets:
200+ install-asdf :
201+ echo " Setting up ASDF and related dependencies"
202+ cut -d ' ' -f1 .tool-versions | xargs -I {} asdf plugin add {} || true
203+ asdf install
204+
205+ install-poetry :
206+ echo " Installing all poetry dependencies to local environment"
207+ poetry install
208+
209+ echo "Generating 'requirements.txt' files"
210+ $(MAKE) requirements
211+
212+ install-dev : install-asdf install-poetry install-cypress
213+ git config --unset-all core.hooksPath || true
214+ pre-commit install --config src/config/pre-commit.yml --install-hooks
215+
167216start :
168217 npm --prefix ./app start
169218
@@ -189,11 +238,13 @@ docker-down:
189238 docker-compose -f ./app/docker-compose.yml down
190239
191240cypress-open :
192- TZ=GMT npm --prefix ./app run cypress
241+ xvfb-run -- npm --prefix ./app run cypress
193242
194243cypress-run :
195- TZ=GMT npm --prefix ./app run cypress-run
244+ xvfb-run -- npm --prefix ./app run cypress-run
196245
197246cypress-report :
198- TZ=GMT npm --prefix ./app run cypress-report
247+ xvfb-run -- npm --prefix ./app run cypress-report
199248
249+ install-cypress :
250+ npm install --save-dev cypress
0 commit comments