-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy path.gitlab-ci.yml
240 lines (208 loc) · 5.65 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
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
stages:
- style_check
- build
- lint
- integration_test
- deploy
# Job description helpers
.in_ubuntu:
image: ubuntu:latest
variables:
DEBIAN_FRONTEND: 'noninteractive'
.with_ubuntu_builddeps:
before_script:
- apt-get update && apt-get -y install gcc g++ git ninja-build cmake catch2 pkg-config
.with_ubuntu_testdeps:
before_script:
- apt-get update && apt-get -y install build-essential qemu-system-x86 grub2-common grub-pc-bin grub-efi-amd64-bin mtools ovmf xorriso python3 python3-pexpect netcat
.in_latest_fedora:
# See #242.
image: fedora:37
.with_fedora_builddeps:
before_script:
- dnf -y update && dnf -y install clang gcc gcc-c++ cmake catch-devel libasan libasan-static libubsan libubsan-static ninja-build
.with_fedora_testdeps:
before_script:
- dnf -y update && dnf -y install libasan libubsan qemu-system-x86 edk2-ovmf grub2-tools grub2-tools-extra grub2-pc-modules grub2-efi-x64-modules unifont-fonts mtools xorriso python3 python3-pexpect netcat
# The stock installation of the tools fails with errors about this font
- grub2-mkfont -o /usr/share/grub/unicode.pf2 /usr/share/fonts/unifont/unifont.ttf
.only_for_releases:
only:
- tags
- /^[\d-]+-release$/
artifacts:
expire_in: 5 year
.except_for_releases:
except:
- tags
- /^[\d-]+-release$/
artifacts:
expire_in: 1 week
.build_variant_with_ninja:
stage: build
script:
- cmake -B build -S . -G Ninja -DCMAKE_BUILD_TYPE=$BUILD_TYPE
- ninja -C build
- ninja -C build test
artifacts:
expire_in: 1 week
paths:
- build/src/hypervisor
- build/src/hypervisor.elf32
.build_variant_with_make:
stage: build
script:
- cmake -B build -S . -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=$BUILD_TYPE
- make -C build
- make -C build test
artifacts:
expire_in: 1 week
paths:
- build/src/hypervisor
- build/src/hypervisor.elf32
.build_release:
variables:
BUILD_TYPE: 'Release'
extends:
- .build_variant_with_ninja
.build_debug:
variables:
BUILD_TYPE: 'Debug'
extends:
- .build_variant_with_ninja
.integration_test_variant:
tags:
- kvm
stage: integration_test
script:
- ./test/integration/qemu-boot build/src/hypervisor.elf32
- ./tools/gen_usb.sh grub_image.iso build/src/hypervisor.elf32 tools/grub.cfg.tmpl
# On Fedora, the default memory size leads to a memory map that is
# too fragmented for Grub to find enough contiguous memory.
#
# See #218 for the issue that is workarounded and #219 for a
# longer term solution.
- ./test/integration/qemu-boot grub_image.iso --memory 3192 --disk-image
- ./test/integration/qemu-boot grub_image.iso --memory 3192 --disk-image --uefi
# Stylecheck Job description
style_check:clang-format:
stage: style_check
tags:
- native-nix-v2
script:
- nix-build nix/release.nix -A hedron.stylecheck
# Build Job descriptions
build:fedora-release:
extends:
- .in_latest_fedora
- .with_fedora_builddeps
- .build_release
- .except_for_releases
build:fedora-debug:
extends:
- .in_latest_fedora
- .with_fedora_builddeps
- .build_debug
- .except_for_releases
build:fedora-clang:
variables:
CXX: 'clang++'
CC: 'clang'
extends:
- .in_latest_fedora
- .with_fedora_builddeps
- .build_debug
- .except_for_releases
build:ubuntu:
extends:
- .in_ubuntu
- .with_ubuntu_builddeps
- .build_release
- .except_for_releases
build:ubuntu-make:
stage: build
variables:
BUILD_TYPE: 'Debug'
extends:
- .in_ubuntu
- .with_ubuntu_builddeps
- .build_variant_with_make
- .except_for_releases
# Lint Job Description
lint:clang-tidy:
needs: []
stage: lint
tags:
- native-nix-v2
script:
- nix-build nix/release.nix -A hedron.clang-tidy
# Integration Test Decriptions
integration_test:fedora-release:
dependencies:
- build:fedora-release
extends:
- .in_latest_fedora
- .with_fedora_testdeps
- .integration_test_variant
- .except_for_releases
integration_test:fedora-debug:
dependencies:
- build:fedora-debug
extends:
- .in_latest_fedora
- .with_fedora_testdeps
- .integration_test_variant
- .except_for_releases
integration_test:fedora-clang:
dependencies:
- build:fedora-clang
extends:
- .in_latest_fedora
- .with_fedora_testdeps
- .integration_test_variant
- .except_for_releases
integration_test:ubuntu:
dependencies:
- build:ubuntu
extends:
- .in_ubuntu
- .with_ubuntu_testdeps
- .integration_test_variant
- .except_for_releases
# This target builds and executes all of the above and more on NixOS,
# so we put it in the integration test phase.
integration_test:nixos:
stage: integration_test
needs: []
tags:
- native-nix-v2
script:
- mkdir -p output
# Workaround Gitlab CI not archiving across symlinks
- mkdir -p output/compilers/
- cp -r $(nix-build --no-out-link nix/release.nix -A hedron.builds) output/compilers/
- mkdir -p output/integration-test/
# We limit integration test builds to low concurrency to avoid
# overloading the build box and timing out.
- cp -r $(nix-build -j1 --no-out-link nix/release.nix -A hedron.integration-test) output/integration-test/
- mkdir -p output/coverage/
- cp -r $(nix-build --no-out-link nix/release.nix -A hedron.coverage) output/coverage/
artifacts:
expire_in: 1 week
paths:
- output/
# Deployments
pages:
stage: deploy
script:
- mkdir -p public/
- nix-build ./nix/release.nix -A hedron.docs
- cp -R result/* public/
artifacts:
paths:
- public
tags:
- native-nix-v2
only:
- master
needs: []