forked from packit/packit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
44 lines (35 loc) · 1.3 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
IMAGE=quay.io/packit/packit
TESTS_IMAGE=packit-tests
CONTAINER_ENGINE ?= $(shell command -v podman 2> /dev/null || echo docker)
TESTS_RECORDING_PATH=tests_recording
TESTS_TARGET ?= ./tests/unit ./tests/integration ./tests/functional
# In case you don't want to use pre-built image
image:
$(CONTAINER_ENGINE) build --rm --tag $(IMAGE) .
tests_image:
$(CONTAINER_ENGINE) build --rm --tag $(TESTS_IMAGE) -f Dockerfile.tests .
sleep 2
tests_image_remove:
$(CONTAINER_ENGINE) rmi $(TESTS_IMAGE)
install:
pip3 install --user .
check:
find . -name "*.pyc" -exec rm {} \;
PYTHONPATH=$(CURDIR) PYTHONDONTWRITEBYTECODE=1 python3 -m pytest --verbose --showlocals $(TESTS_TARGET)
# example: TESTS_TARGET=tests/unit/test_api.py make check_in_container
check_in_container: tests_image
$(CONTAINER_ENGINE) run --rm -ti \
--env TESTS_TARGET \
-v $(CURDIR):/src \
--security-opt label=disable \
$(TESTS_IMAGE) \
bash -c "pip3 install .; make check"
# Mounts your ~/.config/ where .packit.yaml with your github/gitlab tokens is expected
check_in_container_regenerate_data: tests_image
$(CONTAINER_ENGINE) run --rm -ti \
--env TESTS_TARGET=$(TESTS_RECORDING_PATH) \
-v $(CURDIR):/src \
-v $(HOME)/.config:/root/.config \
--security-opt label=disable \
$(TESTS_IMAGE) \
bash -c "pip3 install .; make check"