-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
71 lines (60 loc) · 1.57 KB
/
Makefile
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
VERSION ?= local
IMAGE_REPOSITORY=canary-python
IMAGE_URI=$(IMAGE_REPOSITORY):$(VERSION)
.PHONY: build_image
build_image:
echo "building image" && \
docker build \
--no-cache \
-f ./Dockerfile \
-t "${IMAGE_URI}" \
.
.PHONY: run
run: setup_env
PYTHONPATH="$${PWD}" python src/run.py
.PHONY: submit_part_a
submit_part_a: setup_env
PYTHONPATH="$${PWD}" python src/submit.py a
.PHONY: submit_part_b
submit_part_b: setup_env
PYTHONPATH="$${PWD}" python src/submit.py b
.PHONY: coverage_report
coverage_report: test
@coverage html
open ./htmlcov/index.html || echo "Done creating coverage report. Open $${PWD}/htmlcov/index.html in a web browser."
.PHONY: format
format: setup_env_dev
ruff format .
ruff check . --fix
.PHONY: lint
lint: setup_env_dev
ruff format . --check
ruff check . --no-fix
.PHONY: setup_env
setup_env:
pip install --upgrade pip
pip install .
.PHONY: setup_env_dev
setup_env_dev:
pip install --upgrade pip
pip install --prefer-binary -r ./requirements-dev.txt
.PHONY: test
test: setup_env_dev
PYTHONPATH="$${PWD}" pytest \
-m "not integration_test" \
--cov $${PWD}/src \
-v \
tests/
.PHONY: test_and_lint_in_docker
test_and_lint_in_docker: build_image
echo "running tests" && \
docker run \
-v $$(pwd)/Makefile:/app/Makefile \
-v $$(pwd)/setup.cfg:/app/setup.cfg \
-v $$(pwd)/requirements-dev.txt:/app/requirements-dev.txt \
-v $$(pwd)/tests:/app/tests \
--workdir /app \
--entrypoint="" \
--rm \
-t "${IMAGE_URI}" \
/bin/bash -c "apt-get update -y && apt-get install --no-install-recommends make && make setup_env_dev lint test"