Use a workaround of Gitlab issue 2148.wq
[open-adventure.git] / .gitlab-ci.yml
1 image: alpine
2
3 before_script:
4   - git submodule sync --recursive
5   - git submodule update --init --recursive
6
7 stages:
8   - build
9   - test
10   - deploy
11
12 # build advent itself
13 binary:debug:
14   stage: build
15   before_script:
16     - apk update
17     - apk add make gcc musl-dev
18   script: 
19     - make debug
20   artifacts:
21     paths:
22       - advent
23       - "*.gcda"
24       - "*.gcno"
25   # cache outputs to reduce the build time
26   cache:
27     paths:
28       - "*.o"
29
30 binary:release:
31   stage: build
32   before_script:
33     - apk update
34     - apk add make gcc musl-dev
35   script: 
36     - make advent
37   artifacts:
38     paths:
39       - advent
40   # cache outputs to reduce the build time
41   cache:
42     paths:
43       - "*.o"
44
45 manpage:
46   stage: build
47   before_script:
48     - apk update
49     - apk add make asciidoc
50   script:
51     - make advent.6
52   artifacts:
53     paths:
54       - advent.6
55
56 html:
57   stage: build
58   before_script:
59     - apk update
60     - apk add make asciidoc libxslt
61   script:
62     - make html
63   artifacts:
64     paths:
65       - "*.html"
66
67 dist:
68   stage: build
69   before_script:
70     - apk update
71     - apk add make asciidoc
72   script:
73     - export VERS=${CI_COMMIT_REF_NAME}
74     - make dist -e
75   artifacts:
76     paths:
77       - "*.tar.gz"
78
79 # run tests using the binary built before
80 test:debug:
81   stage: test
82   before_script:
83     - apk update
84     - apk add make gcc
85     - apk add lcov --update-cache --repository http://dl-3.alpinelinux.org/alpine/edge/testing/ --allow-untrusted
86   script:
87     - cd tests
88     - make
89     - cd ..
90     - lcov -t "advent" -o advent.info -c -d .
91     - genhtml -o coverage advent.info
92   artifacts:
93     paths:
94       - coverage
95   dependencies:
96     - binary:debug
97
98 test:release:
99   stage: test
100   before_script:
101     - apk update
102     - apk add make
103   script:
104     - cd tests
105     - make
106     - cd ..
107   dependencies:
108     - binary:release
109
110 pages:
111   stage: deploy
112   script:
113     - mkdir public
114     - mv coverage public
115   artifacts:
116     paths:
117       - public
118   only:
119     - master
120   dependencies:
121     - test:debug
122