-
Notifications
You must be signed in to change notification settings - Fork 11
519 lines (438 loc) · 17.4 KB
/
nightly.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
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
# This is a basic workflow to help you get started with Actions
name: Nightly builds
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch and riscv
on:
workflow_dispatch:
schedule: # Run at midnight, every day
- cron: '30 0 * * *'
jobs:
build:
runs-on: ubuntu-22.04
needs: build-toolchains
steps:
- uses: actions/checkout@v2
with:
submodules: "recursive"
- uses: actions/setup-python@v2
with:
python-version: '3.11.0' # Require the same version of python as Onyx builds, in order to ease the build
- name: Download the x86_64-onyx-linux toolchain
uses: actions/download-artifact@v4
with:
# Artifact name
name: x86_64-onyx-linux
- name: Extract Toolchain
run: |
zstd -d x86_64-onyx-linux.tar.zst --stdout | tar x
echo "$PWD/x86_64-onyx/bin" >> $GITHUB_PATH
- name: Install dependencies
run: |
scripts/ci/install_github_ci_deps.sh
echo "$PWD/gn_bin" >> $GITHUB_PATH
# Runs a set of commands using the runners shell
- name: Build Onyx
run: |
export SYSROOT=$PWD/sysroot
export ONYX_ARCH=x86_64
./scripts/setup_build.sh
make -C kernel defconfig
RUN_CLANG_TIDY=0 make -j $(nproc) iso
./scripts/ci/build_ports.sh
./scripts/create_disk_image.sh disk-image.img --bootable efi
- name: Upload a Build Artifact(Onyx.iso)
uses: actions/upload-artifact@v4
with:
name: Onyx ISO
path: Onyx.iso
- name: Upload a Build Artifact(kernel/vmonyx)
uses: actions/upload-artifact@v4
with:
name: vmonyx
path: kernel/vmonyx
- name: Upload a Build Artifact(Disk image)
uses: actions/upload-artifact@v4
with:
name: Disk-image.img
path: disk-image.img
build-llvm:
# The type of runner that the job will run on
runs-on: ubuntu-22.04
needs: build-toolchains
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
with:
submodules: "recursive"
- uses: actions/setup-python@v2
with:
python-version: '3.11.0' # Require the same version of python as Onyx builds, in order to ease the build
# Runs a single command using the runners shell
- name: Download the onyx-llvm-linux toolchain
uses: actions/download-artifact@v4
with:
# Artifact name
name: onyx-llvm-linux
- name: Extract Toolchain
run: |
zstd -d onyx-llvm-linux.tar.zst --stdout | tar x
- name: Install dependencies
run: |
scripts/ci/install_github_ci_deps.sh
echo "$PWD/gn_bin" >> $GITHUB_PATH
# Runs a set of commands using the runners shell
- name: Build Onyx
run: |
export CLANG_PATH=$PWD/onyx-llvm
export SYSROOT=$PWD/sysroot
export ONYX_ARCH=x86_64
./scripts/setup_build.sh
make -C kernel defconfig
RUN_CLANG_TIDY=0 make -j $(nproc) iso
./scripts/ci/build_ports.sh llvm
./scripts/create_disk_image.sh disk-image-llvm.img --bootable efi
- name: Upload a Build Artifact(Onyx.iso)
uses: actions/upload-artifact@v4
with:
name: Onyx-iso-llvm
path: Onyx.iso
- name: Upload a Build Artifact(kernel/vmonyx)
uses: actions/upload-artifact@v4
with:
name: vmonyx-llvm
path: kernel/vmonyx
- name: Upload a Build Artifact(disk-image-llvm)
uses: actions/upload-artifact@v4
with:
name: Disk-image-llvm.img
path: disk-image-llvm.img
build-riscv:
runs-on: ubuntu-22.04
needs: build-toolchains
steps:
- uses: actions/checkout@v2
with:
submodules: "recursive"
- uses: actions/setup-python@v2
with:
python-version: '3.11.0' # Require the same version of python as Onyx builds, in order to ease the build
- name: Download the riscv64-onyx-linux toolchain
uses: actions/download-artifact@v4
with:
# Artifact name
name: riscv64-onyx-linux
- name: Extract Toolchain
run: |
zstd -d riscv64-onyx-linux.tar.zst --stdout | tar x
echo "$PWD/riscv64-onyx/bin" >> $GITHUB_PATH
- name: Install dependencies
run: |
scripts/ci/install_github_ci_deps.sh
echo "$PWD/gn_bin" >> $GITHUB_PATH
- name: Build Onyx
run: |
export SYSROOT=$PWD/sysroot
export ONYX_ARCH=riscv64
./scripts/setup_build.sh
make -C kernel defconfig
RUN_CLANG_TIDY=0 make -j $(nproc) fullbuild-plus-initrd
mkdir -p boot
cp kernel/vmonyx boot/
cp initrd.tar boot/
tar cvf riscv64-onyx-image.tar boot/
zstd -T0 -15 riscv64-onyx-image.tar
- name: Upload the riscv64 boot image
uses: actions/upload-artifact@v4
with:
name: Onyx boot image (riscv64)
path: riscv64-onyx-image.tar.zst
build-llvm-riscv64:
# The type of runner that the job will run on
runs-on: ubuntu-22.04
needs: build-toolchains
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
with:
submodules: "recursive"
- uses: actions/setup-python@v2
with:
python-version: '3.11.0' # Require the same version of python as Onyx builds, in order to ease the build
# Runs a single command using the runners shell
- name: Download the onyx-llvm-linux toolchain
uses: actions/download-artifact@v4
with:
# Artifact name
name: onyx-llvm-linux
- name: Extract Toolchain
run: |
zstd -d onyx-llvm-linux.tar.zst --stdout | tar x
- name: Install dependencies
run: |
scripts/ci/install_github_ci_deps.sh
echo "$PWD/gn_bin" >> $GITHUB_PATH
# Runs a set of commands using the runners shell
- name: Build Onyx
run: |
export CLANG_PATH=$PWD/onyx-llvm
export SYSROOT=$PWD/sysroot
export ONYX_ARCH=riscv64
./scripts/setup_build.sh
make -C kernel defconfig
make -j $(nproc) fullbuild-plus-initrd
mkdir -p boot
cp kernel/vmonyx boot/
cp initrd.tar boot/
tar cvf riscv64-onyx-image-llvm.tar boot/
zstd -T0 -15 riscv64-onyx-image-llvm.tar
- name: Upload the riscv64 boot image (LLVM)
uses: actions/upload-artifact@v4
with:
name: Onyx boot image (riscv64) (llvm)
path: riscv64-onyx-image-llvm.tar.zst
# Builds a minimal sysroot, with headers and the libc. Supposed to be used when building a toolchain.
# In this case, we limit ourselves to building a stage 1 GNU toolchain since LLVM is far slower to build,
# and I'm not sure if it even supports building without a sysroot.
build-minimal-sysroots:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
target_arch: [x86_64, riscv64, arm64]
steps:
- uses: actions/checkout@v2
with:
submodules: "recursive"
- name: Cache (GNU toolchain)
id: toolchain-cache-gnu
uses: actions/[email protected]
with:
# A list of files, directories, and wildcard patterns to cache and restore
path: toolchain_binaries-gnu-stage1/
# An explicit key for restoring and saving the cache
key: ${{ matrix.target_arch }}-toolchain-${{ hashFiles('toolchains/binutils-2.37.patch', 'toolchains/gcc-11.2.0.patch',
'toolchains/scripts/build_toolchain.sh') }}
- name: Setup environment
run: |
scripts/ci/install_github_ci_deps.sh
echo "$PWD/gn_bin" >> $GITHUB_PATH
echo "$PWD/toolchain_binaries-gnu-stage1/bin" >> $GITHUB_PATH
if [ "$RUNNER_OS" = "macOS" ]; then
echo "$(brew --prefix)/opt/gnu-getopt/bin:$(brew --prefix)/opt/coreutils/libexec/gnubin:$(brew --prefix)/opt/make/libexec/gnubin" >> $GITHUB_PATH
export CPATH=$(brew --prefix)/include
export LIBRARY_PATH=$(brew --prefix)/lib
export CC=gcc-13
export CXX=g++-13
fi
- name: Build toolchain
if: steps.toolchain-cache-gnu.outputs.cache-hit != 'true'
run: |
export SYSROOT=$PWD/sysroot
export ONYX_ARCH=${{ matrix.target_arch }}
mkdir -p toolchain_binaries-gnu-stage1
./toolchains/scripts/build_toolchain.sh --no-libc toolchain_build toolchain_binaries-gnu-stage1 \
-a ${{ matrix.target_arch }}
- name: Build sysroot
run: |
export ONYX_ARCH=${{ matrix.target_arch }}
./scripts/setup_build.sh
make -C kernel defconfig
make install-headers -j $(nproc)
./scripts/build_libc_for_toolchain.sh
tar cvf minimal-sysroot-${{ matrix.target_arch }}.tar sysroot/
zstd -T0 -15 minimal-sysroot-${{ matrix.target_arch }}.tar
- name: Upload the minimal sysroot
uses: actions/upload-artifact@v4
with:
name: minimal-sysroot-${{ matrix.target_arch }}
path: minimal-sysroot-${{ matrix.target_arch }}.tar.zst
build-toolchains:
runs-on: ${{ matrix.os }}
needs: build-minimal-sysroots
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, ubuntu-20.04]
target_arch: [x86_64, riscv64, arm64]
toolchain: [gnu]
include:
- os: ubuntu-22.04
toolchain: llvm
target_arch: all
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
with:
submodules: "recursive"
- name: Download the minimal sysroot
uses: actions/download-artifact@v4
- name: Extract minimal sysroot
run: |
./scripts/ci/setup_sysroots.sh ${{ matrix.toolchain }} ${{ matrix.target_arch }}
- run: |
# Add a modifier to ubuntu 20.04 LTS
if [ "${{ matrix.os }}" = "ubuntu-20.04" ]; then
os_name_modifier="-ubuntu-20.04"
fi
case "${{ runner.os }}" in
Linux)
os_name="linux$os_name_modifier"
;;
macOS)
os_name="macos"
;;
esac
case "${{ matrix.toolchain }}" in
gnu)
toolchain_id_no_os="${{ matrix.target_arch }}-onyx"
;;
llvm)
toolchain_id_no_os="onyx-llvm"
;;
esac
echo "os_name=$os_name" >> $GITHUB_ENV
echo "toolchain_id_no_os=$toolchain_id_no_os" >> $GITHUB_ENV
echo "toolchain_id=${toolchain_id_no_os}-${os_name}" >> $GITHUB_ENV
echo "cache-version=\"-v2\"" >> $GITHUB_ENV # Used to invalidate previous caches, when needed.
- name: Cache (GNU toolchain)
if: matrix.toolchain == 'gnu'
id: toolchain-cache-gnu
uses: actions/[email protected]
with:
# A list of files, directories, and wildcard patterns to cache and restore
path: toolchain_binaries-gnu/
# An explicit key for restoring and saving the cache
key: ${{ matrix.target_arch }}-toolchain-${{ matrix.os }}${{ env.cache-version }}-${{ hashFiles('toolchains/binutils-2.37.patch',
'toolchains/gcc-11.2.0.patch', 'toolchains/scripts/build_toolchain.sh') }}-nightly
- name: Cache (LLVM toolchain)
if: matrix.toolchain == 'llvm'
id: toolchain-cache-llvm
uses: actions/[email protected]
with:
# A list of files, directories, and wildcard patterns to cache and restore
path: toolchain_binaries-llvm/
# An explicit key for restoring and saving the cache
key: ${{ matrix.target_arch }}-toolchain-${{ matrix.os }}${{ env.cache-version }}-${{ hashFiles('toolchains/llvm-project-13.0.0.patch',
'toolchains/scripts/build_toolchain.sh') }}-nightly
- name: Build toolchain
if: (steps.toolchain-cache-gnu.outputs.cache-hit != 'true' && matrix.toolchain == 'gnu') ||
(steps.toolchain-cache-llvm.outputs.cache-hit != 'true' && matrix.toolchain == 'llvm')
run: |
scripts/ci/install_github_ci_deps.sh
export PATH="$PATH:$PWD/gn_bin"
echo "$PWD/gn_bin" >> $GITHUB_PATH
if [ "$RUNNER_OS" = "macOS" ]; then
export PATH="$(brew --prefix)/opt/gnu-getopt/bin:$(brew --prefix)/opt/coreutils/libexec/gnubin:$(brew --prefix)/opt/make/libexec/gnubin:$PATH"
export CPATH=$(brew --prefix)/include
export LIBRARY_PATH=$(brew --prefix)/lib
export CC=gcc-13
export CXX=g++-13
fi
export SYSROOT=$PWD/sysroot
mkdir -p toolchain_binaries-${{ matrix.toolchain }}
if ! ./toolchains/scripts/build_toolchain.sh --use-lto toolchain_build toolchain_binaries-${{ matrix.toolchain }} \
-a ${{ matrix.target_arch }} --toolchain=${{ matrix.toolchain }}; then
rm -rf toolchain_binaries-${{ matrix.toolchain }}
exit 1
fi
- name: Compress toolchain
run: |
mv toolchain_binaries-${{ matrix.toolchain }} ${{ env.toolchain_id_no_os }}
tar cvf ${{ env.toolchain_id }}.tar ${{ env.toolchain_id_no_os }}
zstd -T0 -13 ${{ env.toolchain_id }}.tar -o ${{ env.toolchain_id }}.tar.zst
# We move the binaries back to toolchain_binaries-${{ matrix.toolchain }} due to the cache we previously set up
mv ${{ env.toolchain_id_no_os }} toolchain_binaries-${{ matrix.toolchain }}
- name: Upload the toolchain
uses: actions/upload-artifact@v4
with:
name: ${{ env.toolchain_id }}
path: ${{ env.toolchain_id }}.tar.zst
build-arm64:
if: ${{ false }}
runs-on: ubuntu-22.04
needs: build-toolchains
steps:
- uses: actions/checkout@v2
with:
submodules: "recursive"
- uses: actions/setup-python@v2
with:
python-version: '3.11.0' # Require the same version of python as Onyx builds, in order to ease the build
- name: Download the arm64-onyx-linux toolchain
uses: actions/download-artifact@v4
with:
# Artifact name
name: arm64-onyx-linux
- name: Extract Toolchain
run: |
zstd -d arm64-onyx-linux.tar.zst --stdout | tar x
echo "$PWD/arm64-onyx/bin" >> $GITHUB_PATH
- name: Install dependencies
run: |
scripts/ci/install_github_ci_deps.sh
echo "$PWD/gn_bin" >> $GITHUB_PATH
- name: Build Onyx
run: |
export SYSROOT=$PWD/sysroot
export ONYX_ARCH=arm64
./scripts/setup_build.sh
make -C kernel defconfig
RUN_CLANG_TIDY=0 make -j $(nproc) fullbuild-plus-initrd
mkdir -p boot
cp kernel/vmonyx boot/
cp initrd.tar boot/
tar cvf arm64-onyx-image.tar boot/
zstd -T0 -15 arm64-onyx-image.tar
- name: Upload the arm64 boot image
uses: actions/upload-artifact@v4
with:
name: Onyx boot image (arm64)
path: arm64-onyx-image.tar.zst
build-llvm-arm64:
if: ${{ false }}
# The type of runner that the job will run on
runs-on: ubuntu-22.04
needs: build-toolchains
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
with:
submodules: "recursive"
- uses: actions/setup-python@v2
with:
python-version: '3.11.0' # Require the same version of python as Onyx builds, in order to ease the build
# Runs a single command using the runners shell
- name: Download the onyx-llvm-linux toolchain
uses: actions/download-artifact@v4
with:
# Artifact name
name: onyx-llvm-linux
- name: Extract Toolchain
run: |
zstd -d onyx-llvm-linux.tar.zst --stdout | tar x
- name: Install dependencies
run: |
scripts/ci/install_github_ci_deps.sh
echo "$PWD/gn_bin" >> $GITHUB_PATH
# Runs a set of commands using the runners shell
- name: Build Onyx
run: |
export CLANG_PATH=$PWD/onyx-llvm
export SYSROOT=$PWD/sysroot
export ONYX_ARCH=arm64
./scripts/setup_build.sh
make -C kernel defconfig
make -j $(nproc) fullbuild-plus-initrd
mkdir -p boot
cp kernel/vmonyx boot/
cp initrd.tar boot/
tar cvf arm64-onyx-image-llvm.tar boot/
zstd -T0 -15 arm64-onyx-image-llvm.tar
- name: Upload the arm64 boot image (LLVM)
uses: actions/upload-artifact@v4
with:
name: Onyx boot image (arm64) (llvm)
path: arm64-onyx-image-llvm.tar.zst