.gitlab-ci.yml 5.65 KB
Newer Older
1
stages:
2 3 4
  - build     # Build in various conf, keeps the artifacts
  - test      # Use the build artifacts to run the tests
  - packaging # Publish some packages (rpm, deb…)
louiz’'s avatar
louiz’ committed
5
  - external  # Interact with some external service (coverity…)
6

louiz’'s avatar
louiz’ committed
7
before_script:
louiz’'s avatar
louiz’ committed
8 9
  - uname -a
  - whoami
louiz’'s avatar
louiz’ committed
10

11 12 13 14
variables:
  COMPILER: "g++"
  BUILD_TYPE: "Debug"
  BOTAN: "-DWITH_BOTAN=1"
louiz’'s avatar
louiz’ committed
15
  UDNS: "-DWITH_UDNS=1"
16 17
  SYSTEMD: "-DWITH_SYSTEMD=1"
  LIBIDN: "-DWITH_LIBIDN=1"
18
  SQLITE3: "-DWITH_SQLITE3=1"
19
  POSTGRESQL: "-WITH_POSTGRESQL=1"
20 21 22 23 24

#
## Build jobs
#

25
.template:basic_build: &basic_build
louiz’'s avatar
louiz’ committed
26
  stage: build
27 28
  tags:
    - docker
louiz’'s avatar
louiz’ committed
29
  script:
30
    - "echo Running cmake with the following parameters: -DCMAKE_CXX_COMPILER=${COMPILER} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} ${BOTAN} ${UDNS} ${SYSTEMD} ${LIBIDN} ${SQLITE3} ${POSTGRESQL}"
louiz’'s avatar
louiz’ committed
31 32
    - mkdir build/
    - cd build/
33
    - cmake .. -DCMAKE_CXX_COMPILER=${COMPILER} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} ${BOTAN} ${UDNS} ${SYSTEMD} ${LIBIDN} ${SQLITE3} ${POSTGRESQL}
34
    - make everything -j$(nproc || echo 1)
35 36
    - make coverage_check -j$(nproc || echo 1)
  artifacts:
louiz’'s avatar
louiz’ committed
37
    expire_in: 2 weeks
38 39 40 41 42
    paths:
      - build/

.template:fedora_build: &fedora_build
  <<: *basic_build
louiz’'s avatar
louiz’ committed
43
  image: docker.louiz.org/louiz/biboumi/test-fedora:latest
44

45 46 47 48
build:fedora:
  <<: *fedora_build

build:debian:
49
  <<: *basic_build
louiz’'s avatar
louiz’ committed
50
  image: docker.louiz.org/louiz/biboumi/test-debian:latest
51

52
build:alpine:
louiz’'s avatar
louiz’ committed
53 54 55
  variables:
    SYSTEMD: "-DWITHOUT_SYSTEMD=1"
  <<: *basic_build
louiz’'s avatar
louiz’ committed
56
  image: docker.louiz.org/louiz/biboumi/test-alpine:latest
louiz’'s avatar
louiz’ committed
57

58 59 60
build:1:
  variables:
    BOTAN: "-DWITHOUT_BOTAN=1"
61
  <<: *fedora_build
62 63 64

build:2:
  variables:
louiz’'s avatar
louiz’ committed
65
    UDNS: "-DWITHOUT_UDNS=1"
66
  <<: *fedora_build
67 68 69

build:3:
  variables:
70
    SQLITE3: "-DWITHOUT_SQLITE3=1"
71 72 73
    TEST_POSTGRES_URI: "postgres@postgres/postgres"
  services:
    - postgres:latest
74
  <<: *fedora_build
75 76 77

build:4:
  variables:
78
    SQLITE3: "-DWITHOUT_SQLITE3=1"
79
    POSTGRESQL: "-DWITHOUT_POSTGRESQL=1"
80
    BOTAN: "-DWITHOUT_BOTAN=1"
81
    LIBIDN: "-DWITHOUT_LIBIDN=1"
82
  <<: *fedora_build
83 84 85

build:5:
  variables:
louiz’'s avatar
louiz’ committed
86
    UDNS: "-DWITHOUT_UDNS=1"
87 88 89
    TEST_POSTGRES_URI: "postgres@postgres/postgres"
  services:
    - postgres:latest
90
  <<: *fedora_build
91 92 93 94

build:6:
  variables:
    BOTAN: "-DWITHOUT_BOTAN=1"
louiz’'s avatar
louiz’ committed
95
    UDNS: "-DWITHOUT_UDNS=1"
96
  <<: *fedora_build
97

98
build:without_udns:
99
  variables:
louiz’'s avatar
louiz’ committed
100
    UDNS: "-DWITHOUT_UDNS=1"
101 102
  <<: *fedora_build

103 104 105
#
## Test jobs
#
106 107 108

.template:basic_test: &basic_test
  stage: test
109 110
  tags:
    - docker
111
  script:
louiz’'s avatar
louiz’ committed
112
    - cd build/
113
    - make coverage_e2e -j$(nproc || echo 1)
114
    - make coverage
115
  artifacts:
116
    expire_in: 2 weeks
117
    paths:
118
      - build/coverage_test_suite/
119
      - build/coverage_e2e/
120
      - build/coverage_total/
121
      - build/coverage_e2e.info
louiz’'s avatar
louiz’ committed
122
    when: always
