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

louiz’'s avatar
louiz’ committed
7
before_script:
louiz’'s avatar
louiz’ committed
8
  - uname -a
9
  - locale
louiz’'s avatar
louiz’ committed
10
  - whoami
11 12
  - mkdir -p build/
  - cd build/
13 14 15 16 17
  # When we extract the artifacts from a previous build, the timestamp of all target are identicall to
  # the timestamps of the generated source files (like biboumi.h, etc), so Makefile thinks the targets
  # are not up to date, and everything is rebuilt.  We change the modification time of all these files
  # to be 15 minutes older, to avoid any unnecessary building.
  - find . \( -name \*.hpp -or -name \*.h -or -name \*.cpp \) -exec touch -r {} -d '-15 minute' {} \;
louiz’'s avatar
louiz’ committed
18

19 20 21 22
variables:
  COMPILER: "g++"
  BUILD_TYPE: "Debug"
  BOTAN: "-DWITH_BOTAN=1"
louiz’'s avatar
louiz’ committed
23
  UDNS: "-DWITH_UDNS=1"
24 25 26
  SYSTEMD: "-DWITH_SYSTEMD=1"
  LIBIDN: "-DWITH_LIBIDN=1"
  LITESQL: "-DWITH_LITESQL=1"
27 28 29 30 31

#
## Build jobs
#

32
.template:basic_build: &basic_build
louiz’'s avatar
louiz’ committed
33
  stage: build
34 35
  tags:
    - docker
louiz’'s avatar
louiz’ committed
36
  script:
louiz’'s avatar
louiz’ committed
37 38
    - "echo Running cmake with the following parameters: -DCMAKE_CXX_COMPILER=${COMPILER} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} ${BOTAN} ${UDNS} ${SYSTEMD} ${LIBIDN} ${LITESQL}"
    - cmake .. -DCMAKE_CXX_COMPILER=${COMPILER} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} ${BOTAN} ${UDNS} ${SYSTEMD} ${LIBIDN} ${LITESQL}
louiz’'s avatar
louiz’ committed
39
    - make -j$(nproc || echo 1)
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58
    - make coverage_check -j$(nproc || echo 1)
  artifacts:
    expire_in: 8 hours
    paths:
      - build/

.template:fedora_build: &fedora_build
  <<: *basic_build
  image: docker.louiz.org/biboumi-test-fedora:latest

.template:debian_build: &debian_build
  <<: *basic_build
  image: docker.louiz.org/biboumi-test-debian:latest

build:fedora:
  <<: *fedora_build

build:debian:
  <<: *debian_build
59 60 61 62

build:1:
  variables:
    BOTAN: "-DWITHOUT_BOTAN=1"
63
  <<: *fedora_build
64 65 66

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

build:3:
  variables:
    LITESQL: "-DWITHOUT_LITESQL=1"
73
  <<: *fedora_build
74 75 76 77 78

build:4:
  variables:
    LITESQL: "-DWITHOUT_LITESQL=1"
    BOTAN: "-DWITHOUT_BOTAN=1"
79
    LIBIDN: "-DWITHOUT_LIBIDN=1"
80
  <<: *fedora_build
81 82 83 84

build:5:
  variables:
    LITESQL: "-DWITHOUT_LITESQL=1"
louiz’'s avatar
louiz’ committed
85
    UDNS: "-DWITHOUT_UDNS=1"
86
  <<: *fedora_build
87 88 89 90

build:6:
  variables:
    BOTAN: "-DWITHOUT_BOTAN=1"
louiz’'s avatar
louiz’ committed
91
    UDNS: "-DWITHOUT_UDNS=1"
92
  <<: *fedora_build
93

94
build:7:
95
  variables:
louiz’'s avatar
louiz’ committed
96
    UDNS: "-DWITHOUT_UDNS=1"
97 98 99 100 101 102
  <<: *fedora_build


#
## Test jobs
#
103 104 105

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

test:debian:
121
  image: docker.louiz.org/biboumi-test-debian:latest
122
  <<: *basic_test
123 124
  dependencies:
    - build:debian
125 126

test:fedora:
127
  image: docker.louiz.org/biboumi-test-fedora:latest
128
  <<: *basic_test
129 130
  dependencies:
    - build:fedora
131

132 133 134 135
test:without_udns:
  image: docker.louiz.org/biboumi-test-fedora:latest
  <<: *basic_test
  dependencies:
136
    - build:7
137

louiz’'s avatar
louiz’ committed
138
test:freebsd:
139 140
  only:
    - master@louiz/biboumi
louiz’'s avatar
louiz’ committed
141 142 143 144 145 146
  tags:
    - freebsd
  variables:
    SYSTEMD: "-DWITHOUT_SYSTEMD=1"
  stage: test
  script:
