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