forked from mendersoftware/mender
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
160 lines (148 loc) · 4.92 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
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-check-golang-lint.yml'
- 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'
test:unit:
stage: test
image: golang:1.17
before_script:
- apt-get update && apt-get install -yyq liblzma-dev libssl-dev libglib2.0-dev dbus clang-format-9
- GO111MODULE=off go get -u github.com/jstemmer/go-junit-report
script:
- git ls-tree -r --name-only HEAD | grep -v vendor/ | grep '\.[ch]$' | xargs clang-format-9 -i
- make coverage
- make
- mkdir -p tests/unit-coverage && find . -name 'coverage.txt' -exec cp --parents {} ./tests/unit-coverage \;
- tar -cvf $CI_PROJECT_DIR/unit-coverage.tar tests/unit-coverage
tags:
- mender-qa-worker-generic
artifacts:
expire_in: 2w
reports:
junit: report.xml
paths:
- unit-coverage.tar
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:20.10.21-dind
stage: test
script:
- ./tests/build-docker
publish:tests:
stage: publish
image: golang:1.17-alpine3.14
dependencies:
- test:unit
before_script:
# Install dependencies
- apk add --no-cache git
- GO111MODULE=off go get -u github.com/mattn/goveralls
# Coveralls env variables:
# According to https://docs.coveralls.io/supported-ci-services
# we should set CI_NAME, CI_BUILD_NUMBER, etc. But according
# to goveralls source code (https://github.com/mattn/goveralls)
# many of these are not supported. Set CI_BRANCH,
# and pass few others as command line arguments.
# See also https://docs.coveralls.io/api-reference
- export CI_BRANCH=${CI_COMMIT_BRANCH}
script:
- tar -xvf unit-coverage.tar
- goveralls
-repotoken ${COVERALLS_TOKEN}
-service gitlab-ci
-jobid $CI_PIPELINE_ID
-covermode set
-flagname unittests
-parallel
-coverprofile $(find tests/unit-coverage -name 'coverage.txt' | tr '\n' ',' | sed 's/,$//')
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:mender-docs-site:
stage: trigger
inherit:
variables: false
rules:
- if: '$CI_COMMIT_BRANCH =~ /^(master|[0-9]+\.[0-9]+\.x)$/'
changes:
- Documentation/*
- if: '$CI_PIPELINE_SOURCE == "schedule"'
when: never
trigger:mender-docs-site:master:
extends: .trigger:mender-docs-site
trigger:
project: Northern.tech/Mender/mender-docs-site
branch: master
trigger:mender-docs-site:production:
extends: .trigger:mender-docs-site
trigger:
project: Northern.tech/Mender/mender-docs-site
branch: production
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