Magic-number elimination.
[open-adventure.git] / .gitlab-ci.yml
1 image: alpine
2
3 stages:
4   - build
5   - test
6   - deploy
7
8 # build advent itself
9 binary:debug:
10   stage: build
11   before_script:
12     - apk update
13     - apk add make gcc musl-dev python3 libedit-dev
14     - pip3 install PyYAML
15   script: 
16     - make debug
17   artifacts:
18     paths:
19       - advent
20       - cheat
21       - "*.gcda"
22       - "*.gcno"
23   # cache outputs to reduce the build time
24   cache:
25     paths:
26       - "*.o"
27
28 binary:release:
29   stage: build
30   before_script:
31     - apk update
32     - apk add make gcc musl-dev python3 libedit-dev
33     - pip3 install PyYAML
34   script: 
35     - make advent cheat
36   artifacts:
37     paths:
38       - advent
39       - cheat
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 libedit-dev
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     - make coverage
90     - cd ..
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 libedit
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