This repository has been archived by the owner on Jan 28, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
70 lines (53 loc) · 1.97 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
ORG_NAME=welder
ifeq ($(API_CONTAINER_RUNNING),skip-check)
else
API_CONTAINER_RUNNING=$(shell sudo docker ps | grep -c api)
endif
default: all
all: bdcs-cli
sandbox:
cabal update
cabal sandbox init
bdcs-cli: sandbox
cabal install --dependencies-only
cabal configure
cabal build
clean:
cabal clean
hlint:
if [ -z "$$(which hlint)" ]; then \
echo hlint not found in PATH - install it; \
exit 1; \
else \
hlint .; \
fi
tests: sandbox
# TODO: shouldn't we install dependencies from RPMs instead ?
cabal install --dependencies-only --enable-tests
cabal configure --enable-tests --enable-coverage --ghc-option=-DTEST
cabal build
cabal test --show-details=always
test-in-docker: Dockerfile.build
sudo docker network inspect welder || sudo docker network create welder
# run the API backend which provides depsolving
# metdata.db will be created after all unit tests pass
[ "$(API_CONTAINER_RUNNING)" == "1" ] || sudo docker run -d --name api -p 4000:4000 -v `pwd`:/mddb -v `pwd`/examples/recipes:/recipes --security-opt label=disable --network welder welder/bdcs-api-img:latest
# building the docker image and execute the tests
sudo docker build -t $(ORG_NAME)/bdcs-cli:latest -f $< .
sudo docker run --rm --network welder --security-opt label=disable -v `pwd`:/bdcs-cli/ welder/bdcs-cli
sudo docker stop api
sudo docker rm api
sudo docker network remove welder
ci: test-in-docker
# this is executed on a Fedora 27 system in Jenkins
# so first compile the binaries and then run image build tests
test-images: bdcs-cli
./tests/test_images.sh
ci_after_success:
sudo docker run --rm --security-opt label=disable -v `pwd`:/bdcs-cli/ \
--env "TRAVIS=$$TRAVIS" --env "TRAVIS_JOB_ID=$$TRAVIS_JOB_ID" \
--entrypoint /usr/bin/make welder/bdcs-cli coveralls
coveralls: sandbox
[ -x .cabal-sandbox/bin/hpc-coveralls ] || cabal install hpc-coveralls
.cabal-sandbox/bin/hpc-coveralls --display-report test-bdcs bdcs
.PHONY: sandbox bdcs-cli clean test hlint