-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMakefile
48 lines (38 loc) · 1.37 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
.PHONY: build-container clean-container setup-githooks quality pylint build-venv clean-venv test check
PYTHON := python3
GIT_ROOT := $(shell git rev-parse --show-toplevel)
CONTAINER_NAME := "carthage_aws"
FILES = $(shell git ls-files '*.py')
# Defaurt pytest options blank
PYTEST_OPTIONS :=
all: check quality
pylint quality:
pylint $(FILES)
check test:
$(PYTHON) -mpytest --carthage-config=.github/test_config.yml tests $(PYTEST_OPTIONS)
setup-githooks:
@for hook in githooks/*; do \
ln -sf ../../$$hook .git/hooks/`basename $$hook`; \
echo "Installed $$hook"; \
done
build-container:
@set -e ;\
if ! podman container exists $(CONTAINER_NAME); then \
echo "Container carthage_aws does not exist. Building..."; \
podman run --pull=newer -di --name $(CONTAINER_NAME) --privileged -v $(HOME)/.aws:/root/.aws \
"-v$(GIT_ROOT):$(GIT_ROOT)" --device=/dev/fuse \
"-eCARTHAGE_TEST_AWS_PROFILE" "-eACCESS_KEY_ID" \
"-eAWS_SECRET_KEY" "-w$(CURDIR)" ghcr.io/hadron/carthage:latest /bin/sh; \
podman exec $(CONTAINER_NAME) apt update ; \
podman exec $(CONTAINER_NAME) apt -y install python3-pytest python3-boto3 pylint ; \
else \
echo Starting container; \
podman start $(CONTAINER_NAME); \
fi
clean-container:
-podman rm -f $(CONTAINER_NAME)
build-venv:
$(PYTHON) -mvenv .venv --system-site-packages --clear
.venv/bin/pip install -e .[dev]
clean-venv:
-rm -rf .venv