.gitlab-ci.yml 4.76 KB
Newer Older
1 2 3 4 5
stages:
  - build
  - test
  - packaging

louiz’'s avatar
louiz’ committed
6
before_script:
louiz’'s avatar
louiz’ committed
7
  - uname -a
8
  - locale
louiz’'s avatar
louiz’ committed
9
  - whoami
10 11
  - rm -rf build/
  - mkdir build/
12
  - cd build
louiz’'s avatar
louiz’ committed
13

14 15 16 17
variables:
  COMPILER: "g++"
  BUILD_TYPE: "Debug"
  BOTAN: "-DWITH_BOTAN=1"
louiz’'s avatar
louiz’ committed
18
  UDNS: "-DWITH_UDNS=1"
19 20 21 22
  SYSTEMD: "-DWITH_SYSTEMD=1"
  LIBIDN: "-DWITH_LIBIDN=1"
  LITESQL: "-DWITH_LITESQL=1"
.template:basic_build: &basic_build
louiz’'s avatar
louiz’ committed
23
  stage: build
24 25
  tags:
    - docker
26
  image: docker.louiz.org/biboumi-test-fedora:latest
louiz’'s avatar
louiz’ committed
27
  script:
louiz’'s avatar
louiz’ committed
28 29
    - "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
30 31
    - make biboumi -j$(nproc || echo 1)
    - make check -j$(nproc || echo 1)
32 33 34 35 36 37 38 39

build:1:
  variables:
    BOTAN: "-DWITHOUT_BOTAN=1"
  <<: *basic_build

build:2:
  variables:
louiz’'s avatar
louiz’ committed
40
    UDNS: "-DWITHOUT_UDNS=1"
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
  <<: *basic_build

build:3:
  variables:
    LITESQL: "-DWITHOUT_LITESQL=1"
  <<: *basic_build

build:4:
  variables:
    LITESQL: "-DWITHOUT_LITESQL=1"
    BOTAN: "-DWITHOUT_BOTAN=1"
  <<: *basic_build

build:5:
  variables:
    LITESQL: "-DWITHOUT_LITESQL=1"
louiz’'s avatar
louiz’ committed
57
    UDNS: "-DWITHOUT_UDNS=1"
58 59 60 61 62
  <<: *basic_build

build:6:
  variables:
    BOTAN: "-DWITHOUT_BOTAN=1"
louiz’'s avatar
louiz’ committed
63
    UDNS: "-DWITHOUT_UDNS=1"
64 65 66 67 68
  <<: *basic_build

build:6:
  variables:
    LIBIDN: "-DWITHOUT_LIBIDN=1"
louiz’'s avatar
louiz’ committed
69
    UDNS: "-DWITHOUT_UDNS=1"
70 71 72 73
  <<: *basic_build

.template:basic_test: &basic_test
  stage: test
74 75
  tags:
    - docker
76
  script:
louiz’'s avatar
louiz’ committed
77
    - cmake .. -DCMAKE_CXX_COMPILER=${COMPILER} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} ${BOTAN} ${UDNS} ${SYSTEMD} ${LIBIDN} ${LITESQL}
louiz’'s avatar
louiz’ committed
78
    - make biboumi -j$(nproc || echo 1)
79 80
    - make coverage_check -j$(nproc || echo 1)
    - make coverage_e2e -j$(nproc || echo 1)
81
    - make coverage
82 83
    - bash <(curl -s https://codecov.io/bash) -X gcov -X coveragepy -f ./coverage_e2e.info -F integration
    - bash <(curl -s https://codecov.io/bash) -X gcov -X coveragepy -f ./coverage_test_suite.info -F unittests
84 85
  artifacts:
    paths:
86
      - build/coverage_test_suite/
87
      - build/coverage_e2e/
88
      - build/coverage_total/
louiz’'s avatar
louiz’ committed
89
    when: always
louiz’'s avatar
louiz’ committed
90
    name: $CI_PROJECT_NAME-test-$CI_BUILD_ID
91 92

test:debian:
93
  image: docker.louiz.org/biboumi-test-debian:latest
94 95 96
  <<: *basic_test

test:fedora:
97
  image: docker.louiz.org/biboumi-test-fedora:latest
98 99
  <<: *basic_test

louiz’'s avatar
louiz’ committed
100
test:freebsd:
101 102
  only:
    - master@louiz/biboumi
louiz’'s avatar
louiz’ committed
103 104 105 106 107 108
  tags:
    - freebsd
  variables:
    SYSTEMD: "-DWITHOUT_SYSTEMD=1"
  stage: test
  script:
louiz’'s avatar
louiz’ committed
109
    - cmake .. -DCMAKE_BUILD_TYPE=${BUILD_TYPE} ${BOTAN} ${UDNS} ${SYSTEMD} ${LIBIDN} ${LITESQL}
louiz’'s avatar
louiz’ committed
110 111 112 113
    - make biboumi
    - make check
    - make e2e

114 115
test:coverity:
  stage: test
116 117
  only:
    - master@louiz/biboumi
118 119
  tags:
    - docker
120
  image: docker.louiz.org/biboumi-test-fedora:latest
121 122
  allow_failure: true
  when: manual
123 124 125
  script:
    - export PATH=$PATH:~/coverity/bin
    - cmake .. -DWITHOUT_SYSTEMD=1
louiz’'s avatar
louiz’ committed
126
    - cov-build --dir cov-int   make biboumi test_suite -j$(nproc || echo 1)
127 128
    - 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
129 130 131

test:sonar-qube:
  stage: test
132 133
  only:
    - master@louiz/biboumi
134 135
  tags:
    - docker
136
  image: docker.louiz.org/biboumi-test-fedora:latest
137
  allow_failure: true
138 139 140
  script:
    - cmake ..
    - ~/sonar-scanner/bin/build-wrapper-linux-x86/build-wrapper-linux-x86-64 --out-dir ./bw-outputs make biboumi test_suite
louiz’'s avatar
louiz’ committed
141
    - cd ..
louiz’'s avatar
louiz’ committed
142
    - ~/sonar-scanner/bin/sonar-scanner -Dsonar.host.url=https://sonarqube.com -Dsonar.login=$SONAR_LOGIN -Dsonar.language=cpp -Dsonar.cfamily.build-wrapper-output=build/bw-outputs -Dsonar.sourceEncoding=UTF-8 -Dsonar.sources=src/,louloulibs/,tests/ -Dsonar.projectKey=biboumi -Dsonar.projectName=Biboumi -Dsonar.projectVersion=3.0
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177

packaging:rpm:
  stage: packaging
  only:
    - master@louiz/biboumi
  tags:
    - docker
  image: docker.louiz.org/biboumi-test-fedora:latest
  script:
    - cmake .. -DCMAKE_CXX_COMPILER=${COMPILER} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} ${BOTAN} ${UDNS} ${SYSTEMD} ${LIBIDN} ${LITESQL}
    - make rpm -j$(nproc || echo 1)
  artifacts:
    paths:
      - build/rpmbuild/RPMS
      - build/rpmbuild/SRPMS
    when: always
    name: $CI_PROJECT_NAME-rpm-$CI_BUILD_ID

packaging:deb:
  stage: packaging
  only:
    - master@louiz/biboumi
  tags:
    - docker
  image: docker.louiz.org/packaging-debian:latest
  script:
    - git checkout debian
    - git merge --no-commit --no-ff master
    - mk-build-deps
    - apt install -y ./biboumi-build-deps*.deb
    - debuild -b -us -uc
  artifacts:
    untracked: true
    when: always
    name: $CI_PROJECT_NAME-deb-$CI_BUILD_ID