-
Notifications
You must be signed in to change notification settings - Fork 5
224 lines (178 loc) · 6.19 KB
/
create_base_disk_self_hosted.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
# MIT License
#
# Copyright (c) 2022 David Schall and EASE Lab
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
name: Create base disk image on self-hosted runners
env:
ARTIFACTS_DIR: artifacts/
KERNEL: artifacts/kernel
DISK_PRE_TEST: artifacts/disk-image.qcow2
DISK_FINAL: artifacts/disk.qcow2
CHECKSUMS: artifacts/checksums
CLIENT: artifacts/test-client
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
push:
branches: [main]
paths:
- "test/**"
- "setup/disk.Makefile"
- "configs/disk-image-configs/**"
pull_request:
branches: [main]
paths:
- "test/**"
- "setup/disk.Makefile"
- "configs/disk-image-configs/**"
jobs:
#########################################
### Install the OS on the new disk image
install-base-image:
name: Build Base image with Ubuntu
strategy:
fail-fast: false
matrix:
ubuntu-version: [ focal, jammy ]
# arch: [ amd64, arm64 ]
include:
- arch: amd64
makefile: setup/disk.Makefile
runner-arch: X86
# - arch: arm64
# makefile: setup/disk_arm.Makefile
# runner-arch: ARM64
runs-on: [self-hosted, vswarm-u-build, X64 ]
env:
WORKDIR: setup/
MAKEFILE: ${{ matrix.makefile }}
TEST_MAKEFILE: test/Makefile
BUILD_DIR: wkdir/
UBUNTU_VERSION: ${{ matrix.ubuntu-version }}
ARCH: ${{ matrix.arch }}
steps:
- name: Check out code
uses: actions/checkout@v4
### Get Kernel and test-client #################
- name: Download latest kernel
uses: dawidd6/action-download-artifact@v6
with:
workflow: build_kernel.yml
name: vmlinux-${{ matrix.ubuntu-version }}-${{ matrix.arch }}
path: tmp
- name: Download latest test client
uses: dawidd6/action-download-artifact@v6
with:
workflow: test_client.yml
name: test-client-${{ matrix.arch }}
path: tmp
- name: Copy artifacts
run: |
mkdir -p ${{ env.ARTIFACTS_DIR }}
cp tmp/kernel ${{ env.KERNEL }}
cp tmp/test-client ${{ env.CLIENT }}
### Build the disk ###############################
- name: Install dependencies
shell: bash
run: |
make -f ${{ env.MAKEFILE }} dep_install
- name: Download the iso file
shell: bash
run: |
make -f ${{ env.MAKEFILE }} download
- name: Settup the working directory
shell: bash
run: |
make -f ${{ env.MAKEFILE }} build
- name: Install ubuntu on the disk
shell: bash
run: |
make -f ${{ env.MAKEFILE }} install_kvm
- name: Finalize Disk image
shell: bash
env:
KERNEL_CUSTOM: ${{ env.KERNEL }}
run: |
make -f ${{ env.MAKEFILE }} install_finalize_kvm
- name: Save the image as base image
shell: bash
env:
OUTPUT: ${{ env.DISK_PRE_TEST }}
run: |
make -f ${{ env.MAKEFILE }} save_output
- name: Clean everything
if: ${{ always() }}
run: |
make -f ${{ env.MAKEFILE }} clean
## Upload the artifact ###############################
- name: Compress and split
run: |
mkdir temp
cp ${{ env.DISK_PRE_TEST }} temp/
./resources/artifacts.sh compress-split temp/*
rm temp/disk-image.qcow2
- name: Upload Base Image Artifact
uses: actions/upload-artifact@v4
with:
name: disk-image-${{ matrix.ubuntu-version }}-${{ matrix.arch }}
path: temp
- name: Create checksums of the artifacts
shell: bash
run: |
shasum ${{ env.DISK_PRE_TEST }} > ${{ env.CHECKSUMS }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: checksum-${{ matrix.ubuntu-version }}-${{ matrix.arch }}
path: ${{ env.CHECKSUMS }}
#####################################
### Test base disk image
##### Setup Test #####
- name: Install dependencies
run: |
make -f ${{ env.TEST_MAKEFILE }} dep_install
make -f ${{ env.TEST_MAKEFILE }} dep_check_qemu
- uses: actions/setup-go@v5
with:
go-version: '1.21'
- name: Create the working directory to run the test.
env:
KERNEL: ${{ env.KERNEL }}
DISK: ${{ env.DISK_PRE_TEST }}
TEST_CLIENT: ${{ env.CLIENT }}
run: |
make -f ${{ env.TEST_MAKEFILE }} build
- name: Run the actual test of the emulator.
timeout-minutes: 15
run: |
make -f ${{ env.TEST_MAKEFILE }} run_test
- name: Check the results file.
run: |
make -f ${{ env.TEST_MAKEFILE }} check_emu
- name: Create checksums of the artifacts
shell: bash
run: |
shasum ${{ env.DISK_PRE_TEST }} > ${{ env.CHECKSUMS }}
shasum ${{ env.KERNEL }} >> ${{ env.CHECKSUMS }}
shasum ${{ env.CLIENT }} >> ${{ env.CHECKSUMS }}
- name: Clean everything.
if: ${{ always() }}
run: |
make -f ${{ env.TEST_MAKEFILE }} clean