forked from Nitrokey/nitrokey-3-firmware
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path.gitlab-ci.yml
217 lines (202 loc) · 7.4 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
include:
- project: 'nitrokey/gitlab-ci'
file:
- 'common-jobs/common_jobs.yml'
stages:
- pull-github
- build
- test
- deploy
variables:
GIT_STRATEGY: clone
GIT_DEPTH: 0
GIT_SUBMODULE_STRATEGY: recursive
SCRIPTS_REPO: git@git.nitrokey.com:nitrokey/gitlab-ci.git
REPO_GROUP: nitrokey
REPO_NAME: nitrokey-3-firmware
MAIN_BRANCH: main
IMAGE_NAME: nitrokey3
COMMON_UPDATE_DOCKER: "false"
COMMON_UPLOAD_FILES: "false"
COMMON_UPLOAD_NIGHTLY: "false"
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 || true
- git archive --format zip --output artifacts/nitrokey-3-firmware.zip --prefix nitrokey-3-firmware/ HEAD
- !reference [notify_github, script] # use notify_github from include
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
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
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
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
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
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
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-lpc55.bin
- make -C runners/embedded build-nk3xn FEATURES=test
- cp runners/embedded/artifacts/runner-lpc55-nk3xn.bin artifacts/firmware-test-lpc55.bin
- make -C runners/embedded build-nk3xn FEATURES=provisioner,no-buttons
- cp runners/embedded/artifacts/runner-lpc55-nk3xn.bin artifacts/provisioner-lpc55.bin
- make -C runners/embedded build-nk3am.bl FEATURES=no-buttons
- cp runners/embedded/artifacts/runner-nrf52-bootloader-nk3am.bin.ihex artifacts/firmware-nrf52.hex
- make -C runners/embedded build-nk3am.bl FEATURES=test
- cp runners/embedded/artifacts/runner-nrf52-bootloader-nk3am.bin.ihex artifacts/firmware-test-nrf52.hex
- make -C runners/embedded build-nk3am.bl FEATURES=provisioner,no-buttons
- cp runners/embedded/artifacts/runner-nrf52-bootloader-nk3am.bin.ihex artifacts/provisioner-nrf52.hex
artifacts:
paths:
- artifacts
###############################################################################
# test stage
software-tests:
image: registry.git.nitrokey.com/nitrokey/nitrokey-3-firmware/nitrokey3:latest
rules:
- if: '$CI_PIPELINE_SOURCE == "push"'
tags:
- docker
stage: test
script:
- cd components/apps && cargo test
hardware-tests:
rules:
- if: '$CI_PIPELINE_SOURCE == "push"'
tags:
- nk3-hw
parallel:
matrix:
- MODEL: [ nrf52, lpc55 ]
stage: test
script:
- git clone https://gitlab-ci-token:${CI_JOB_TOKEN}@git.nitrokey.com/nitrokey/nitrokey-hardware-test.git --recursive
- git -C nitrokey-hardware-test checkout v1.1
- make -C nitrokey-hardware-test ci FW=../artifacts MODEL=$MODEL TESTS=pynitrokey,nk3test
- cp nitrokey-hardware-test/artifacts/Nitrokey3TestSuite/report-junit.xml nitrokey-hardware-test/artifacts/report-junit.xml
dependencies:
- build-firmware-for-tests
needs:
- build-firmware-for-tests
artifacts:
when: always
paths:
- nitrokey-hardware-test/artifacts
reports:
junit: nitrokey-hardware-test/artifacts/report-junit.xml