-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add isolated build and helpers for tests Connected: - #204
- Loading branch information
Showing
6 changed files
with
438 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
build* | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
FROM ubuntu:20.04 | ||
MAINTAINER Nitrokey <[email protected]> | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
RUN apt update && apt install -qy --no-install-recommends \ | ||
libhidapi-dev libusb-1.0-0-dev cmake gcc g++ make doxygen pkg-config alien git graphviz \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
RUN mkdir -p /app | ||
|
||
WORKDIR /app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
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 -v $(PWD):/app $(IMAGE_NAME) bash -c "make ci-build" | ||
|
||
.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 | ||
|
||
.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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
[[source]] | ||
name = "pypi" | ||
url = "https://pypi.org/simple" | ||
verify_ssl = true | ||
|
||
[dev-packages] | ||
|
||
[packages] | ||
cffi = "*" | ||
pytest-repeat = "*" | ||
pytest-randomly = "*" | ||
tqdm = "*" | ||
oath = "*" | ||
pyexpect = "*" | ||
pytest = "*" | ||
pytest-reporter-html1 = "*" | ||
pytest-reporter = "*" | ||
hypothesis = "*" | ||
|
||
[requires] | ||
python_version = "3.9" |
Oops, something went wrong.