-
Notifications
You must be signed in to change notification settings - Fork 196
/
.gitlab-ci.yml
222 lines (201 loc) · 6.9 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
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
178
179
180
181
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
stages:
- test
- publish
- trigger_prep
- trigger
variables:
LICENSE_HEADERS_IGNORE_FILES_REGEXP: "./ltmain.sh"
DEBIAN_FRONTEND: noninteractive
include:
- project: 'Northern.tech/Mender/mendertesting'
file: '.gitlab-ci-github-status-updates.yml'
- project: 'Northern.tech/Mender/mendertesting'
file: '.gitlab-ci-check-commits.yml'
- project: 'Northern.tech/Mender/mendertesting'
file: '.gitlab-ci-check-license.yml'
- project: 'Northern.tech/Mender/mendertesting'
file: '.gitlab-ci-check-c++.yml'
variables:
GIT_SUBMODULE_STRATEGY: recursive
test:no-tests:
stage: test
extends: .test:static-template
script:
- cmake -D BUILD_TESTS=OFF .
- make --jobs=$(nproc --all) --keep-going
tags:
- mender-qa-worker-generic
test:unit:
stage: test
image: debian:11
before_script:
- apt update && apt install -yyq g++ cmake git make lcov pkg-config liblmdb++-dev libboost-dev libboost-log-dev libssl-dev libarchive-dev libdbus-1-dev curl dbus stunnel4 tinyproxy-bin netcat
# mender-artifact install
- curl https://downloads.mender.io/mender-artifact/master/linux/mender-artifact
-o /usr/local/bin/mender-artifact
- chmod +x /usr/local/bin/mender-artifact
script:
- cmake -D COVERAGE=ON .
- make --jobs=$(nproc --all) --keep-going coverage
tags:
- mender-qa-worker-generic
artifacts:
expire_in: 2w
reports:
junit: reports/*.xml
paths:
- coverage.lcov
test:backward-compat:
stage: test
# Keep the image aligned with the oldest LTS at mender-dist-packages
image: debian:10
before_script:
- apt update && apt install -yyq ccache g++ git make lcov pkg-config liblmdb++-dev libboost-dev libboost-log-dev libboost-regex-dev libssl-dev libarchive-dev libdbus-1-dev curl dbus
# backport CMake
- echo "deb http://archive.debian.org/debian buster-backports main" > /etc/apt/sources.list.d/buster-backports_deps.list
- |
cat <<EOF> /etc/apt/preferences.d/prefer_backports.pref
Package: cmake*
Pin: release a=buster-backports
Pin-Priority: 999
EOF
- apt update && apt install -yyq --allow-unauthenticated cmake
script:
- cmake -D MENDER_DOWNLOAD_BOOST=ON .
- make --jobs=$(nproc --all) --keep-going
tags:
- mender-qa-worker-generic
.test:static-template:
stage: test
image: ubuntu:22.04
before_script:
- apt update && apt install -yyq ccache clang cmake git make pkg-config liblmdb++-dev libboost-dev libboost-log-dev libssl-dev libarchive-dev libdbus-1-dev curl dbus stunnel4 tinyproxy-bin netcat
# mender-artifact install
- apt-get install --assume-yes
apt-transport-https
ca-certificates
curl
gnupg-agent
software-properties-common
- curl -fsSL https://downloads.mender.io/repos/debian/gpg >> /etc/apt/trusted.gpg.d/mender.asc
- echo "deb [arch=$(dpkg --print-architecture)] https://downloads.mender.io/repos/debian ubuntu/jammy/experimental main"
> /etc/apt/sources.list.d/mender.list
- apt-get update
- apt install mender-artifact
- export CC=$(which clang)
- export CXX=$(which clang++)
script:
- cmake
-D CMAKE_BUILD_TYPE=${BUILD_TYPE}
${EXTRA_CMAKE_ARGS}
.
- make --jobs=$(nproc --all) --keep-going check
tags:
- mender-qa-worker-generic
test:static:asan:
variables:
BUILD_TYPE: ASan
extends: .test:static-template
test:static:threadsan:
extends: .test:static-template
variables:
BUILD_TYPE: ThreadSan
test:static:undefinedsan:
extends: .test:static-template
variables:
BUILD_TYPE: UndefSan
test:static:release:
variables:
BUILD_TYPE: Release
extends: .test:static-template
test:static:no-dbus:
variables:
EXTRA_CMAKE_ARGS: -D MENDER_USE_DBUS=OFF -D MENDER_EMBED_MENDER_AUTH=ON
extends: .test:static-template
test:modules-artifact-gen:
stage: test
image: ubuntu:22.04
before_script:
- apt update && apt install -yy $(cat support/modules-artifact-gen/tests/deb-requirements.txt)
# mender-artifact
- curl -fsSL https://downloads.mender.io/repos/debian/gpg | tee /etc/apt/trusted.gpg.d/mender.asc
- echo "deb [arch=$(dpkg --print-architecture)] https://downloads.mender.io/repos/debian ubuntu/jammy/experimental main" | tee /etc/apt/sources.list.d/mender.list
- apt update && apt install -yy mender-artifact
# Test dependencies
- pip install -r support/modules-artifact-gen/tests/requirements.txt
script:
- python3 -m pytest support/modules-artifact-gen/tests
test:docker:
image: docker
needs: []
services:
- docker:dind
stage: test
script:
- ./tests/build-docker
publish:tests:
stage: publish
image: python:3.11
dependencies:
- test:unit
before_script:
# Install dependencies
- apt update && apt install -yyq lcov
- pip install cpp-coveralls pyyaml
# eddyxu/cpp-coveralls appears dead, but there doesn't seem to be an
# alternative. Use this patch from someone who attempted to fix it. An
# alternative to this is to use pyyaml<6, but it's better to use just one
# old component than two.
- curl -f https://github.com/eddyxu/cpp-coveralls/commit/067c837c04e039e8c70aa53bceda1cded6751408.patch | patch -f /usr/local/lib/python3.11/site-packages/cpp_coveralls/__init__.py
# Set "TRAVIS_*" variables based on GitLab ones
- export TRAVIS_BRANCH=$CI_COMMIT_BRANCH
- export TRAVIS_JOB_ID=$CI_PIPELINE_ID
script:
- 'echo "service_name: gitlab-ci" > .coveralls.yml'
- cpp-coveralls
--repo-token ${COVERALLS_TOKEN}
--no-gcov
--lcov-file coverage.lcov
generate-qa-trigger:
image: python:alpine
stage: trigger_prep
rules:
- if: '$CI_COMMIT_BRANCH =~ /^(master|[0-9]+\.[0-9]+\.x)$/'
- if: '$CI_PIPELINE_SOURCE == "pipeline"'
when: never
- if: '$CI_PIPELINE_SOURCE == "schedule"'
when: never
before_script:
- apk add --no-cache git
- pip3 install pyyaml
- wget -q https://raw.githubusercontent.com/mendersoftware/mender-qa/master/scripts/generate_client_publish_job.py
script:
- python generate_client_publish_job.py --trigger ${CI_PROJECT_NAME} --version ${CI_COMMIT_REF_NAME} --filename gitlab-ci-client-qemu-publish-job.yml
artifacts:
paths:
- gitlab-ci-client-qemu-publish-job.yml
trigger:mender-qa:
stage: trigger
rules:
- if: '$CI_COMMIT_BRANCH =~ /^(master|[0-9]+\.[0-9]+\.x)$/'
# the following is to prevent an endless loop of qa pipelines caused by downstream pipelines
- if: '$CI_PIPELINE_SOURCE == "pipeline"'
when: never
- if: '$CI_PIPELINE_SOURCE == "schedule"'
when: never
trigger:
include:
- artifact: gitlab-ci-client-qemu-publish-job.yml
job: generate-qa-trigger
trigger:integration:
stage: trigger
inherit:
variables: false
rules:
- if: '$CI_COMMIT_BRANCH == "master"'
- if: '$CI_PIPELINE_SOURCE == "schedule"'
when: never
trigger:
project: Northern.tech/Mender/integration
branch: master
strategy: depend