-
Notifications
You must be signed in to change notification settings - Fork 34
/
Copy pathMakefile
70 lines (56 loc) · 1.92 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
NPROC=$(shell nproc)
IMAGE_NAME=libnk-build
BUILD_DIR=build
.PHONY: docker-build-all
docker-build-all:
@echo "Running isolated build"
$(MAKE) docker-build-image
$(MAKE) docker-build
.PHONY: docker-build-image
docker-build-image:
sudo docker build -t $(IMAGE_NAME) .
.PHONY: docker-build
docker-build:
sudo docker run -it --rm -v $(PWD):/app $(IMAGE_NAME) bash -c "make ci-build"
DOCKERCMD=bash -c "make ci-package"
.PHONY: docker-package
docker-package:
sudo docker run -it --rm -v $(PWD):/app $(IMAGE_NAME) $(DOCKERCMD)
.PHONY: docker-clean
docker-clean:
cd $(BUILD_DIR) && $(MAKE) clean
sudo docker rmi $(IMAGE_NAME) --force
.PHONY: ci-build
ci-build:
mkdir -p $(BUILD_DIR) && rm -rf $(BUILD_DIR)/*
cd $(BUILD_DIR) && cmake .. && $(MAKE) -j$(NPROC) package
cd $(BUILD_DIR) && ctest -VV
cd $(BUILD_DIR) && mkdir -p install && $(MAKE) install DESTDIR=install
@echo "== Results available in $(BUILD_DIR)"
@date
DGET_URL=https://people.debian.org/~patryk/tmp/libnitrokey/libnitrokey_3.7-1.dsc
.PHONY: ci-package
ci-package:
mkdir -p $(BUILD_DIR) && rm -rf $(BUILD_DIR)/*
cd $(BUILD_DIR) && dget $(DGET_URL)
cd $(BUILD_DIR) && cd libnitrokey-* && dpkg-buildpackage
.PHONY: ci-tests
ci-tests:
pip install pytest --user
pip install -r unittest/requirements.txt --user
cd unittest && python3 -m pytest -sv test_offline.py
REPORT_NAME=libnitrokey-tests-report.html
PYTEST_ARG=-vx --randomly-dont-reorganize --template=html1/index.html --report=$(REPORT_NAME)
tests-setup:
cd unittest && pipenv --python $(shell which python3) && pipenv install --dev
.PHONY: tests-pro
tests-pro:
cd unittest && pipenv run pytest $(PYTEST_ARG) test_pro.py ; xdg-open $(REPORT_NAME)
.PHONY: tests-storage
tests-storage:
cd unittest && pipenv run pytest $(PYTEST_ARG) test_pro.py
cd unittest && pipenv run pytest $(PYTEST_ARG) test_storage.py ; xdg-open $(REPORT_NAME)
.PHONY: clean clean-all
clean:
-rm $(REPORT_NAME)
clean-all: clean docker-clean