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