-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy path.gitlab-ci.yml
155 lines (138 loc) · 4.44 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
include:
- project: 'Northern.tech/Mender/mendertesting'
file:
- '.gitlab-ci-check-commits.yml'
- '.gitlab-ci-github-status-updates.yml'
stages:
- test
- publish
.test:static:
stage: test
image: ubuntu:24.04
needs: []
before_script:
- apt-get update && apt-get install -y git clang-format pcregrep
test:static:license:
extends: .test:static
script:
- ./.github/workflows/check_headers.sh
test:static:code:
extends: .test:static
script:
- ./.github/workflows/check_include_guards.sh
- ./.github/workflows/check_equivalence_tests.sh
- ./.github/workflows/check_code_format.sh
- ./.github/workflows/check_allocations.sh
test:smoke-build:posix:
stage: test
image: debian:12-slim
needs: []
before_script:
- apt-get update && apt-get install -yqq
cmake git make pkg-config python3
libcurl4-openssl-dev libcjson-dev
script:
- cmake -C cmake/CMake_posix_defaults.txt -B build tests/smoke
- cmake --build build --parallel $(nproc --all)
- ./build/mender-mcu-client.elf --help
test:smoke-build:weak:
stage: test
image: debian:12-slim
needs: []
before_script:
- apt-get update && apt-get install -yqq
cmake git make pkg-config python3
libcjson-dev
script:
- cmake -C cmake/CMake_weak_defaults.txt -B build tests/smoke
- cmake --build build --parallel $(nproc --all)
- ./build/mender-mcu-client.elf --help
.test:mender-artifact:template:
variables:
DEBIAN_RELEASE: bookworm
MENDER_ARTIFACT_VERSION: 3.11.2
test:unit:
extends: .test:mender-artifact:template
stage: test
image: debian:12-slim
before_script:
- apt update && apt install -yyq
cmake git make pkg-config python3
libcurl4-openssl-dev libcjson-dev
g++ lcov wget
# Fetch and install mender-artifact
- wget "https://downloads.mender.io/repos/debian/pool/main/m/mender-artifact/mender-artifact_${MENDER_ARTIFACT_VERSION}-1+debian+${DEBIAN_RELEASE}_amd64.deb"
-O mender-artifact.deb &&
dpkg --install mender-artifact.deb
script:
- cmake -D COVERAGE=ON tests/unit/
- make --jobs=$(nproc --all) --keep-going coverage
tags:
- hetzner-amd-beefy
artifacts:
expire_in: 2w
reports:
junit: /tests/unit/reports/*.xml
paths:
- coverage.lcov
.test:static:template:
extends: .test:mender-artifact:template
stage: test
image: ubuntu:24.04
before_script:
- apt update && apt install -yyq
cmake git make pkg-config python3
libcurl4-openssl-dev libcjson-dev
clang wget
# Fetch and install mender-artifact
- wget "https://downloads.mender.io/repos/debian/pool/main/m/mender-artifact/mender-artifact_${MENDER_ARTIFACT_VERSION}-1+debian+${DEBIAN_RELEASE}_amd64.deb"
-O mender-artifact.deb &&
dpkg --install mender-artifact.deb
- export CC=$(which clang)
- export CXX=$(which clang++)
script:
- cmake -D CMAKE_BUILD_TYPE=${BUILD_TYPE} tests/unit
- make --jobs=$(nproc --all) --keep-going check
tags:
# QA-866: Ubuntu 24.04 image cannot properly run on our private runners.
# Temporarily setting it to GitLab Hosted runners
- saas-linux-medium-amd64
test:static:asan:
extends: .test:static:template
variables:
BUILD_TYPE: ASan
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:
extends: .test:static:template
variables:
BUILD_TYPE: Release
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