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