louiz’'s avatar
louiz’ committed
147
    - cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} ${BOTAN} ${UDNS} ${SYSTEMD} ${LIBIDN} ${LITESQL}
louiz’'s avatar
louiz’ committed
148
    - make
louiz’'s avatar
louiz’ committed
149 150 151
    - make check
    - make e2e

152 153 154 155 156 157 158 159 160 161 162 163 164
#
## External jobs
#

.template:codecov: &codecov
  stage: external
  tags:
    - docker
  image: docker.louiz.org/biboumi-test-fedora:latest

.template:codecov_unittests: &codecov_unittests
  <<: *codecov
  script:
165
    - bash <(curl -s https://codecov.io/bash) -X gcov -X coveragepy -f ./coverage_test_suite.info -F $(echo $CI_JOB_NAME | sed s/:/_/g)
166 167 168 169

.template:codecov_e2e: &codecov_e2e
  <<: *codecov
  script:
170
    - bash <(curl -s https://codecov.io/bash) -X gcov -X coveragepy -f ./coverage_e2e.info -F $(echo $CI_JOB_NAME | sed s/:/_/g)
171 172 173 174 175 176

codecov:fedora:
  <<: *codecov_e2e
  dependencies:
    - test:fedora

177 178 179 180 181
codecov:without_udns:
  <<: *codecov_e2e
  dependencies:
    - test:without_udns

182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223
codecov:debian:
  <<: *codecov_e2e
  dependencies:
    - test:debian

codecov:build:1:
  <<: *codecov_unittests
  dependencies:
    - build:1

codecov:build:2:
  <<: *codecov_unittests
  dependencies:
    - build:2

codecov:build:3:
  <<: *codecov_unittests
  dependencies:
    - build:3

codecov:build:4:
  <<: *codecov_unittests
  dependencies:
    - build:4

codecov:build:5:
  <<: *codecov_unittests
  dependencies:
    - build:5

codecov:build:6:
  <<: *codecov_unittests
  dependencies:
    - build:6

codecov:build:7:
  <<: *codecov_unittests
  dependencies:
    - build:7

coverity:
  stage: external
224 225
  only:
    - master@louiz/biboumi
226 227
  tags:
    - docker
228
  image: docker.louiz.org/biboumi-test-fedora:latest
229 230
  allow_failure: true
  when: manual
231 232 233
  script:
    - export PATH=$PATH:~/coverity/bin
    - cmake .. -DWITHOUT_SYSTEMD=1
louiz’'s avatar
louiz’ committed
234
    - cov-build --dir cov-int   make -j$(nproc || echo 1)
235 236
    - 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
237
  dependencies: []
238

239 240 241 242 243 244 245 246 247 248 249 250 251 252 253
packaging:rpm:
  stage: packaging
  only:
    - master@louiz/biboumi
  tags:
    - docker
  image: docker.louiz.org/biboumi-test-fedora:latest
  script:
    - make rpm -j$(nproc || echo 1)
  artifacts:
    paths:
      - build/rpmbuild/RPMS
      - build/rpmbuild/SRPMS
    when: always
    name: $CI_PROJECT_NAME-rpm-$CI_BUILD_ID
254 255
  dependencies:
    - build:fedora
256 257 258 259 260

packaging:deb:
  stage: packaging
  only:
    - master@louiz/biboumi
261
    - debian@louiz/biboumi
262 263 264
  tags:
    - docker
  image: docker.louiz.org/packaging-debian:latest
265
  before_script: []
266 267 268 269
  script:
    - git checkout debian
    - git merge --no-commit --no-ff master
    - mk-build-deps
270
    - apt update -y
271 272
    - apt install -y ./biboumi-build-deps*.deb
    - debuild -b -us -uc
273 274 275
    - mv ../*.deb .
    - mv ../*.build .
    - mv ../*.buildinfo .
276
  dependencies: []
277
  artifacts:
278
    untracked: true
279
    name: $CI_PROJECT_NAME-deb-$CI_BUILD_ID
280 281 282 283 284 285 286 287

packaging:archlinux:
  stage: packaging
  tags:
    - docker
  image: docker.louiz.org/biboumi-test-archlinux:latest
  before_script: []
  script:
288
    - sudo pacman -Syuu --noconfirm
289 290 291 292 293 294 295 296
    - git clone https://aur.archlinux.org/litesql-git.git
    - cd litesql-git
    - makepkg --noconfirm -s && makepkg -f && sudo pacman --noconfirm -U *.pkg.*
    - cd ..
    - git clone https://aur.archlinux.org/biboumi-git.git
    - cd biboumi-git
    - makepkg --noconfirm -s && makepkg -f && sudo pacman --noconfirm -U *.pkg.*
  dependencies: []