-
Notifications
You must be signed in to change notification settings - Fork 4
342 lines (331 loc) · 14.3 KB
/
build.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
name: Build CI
on:
push:
pull_request:
workflow_call:
inputs:
TopTestDirectory:
description: 'The directory where the main repository will be placed'
required: true
type: string
CallerPackage:
description: 'The package to call the workflow'
required: true
type: string
CallerRepository:
description: 'The repository to call the workflow'
required: true
type: string
CallerCommit:
description: 'The commit of the repository to call the workflow'
required: true
type: string
TopBranch:
description: 'The branch of the main repository'
required: false
type: string
default: 'main'
jobs:
prepare_for_external_test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- id: step1
if: github.repository != 'Starry-OS/Starry'
# 输出的值可以在后续的job中使用
run: echo "TopTestDirectory=${{ inputs.TopTestDirectory }}" >> $GITHUB_OUTPUT
- id: step2
if: github.repository == 'Starry-OS/Starry'
# 工作目录为当前目录
run: echo "TopTestDirectory=." >> $GITHUB_OUTPUT
outputs:
TopTestDirectory: ${{ steps.step1.outputs.TopTestDirectory || steps.step2.outputs.TopTestDirectory }}
clippy:
needs: prepare_for_external_test
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
rust-toolchain: [nightly, nightly-2024-05-02]
env:
RUSTUP_TOOLCHAIN: ${{ matrix.rust-toolchain }}
WORKING_DIRECTORY: ${{ needs.prepare_for_external_test.outputs.TopTestDirectory }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.rust-toolchain }}
components: rust-src, clippy, rustfmt
targets: x86_64-unknown-none, riscv64gc-unknown-none-elf, aarch64-unknown-none, aarch64-unknown-none-softfloat
- name: Clone Top Repository
if: github.repository != 'Starry-OS/Starry'
run: git clone https://github.com/Starry-OS/Starry.git ${{ env.WORKING_DIRECTORY }} && cd ${{ env.WORKING_DIRECTORY }} && git checkout ${{ inputs.TopBranch }}
- name: Update Top Repository
working-directory: ${{ env.WORKING_DIRECTORY }}
run: make pre_update
- name: Check rust version
working-directory: ${{ env.WORKING_DIRECTORY }}
run: rustc --version --verbose
- name: Clippy for the default target
working-directory: ${{ env.WORKING_DIRECTORY }}
run: make clippy
- name: Clippy for x86_64
working-directory: ${{ env.WORKING_DIRECTORY }}
run: make clippy ARCH=x86_64
- name: Clippy for riscv64
working-directory: ${{ env.WORKING_DIRECTORY }}
run: make clippy ARCH=riscv64
- name: Clippy for aarch64
working-directory: ${{ env.WORKING_DIRECTORY }}
run: make clippy ARCH=aarch64
- name: Check code format
working-directory: ${{ env.WORKING_DIRECTORY }}
run: cargo fmt --all -- --check
build-apps-for-unikernel:
needs: prepare_for_external_test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
arch: [x86_64, riscv64, aarch64]
rust-toolchain: [nightly, nightly-2024-05-02]
env:
RUSTUP_TOOLCHAIN: ${{ matrix.rust-toolchain }}
WORKING_DIRECTORY: ${{ needs.prepare_for_external_test.outputs.TopTestDirectory }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.rust-toolchain }}
components: rust-src, llvm-tools
targets: x86_64-unknown-none, riscv64gc-unknown-none-elf, aarch64-unknown-none, aarch64-unknown-none-softfloat
- uses: Swatinem/rust-cache@v2
- run: cargo install cargo-binutils
- name: Clone Top Repository
if: github.repository != 'Starry-OS/Starry'
run: |
git clone https://github.com/Starry-OS/Starry.git ${{ env.WORKING_DIRECTORY }} && cd ${{ env.WORKING_DIRECTORY }} && git checkout ${{ inputs.TopBranch }} && cd ..
sh ${{ env.WORKING_DIRECTORY }}/scripts/test/external_test.sh ${{ env.WORKING_DIRECTORY }} ${{ inputs.CallerPackage }} ${{ inputs.CallerRepository }} ${{ inputs.CallerCommit }}
- name: Update Top Repository
working-directory: ${{ env.WORKING_DIRECTORY }}
run: make pre_update
- name: Build helloworld
working-directory: ${{ env.WORKING_DIRECTORY }}
run: make ARCH=${{ matrix.arch }} A=apps/helloworld
- name: Build memtest
working-directory: ${{ env.WORKING_DIRECTORY }}
run: make ARCH=${{ matrix.arch }} A=apps/memtest
- name: Build exception
working-directory: ${{ env.WORKING_DIRECTORY }}
run: make ARCH=${{ matrix.arch }} A=apps/exception
- name: Build display
working-directory: ${{ env.WORKING_DIRECTORY }}
run: make ARCH=${{ matrix.arch }} A=apps/display
- name: Build task/yield
working-directory: ${{ env.WORKING_DIRECTORY }}
run: make ARCH=${{ matrix.arch }} A=apps/task/yield
- name: Build task/parallel
working-directory: ${{ env.WORKING_DIRECTORY }}
run: make ARCH=${{ matrix.arch }} A=apps/task/parallel
- name: Build task/sleep
working-directory: ${{ env.WORKING_DIRECTORY }}
run: make ARCH=${{ matrix.arch }} A=apps/task/sleep
- name: Build task/priority
working-directory: ${{ env.WORKING_DIRECTORY }}
run: make ARCH=${{ matrix.arch }} A=apps/task/priority
- name: Build task/tls
working-directory: ${{ env.WORKING_DIRECTORY }}
run: make ARCH=${{ matrix.arch }} A=apps/task/tls
- name: Build fs/shell
working-directory: ${{ env.WORKING_DIRECTORY }}
run: make ARCH=${{ matrix.arch }} A=apps/fs/shell
- name: Build net/echoserver
working-directory: ${{ env.WORKING_DIRECTORY }}
run: make ARCH=${{ matrix.arch }} A=apps/net/echoserver
- name: Build net/httpclient
working-directory: ${{ env.WORKING_DIRECTORY }}
run: make ARCH=${{ matrix.arch }} A=apps/net/httpclient
- name: Build net/httpserver
working-directory: ${{ env.WORKING_DIRECTORY }}
run: make ARCH=${{ matrix.arch }} A=apps/net/httpserver
- name: Build net/udpserver
working-directory: ${{ env.WORKING_DIRECTORY }}
run: make ARCH=${{ matrix.arch }} A=apps/net/udpserver
- uses: ./.github/workflows/actions/setup-musl
with:
arch: ${{ matrix.arch }}
- name: Build c/helloworld
working-directory: ${{ env.WORKING_DIRECTORY }}
run: make ARCH=${{ matrix.arch }} A=apps/c/helloworld
- name: Build c/memtest
working-directory: ${{ env.WORKING_DIRECTORY }}
run: make ARCH=${{ matrix.arch }} A=apps/c/memtest
- name: Build c/sqlite3
working-directory: ${{ env.WORKING_DIRECTORY }}
run: make ARCH=${{ matrix.arch }} A=apps/c/sqlite3
- name: Build c/httpclient
working-directory: ${{ env.WORKING_DIRECTORY }}
run: make ARCH=${{ matrix.arch }} A=apps/c/httpclient
- name: Build c/httpserver
working-directory: ${{ env.WORKING_DIRECTORY }}
run: make ARCH=${{ matrix.arch }} A=apps/c/httpserver
- name: Build c/udpserver
working-directory: ${{ env.WORKING_DIRECTORY }}
run: make ARCH=${{ matrix.arch }} A=apps/c/udpserver
- name: Build c/iperf
working-directory: ${{ env.WORKING_DIRECTORY }}
run: make ARCH=${{ matrix.arch }} A=apps/c/iperf
- name: Build c/redis
working-directory: ${{ env.WORKING_DIRECTORY }}
run: make ARCH=${{ matrix.arch }} A=apps/c/redis SMP=4
build-apps-for-other-platforms:
needs: prepare_for_external_test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
rust-toolchain: [nightly, nightly-2024-05-02]
env:
RUSTUP_TOOLCHAIN: ${{ matrix.rust-toolchain }}
WORKING_DIRECTORY: ${{ needs.prepare_for_external_test.outputs.TopTestDirectory }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.rust-toolchain }}
components: rust-src, llvm-tools
targets: x86_64-unknown-none, riscv64gc-unknown-none-elf, aarch64-unknown-none, aarch64-unknown-none-softfloat
- uses: Swatinem/rust-cache@v2
- run: cargo install cargo-binutils
- name: Clone Top Repository
if: github.repository != 'Starry-OS/Starry'
run: |
git clone https://github.com/Starry-OS/Starry.git ${{ env.WORKING_DIRECTORY }} && cd ${{ env.WORKING_DIRECTORY }} && git checkout ${{ inputs.TopBranch }} && cd ..
sh ${{ env.WORKING_DIRECTORY }}/scripts/test/external_test.sh ${{ env.WORKING_DIRECTORY }} ${{ inputs.CallerPackage }} ${{ inputs.CallerRepository }} ${{ inputs.CallerCommit }}
- name: Update Top Repository
working-directory: ${{ env.WORKING_DIRECTORY }}
run: make pre_update
- uses: ./.github/workflows/actions/setup-musl
with:
arch: x86_64
- name: Build helloworld for x86_64-pc-oslab
working-directory: ${{ env.WORKING_DIRECTORY }}
run: make PLATFORM=x86_64-pc-oslab A=apps/helloworld
- name: Build net/httpserver for x86_64-pc-oslab
working-directory: ${{ env.WORKING_DIRECTORY }}
run: make PLATFORM=x86_64-pc-oslab A=apps/net/httpserver FEATURES=driver-ixgbe
- name: Build c/iperf for x86_64-pc-oslab
working-directory: ${{ env.WORKING_DIRECTORY }}
run: make PLATFORM=x86_64-pc-oslab A=apps/c/iperf FEATURES=driver-ixgbe,driver-ramdisk
- name: Build c/redis for x86_64-pc-oslab
working-directory: ${{ env.WORKING_DIRECTORY }}
run: make PLATFORM=x86_64-pc-oslab A=apps/c/redis FEATURES=driver-ixgbe,driver-ramdisk SMP=4
- name: Build helloworld for aarch64-raspi4
working-directory: ${{ env.WORKING_DIRECTORY }}
run: make PLATFORM=aarch64-raspi4 A=apps/helloworld
- name: Build fs/shell for aarch64-raspi4
working-directory: ${{ env.WORKING_DIRECTORY }}
run: make PLATFORM=aarch64-raspi4 A=apps/fs/shell FEATURES=driver-bcm2835-sdhci
- name: Build helloworld for aarch64-bsta1000b
working-directory: ${{ env.WORKING_DIRECTORY }}
run: make PLATFORM=aarch64-bsta1000b A=apps/helloworld
build-apps-for-std:
needs: prepare_for_external_test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
arch: [x86_64]
rust-toolchain: [nightly-2024-05-02]
env:
RUSTUP_TOOLCHAIN: ${{ matrix.rust-toolchain }}
WORKING_DIRECTORY: ${{ needs.prepare_for_external_test.outputs.TopTestDirectory }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.rust-toolchain }}
- name: Clone Top Repository
if: github.repository != 'Starry-OS/Starry'
run: |
git clone https://github.com/Starry-OS/Starry.git ${{ env.WORKING_DIRECTORY }} && cd ${{ env.WORKING_DIRECTORY }} && git checkout ${{ inputs.TopBranch }} && cd ..
sh ${{ env.WORKING_DIRECTORY }}/scripts/test/external_test.sh ${{ env.WORKING_DIRECTORY }} ${{ inputs.CallerPackage }} ${{ inputs.CallerRepository }} ${{ inputs.CallerCommit }}
- name: Update Top Repository
working-directory: ${{ env.WORKING_DIRECTORY }}
run: make pre_update
- name: Build helloworld
working-directory: ${{ env.WORKING_DIRECTORY }}
run: cargo build -p arceos-helloworld
- name: Build memtest
working-directory: ${{ env.WORKING_DIRECTORY }}
run: cargo build -p arceos-memtest
- name: Build exception
working-directory: ${{ env.WORKING_DIRECTORY }}
run: cargo build -p arceos-exception
- name: Build task/yield
working-directory: ${{ env.WORKING_DIRECTORY }}
run: cargo build -p arceos-yield
- name: Build task/parallel
working-directory: ${{ env.WORKING_DIRECTORY }}
run: cargo build -p arceos-parallel
- name: Build task/sleep
working-directory: ${{ env.WORKING_DIRECTORY }}
run: cargo build -p arceos-sleep
- name: Build task/priority
working-directory: ${{ env.WORKING_DIRECTORY }}
run: cargo build -p arceos-priority
- name: Build task/tls
working-directory: ${{ env.WORKING_DIRECTORY }}
run: cargo build -p arceos-tls
- name: Build fs/shell
working-directory: ${{ env.WORKING_DIRECTORY }}
run: cargo build -p arceos-shell
- name: Build net/echoserver
working-directory: ${{ env.WORKING_DIRECTORY }}
run: cargo build -p arceos-echoserver
- name: Build net/httpclient
working-directory: ${{ env.WORKING_DIRECTORY }}
run: cargo build -p arceos-httpclient
- name: Build net/httpserver
working-directory: ${{ env.WORKING_DIRECTORY }}
run: cargo build -p arceos-httpserver
- name: Build net/udpserver
working-directory: ${{ env.WORKING_DIRECTORY }}
run: cargo build -p arceos-udpserver
build-apps-for-monolithic:
needs: prepare_for_external_test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
arch: [x86_64, riscv64, aarch64]
rust-toolchain: [nightly, nightly-2024-05-02]
env:
RUSTUP_TOOLCHAIN: ${{ matrix.rust-toolchain }}
WORKING_DIRECTORY: ${{ needs.prepare_for_external_test.outputs.TopTestDirectory }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.rust-toolchain }}
components: rust-src, llvm-tools
targets: x86_64-unknown-none, riscv64gc-unknown-none-elf, aarch64-unknown-none, aarch64-unknown-none-softfloat
- uses: Swatinem/rust-cache@v2
- run: cargo install cargo-binutils
- name: Clone Top Repository
if: github.repository != 'Starry-OS/Starry'
run: |
git clone https://github.com/Starry-OS/Starry.git ${{ env.WORKING_DIRECTORY }} && cd ${{ env.WORKING_DIRECTORY }} && git checkout ${{ inputs.TopBranch }} && cd ..
sh ${{ env.WORKING_DIRECTORY }}/scripts/test/external_test.sh ${{ env.WORKING_DIRECTORY }} ${{ inputs.CallerPackage }} ${{ inputs.CallerRepository }} ${{ inputs.CallerCommit }}
- name: Update Top Repository
working-directory: ${{ env.WORKING_DIRECTORY }}
run: make pre_update
- name: Bulld monolithic-userboot
working-directory: ${{ env.WORKING_DIRECTORY }}
run: |
sh ./build_img.sh -a ${{ matrix.arch }}
make ARCH=${{ matrix.arch }} A=apps/monolithic_userboot