20e466b958fca76dcbd8515397b5246bfcb539cc
[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     - make coverage
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