Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
104 lines (82 loc) · 2.85 KB
/
Copy pathMakefile
File metadata and controls
104 lines (82 loc) · 2.85 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
93
94
95
96
97
98
99
100
101
102
103
104
ifeq ($(GITHUB_ACTIONS),true)
WORKERS = 24
else
WORKERS = auto
endif
ifeq ($(GITHUB_ACTIONS),true)
# In GitHub Actions, these are set via the workflow
else
export PROOF_API_TOKEN_DEV := op://PROOF/PROOF_Test_User/dev token
export PATH_ROOTS := op://PROOF/PROOF_PATH_ROOTS/credential
endif
export OP_SERVICE_ACCOUNT_TOKEN ?= $(OP_SERVICE_ACCOUNT_TOKEN_PROOF)
OP_RUN = op run --
OP_RUN_M = op run --no-masking --
# from https://stackoverflow.com/a/10858332/1091766
# function to check a named environment variable
# see usage below for examples
check_defined = \
$(strip $(foreach 1,$1, \
$(call __check_defined,$1,$(strip $(value 2)))))
__check_defined = \
$(if $(value $1),, \
$(error Undefined $1$(if $2, ($2))))
# include sort imports via `--select I`
lint-fix:
uv run ruff check --select I --fix tests/
# included rules that are check specified in pyproject.toml
# see https://docs.astral.sh/ruff/rules/ for rules
lint-check:
uv run ruff check tests/
format-fix:
uv run ruff format tests/
format-check:
uv run ruff format --check tests/
check_env_vars:
$(call check_defined, PATH_ROOTS, env var for which paths to scrub in vcr cassettes)
$(call check_defined, PROOF_API_TOKEN_DEV, env var for test PROOF user)
check_wdl_dirs:
@uv run tests/validate_wdls.py
server_status:
$(OP_RUN_M) uv run python -m tests.cromwellapi.server_type --check-status
server_type_regulated:
$(OP_RUN_M) uv run python -m tests.cromwellapi.server_type --regulated
server_type_not_regulated:
$(OP_RUN_M) uv run python -m tests.cromwellapi.server_type --not-regulated
test_api_cached: check_env_vars check_wdl_dirs
@op run -- uv run pytest -n $(WORKERS) \
--color=yes --record-mode=once --verbose \
tests/cromwellapi/
test_api_rewrite: check_env_vars
$(OP_RUN) uv run pytest -n $(WORKERS) \
--color=yes --record-mode=rewrite --verbose \
tests/cromwellapi/
regulated-data-envs:
op inject -i .env-regulated > .env-temp
test_api_regulated_local: check_env_vars regulated-data-envs
$(OP_RUN) uv run --env-file .env-temp \
pytest -n $(WORKERS) \
--color=yes --record-mode=rewrite --verbose \
tests/cromwellapi/ && \
rm .env-temp
test_api_regulated: check_env_vars
$(OP_RUN) uv run pytest -n $(WORKERS) \
--color=yes --record-mode=rewrite --verbose \
tests/cromwellapi/
test_api_rewrite_json_report: check_env_vars
$(OP_RUN) uv run pytest -n $(WORKERS) \
--json-report --json-report-file=results.json \
--color=yes --record-mode=rewrite --verbose \
tests/cromwellapi/
test_java_validate:
@echo "Validating WDL files with womtool validate..."
@bash scripts/cromwell_validate.sh
test_java_run:
@echo "Running WDL files with cromwell run..."
@bash scripts/cromwell_run.sh
ipython: check_env_vars
cd tests/cromwellapi/ && \
$(OP_RUN_M) uv run --with rich --with ipython python -m IPython
py: check_env_vars
cd tests/cromwellapi/ && \
$(OP_RUN_M) uv run python