123
    name: $CI_PROJECT_NAME-test-$CI_JOB_ID
124 125

test:debian:
louiz’'s avatar
louiz’ committed
126
  image: docker.louiz.org/louiz/biboumi/test-debian:latest
127
  <<: *basic_test
128 129
  dependencies:
    - build:debian
130 131

test:fedora:
louiz’'s avatar
louiz’ committed
132
  image: docker.louiz.org/louiz/biboumi/test-fedora:latest
133
  <<: *basic_test
134 135
  dependencies:
    - build:fedora
136

137
test:without_udns:
louiz’'s avatar
louiz’ committed
138
  image: docker.louiz.org/louiz/biboumi/test-fedora:latest
139 140
  <<: *basic_test
  dependencies:
141
    - build:without_udns
142

louiz’'s avatar
louiz’ committed
143
test:alpine:
louiz’'s avatar
louiz’ committed
144
  image: docker.louiz.org/louiz/biboumi/test-alpine:latest
louiz’'s avatar
louiz’ committed
145 146 147 148
  stage: test
  tags:
    - docker
  script:
louiz’'s avatar
louiz’ committed
149
    - cd build/
louiz’'s avatar
louiz’ committed
150 151 152 153
    - make e2e
  dependencies:
    - build:alpine

louiz’'s avatar
louiz’ committed
154
test:freebsd:
155
  only:
156
    - branches@louiz/biboumi
louiz’'s avatar
louiz’ committed
157 158 159 160 161 162
  tags:
    - freebsd
  variables:
    SYSTEMD: "-DWITHOUT_SYSTEMD=1"
  stage: test
  script:
louiz’'s avatar
louiz’ committed
163 164
    - mkdir build/
    - cd build/
165
    - cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} ${BOTAN} ${UDNS} ${SYSTEMD} ${LIBIDN} ${SQLITE3}
louiz’'s avatar
louiz’ committed
166 167 168
    - make check
    - make e2e

169 170
coverity:
  stage: external
171
  only:
172
    - branches@louiz/biboumi
173 174
  tags:
    - docker
louiz’'s avatar
louiz’ committed
175
  image: docker.louiz.org/louiz/biboumi/test-fedora:latest
176 177
  allow_failure: true
  when: manual
178 179
  script:
    - export PATH=$PATH:~/coverity/bin
louiz’'s avatar
louiz’ committed
180 181
    - mkdir build/
    - cd build/
182
    - cmake .. -DWITHOUT_SYSTEMD=1
183
    - cov-build --dir cov-int   make everything -j$(nproc || echo 1)
184 185
    - tar czvf biboumi_coverity.tgz cov-int
    - curl --form token=$COVERITY_TOKEN   --form email=louiz@louiz.org   --form file=@biboumi_coverity.tgz  --form version="$(git rev-parse --short HEAD)" --form description="Automatic submission by gitlab-ci" https://scan.coverity.com/builds?project=louiz%2Fbiboumi
186
  dependencies: []
187

louiz’'s avatar
louiz’ committed
188 189 190 191
#
## Packaging jobs
#

192 193 194 195 196 197
packaging:rpm:
  stage: packaging
  only:
    - master@louiz/biboumi
  tags:
    - docker
louiz’'s avatar
louiz’ committed
198
  allow_failure: true
louiz’'s avatar
louiz’ committed
199
  image: docker.louiz.org/louiz/biboumi/test-fedora:latest
200
  script:
louiz’'s avatar
louiz’ committed
201
    - cd build/
202 203 204 205 206 207 208
    - make rpm -j$(nproc || echo 1)
  artifacts:
    paths:
      - build/rpmbuild/RPMS
      - build/rpmbuild/SRPMS
    when: always
    name: $CI_PROJECT_NAME-rpm-$CI_BUILD_ID
209 210
  dependencies:
    - build:fedora
211 212 213 214 215

packaging:deb:
  stage: packaging
  only:
    - master@louiz/biboumi
216
    - debian@louiz/biboumi
217 218
  tags:
    - docker
louiz’'s avatar
louiz’ committed
219
  allow_failure: true
220
  image: docker.louiz.org/louiz/biboumi/packaging-debian:latest
221
  before_script: []
222 223
  script:
    - git checkout debian
224
    - git pull
225 226
    - git merge --no-commit --no-ff master
    - mk-build-deps
227
    - apt update -y
228 229
    - apt install -y ./biboumi-build-deps*.deb
    - debuild -b -us -uc
230 231 232
    - mv ../*.deb .
    - mv ../*.build .
    - mv ../*.buildinfo .
233
  dependencies: []
234
  artifacts:
235
    untracked: true
236
    name: $CI_PROJECT_NAME-deb-$CI_BUILD_ID
237 238 239

packaging:archlinux:
  stage: packaging
240 241
  only:
    - master@louiz/biboumi
242 243
  tags:
    - docker
louiz’'s avatar
louiz’ committed
244
  allow_failure: true
245
  image: docker.louiz.org/louiz/biboumi/packaging-archlinux:latest
246 247
  before_script: []
  script:
248
    - sudo pacman -Syuu --noconfirm
249 250
    - git clone https://aur.archlinux.org/biboumi-git.git
    - cd biboumi-git
251
    - makepkg -si --noconfirm
252
    - test -e /usr/bin/biboumi
253
  dependencies: []