forked from Nitrokey/nitrokey-3-firmware
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
224 lines (209 loc) · 8.45 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
223
include:
- project: 'nitrokey/gitlab-ci'
file:
- 'common-jobs/common_jobs.yml'
stages:
- pull-github
- build
- test
- deploy
variables:
#Repo for shared scripts (pull.sh release.sh, nightly_upload.sh):
GIT_STRATEGY: clone #This seems to have no effect also set in webinterface
GIT_DEPTH: 0 #This seems to have no effect also set in webinterface
GIT_SUBMODULE_STRATEGY: recursive #This seems to have no effect also set in webinterfac
SCRIPTS_REPO: [email protected]:nitrokey/gitlab-ci.git
REPO_GROUP: nitrokey
REPO_NAME: nitrokey-3-firmware
MAIN_BRANCH: main
IMAGE_NAME: nitrokey3
COMMON_UPDATE_DOCKER: "true"
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
LC_ALL: C.UTF-8
LANG: C.UTF-8
metadata:
image: registry.git.nitrokey.com/nitrokey/nitrokey-3-firmware/nitrokey3:latest
rules:
- if: '$CI_PIPELINE_SOURCE == "push"'
- if: '$CI_PIPELINE_SOURCE == "web"'
tags:
- docker
stage: build
script:
- make commands.bd
- make license.txt
- make manifest.json
after_script:
- mkdir -p artifacts
- cp commands.bd license.txt manifest.json artifacts
- git archive --format zip --output artifacts/nitrokey-3-firmware.zip --prefix nitrokey-3-firmware/ HEAD
- wget $icon_server/checkmark/$CI_COMMIT_REF_NAME/$CI_COMMIT_SHA/$CI_JOB_NAME/$CI_JOB_STATUS/${CI_JOB_URL#*/*/*/}
artifacts:
paths:
- artifacts
check-firmware:
image: registry.git.nitrokey.com/nitrokey/nitrokey-3-firmware/nitrokey3:latest
rules:
- if: '$CI_PIPELINE_SOURCE == "push"'
tags:
- docker
stage: build
script:
- make -C runners/embedded check-all
- make -C runners/embedded check-all FEATURES=provisioner
- make -C runners/embedded check-all FEATURES=test
after_script:
- wget $icon_server/checkmark/$CI_COMMIT_REF_NAME/$CI_COMMIT_SHA/$CI_JOB_NAME/$CI_JOB_STATUS/${CI_JOB_URL#*/*/*/}
check-usbip:
image: registry.git.nitrokey.com/nitrokey/nitrokey-3-firmware/nitrokey3:latest
rules:
- if: '$CI_PIPELINE_SOURCE == "push"'
tags:
- docker
stage: build
script:
- cargo check --manifest-path runners/usbip/Cargo.toml
- cargo check --manifest-path runners/usbip/Cargo.toml --features provisioner
- cargo check --manifest-path runners/usbip/Cargo.toml --features test
after_script:
- wget $icon_server/checkmark/$CI_COMMIT_REF_NAME/$CI_COMMIT_SHA/$CI_JOB_NAME/$CI_JOB_STATUS/${CI_JOB_URL#*/*/*/}
test:
image: registry.git.nitrokey.com/nitrokey/nitrokey-3-firmware/nitrokey3:latest
rules:
- if: '$CI_PIPELINE_SOURCE == "push"'
tags:
- docker
stage: build
script:
- cd components/apps && cargo test
after_script:
- wget $icon_server/checkmark/$CI_COMMIT_REF_NAME/$CI_COMMIT_SHA/$CI_JOB_NAME/$CI_JOB_STATUS/${CI_JOB_URL#*/*/*/}
lint:
image: registry.git.nitrokey.com/nitrokey/nitrokey-3-firmware/nitrokey3:latest
rules:
- if: '$CI_PIPELINE_SOURCE == "push"'
- if: '$CI_PIPELINE_SOURCE == "schedule"'
tags:
- docker
stage: build
script:
- make lint
after_script:
- wget $icon_server/checkmark/$CI_COMMIT_REF_NAME/$CI_COMMIT_SHA/$CI_JOB_NAME/$CI_JOB_STATUS/${CI_JOB_URL#*/*/*/}
build-nightly:
image: registry.git.nitrokey.com/nitrokey/nitrokey-3-firmware/nitrokey3:latest
rules:
- if: '$CI_PIPELINE_SOURCE == "schedule"'
tags:
- docker
stage: build
parallel:
matrix:
- RUSTUP_TOOLCHAIN: [stable, nightly]
script:
- cargo --version
- rustup target add thumbv7em-none-eabihf thumbv8m.main-none-eabi
- make -C runners/embedded build-nk3am.bl
- make -C runners/embedded build-nk3am.bl FEATURES=test
- make -C runners/embedded build-nk3am.bl FEATURES=provisioner
- make -C runners/embedded build-nk3xn
- make -C runners/embedded build-nk3xn FEATURES=test
- make -C runners/embedded build-nk3xn FEATURES=provisioner
- cargo build --release --manifest-path runners/usbip/Cargo.toml
- cargo build --release --manifest-path runners/usbip/Cargo.toml --features test
- cargo build --release --manifest-path runners/usbip/Cargo.toml --features provisioner
after_script:
- wget $icon_server/checkmark/$CI_COMMIT_REF_NAME/$CI_COMMIT_SHA/$CI_JOB_NAME/$CI_JOB_STATUS/${CI_JOB_URL#*/*/*/}
build-firmware:
image: registry.git.nitrokey.com/nitrokey/nitrokey-3-firmware/nitrokey3:latest
rules:
- if: '$CI_PIPELINE_SOURCE == "web"'
tags:
- docker
stage: build
script:
- git describe --exact-match
- export VERSION=`git describe --exact-match`
- if echo $VERSION | grep test ; then export FEATURES=test ; fi
- mkdir -p artifacts
- make -C runners/embedded build-nk3am.bl
- cp runners/embedded/artifacts/runner-nrf52-bootloader-nk3am.bin.ihex artifacts/firmware-nk3am-nrf52-$VERSION.ihex
- make -C runners/embedded build-nk3am.bl FEATURES=provisioner
- cp runners/embedded/artifacts/runner-nrf52-bootloader-nk3am.bin.ihex artifacts/provisioner-nk3am-nrf52-$VERSION.ihex
- make -C runners/embedded build-nk3xn
- cp runners/embedded/artifacts/runner-lpc55-nk3xn.bin artifacts/firmware-nk3xn-lpc55-$VERSION.bin
- make -C runners/embedded build-nk3xn FEATURES=provisioner
- cp runners/embedded/artifacts/runner-lpc55-nk3xn.bin artifacts/provisioner-nk3xn-lpc55-$VERSION.bin
after_script:
- wget $icon_server/checkmark/$CI_COMMIT_REF_NAME/$CI_COMMIT_SHA/$CI_JOB_NAME/$CI_JOB_STATUS/${CI_JOB_URL#*/*/*/}
artifacts:
paths:
- artifacts
build-usbip:
image: registry.git.nitrokey.com/nitrokey/nitrokey-3-firmware/nitrokey3:latest
rules:
- if: '$CI_PIPELINE_SOURCE == "web"'
tags:
- docker
stage: build
script:
- git describe --exact-match
- export VERSION=`git describe --exact-match`
- if echo $VERSION | grep test ; then export FEATURES=test ; fi
- mkdir -p artifacts
- cargo build --release --manifest-path runners/usbip/Cargo.toml --features $FEATURES,
- cp target/release/usbip-runner artifacts/usbip-runner-$VERSION
- cargo build --release --manifest-path runners/usbip/Cargo.toml --features provisioner
- cp target/release/usbip-runner artifacts/usbip-provisioner-$VERSION
after_script:
- wget $icon_server/checkmark/$CI_COMMIT_REF_NAME/$CI_COMMIT_SHA/$CI_JOB_NAME/$CI_JOB_STATUS/${CI_JOB_URL#*/*/*/}
artifacts:
paths:
- artifacts
# This is a copy of build-firmware, but without the strict tag check guard and NK3AM build temporarily removed
# FIXME Either this or build-firmware should be removed
build-firmware-for-tests:
image: registry.git.nitrokey.com/nitrokey/nitrokey-3-firmware/nitrokey3:latest
rules:
- if: '$CI_PIPELINE_SOURCE == "push"'
tags:
- docker
stage: build
script:
- git describe
- export VERSION=`git describe`
- mkdir -p artifacts
- make -C runners/embedded build-nk3xn FEATURES=no-buttons
- cp runners/embedded/artifacts/runner-lpc55-nk3xn.bin artifacts/firmware-nk3xn-lpc55-$VERSION.bin
- make -C runners/embedded build-nk3xn FEATURES=provisioner,no-buttons
- cp runners/embedded/artifacts/runner-lpc55-nk3xn.bin artifacts/provisioner-nk3xn-lpc55-$VERSION.bin
after_script:
- wget $icon_server/checkmark/$CI_COMMIT_REF_NAME/$CI_COMMIT_SHA/$CI_JOB_NAME/$CI_JOB_STATUS/${CI_JOB_URL#*/*/*/}
artifacts:
paths:
- artifacts
# This is a hardware test job for the Nitrokey 3
hardware-tests:
rules:
- if: '$CI_PIPELINE_SOURCE == "push"'
tags:
- nk3-hw
stage: test
script:
- git config --global --add url."https://gitlab-ci-token:${CI_JOB_TOKEN}@git.nitrokey.com/".insteadOf "[email protected]:"
- git config --global --add url."https://gitlab-ci-token:${CI_JOB_TOKEN}@git.nitrokey.com/".insteadOf "https://git.nitrokey.com/"
- git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@git.nitrokey.com/nitrokey/nitrokey-hardware-test.git --recursive
- cd nitrokey-hardware-test && make ci FW=../artifacts && cd .. # use built firmware files
- cp nitrokey-hardware-test/artifacts/Nitrokey3TestSuite/report-junit.xml nitrokey-hardware-test/artifacts/report-junit.xml # the result will be merged in the future
after_script:
- curl $icon_server/checkmark/$CI_COMMIT_REF_NAME/$CI_COMMIT_SHA/$CI_JOB_NAME/$CI_JOB_STATUS/${CI_JOB_URL#*/*/*/}
dependencies:
- build-firmware-for-tests # needs artifacts from this job only to run, don't send anything else
needs:
- build-firmware-for-tests # can start immediately after this job succeeds
artifacts:
when: always
paths:
- nitrokey-hardware-test/artifacts
reports:
junit: nitrokey-hardware-test/artifacts/report-junit.xml