forked from arceos-org/arceos
-
Notifications
You must be signed in to change notification settings - Fork 18
271 lines (254 loc) · 13 KB
/
build.yml
File metadata and controls
271 lines (254 loc) · 13 KB
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
name: Build CI
on: [push, pull_request]
jobs:
clippy:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
arch: [x86_64, riscv64, aarch64, loongarch64]
rust-toolchain: [nightly, nightly-2025-05-20]
env:
RUSTUP_TOOLCHAIN: ${{ matrix.rust-toolchain }}
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-softfloat, loongarch64-unknown-none-softfloat
- name: Check rust version
run: rustc --version --verbose
- name: Check code format
if: ${{ matrix.arch == 'x86_64' }}
continue-on-error: ${{ matrix.rust-toolchain == 'nightly' }}
run: cargo fmt --all -- --check
- name: Clippy for the default target
if: ${{ matrix.arch == 'x86_64' }}
continue-on-error: ${{ matrix.rust-toolchain == 'nightly' }}
run: make clippy
- name: Clippy for ${{ matrix.arch }}
continue-on-error: ${{ matrix.rust-toolchain == 'nightly' }}
run: make clippy ARCH=${{ matrix.arch }}
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
arch: [x86_64, riscv64, aarch64, loongarch64]
rust-toolchain: [nightly, nightly-2025-05-20]
env:
RUSTUP_TOOLCHAIN: ${{ matrix.rust-toolchain }}
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-softfloat, loongarch64-unknown-none-softfloat
- uses: Swatinem/rust-cache@v2
with:
shared-key: cargo-bin-cache-${{ matrix.rust-toolchain }}
cache-targets: false
- name: Build helloworld
continue-on-error: ${{ matrix.rust-toolchain == 'nightly' }}
run: make ARCH=${{ matrix.arch }} A=examples/helloworld
- name: Build httpclient
continue-on-error: ${{ matrix.rust-toolchain == 'nightly' }}
run: make ARCH=${{ matrix.arch }} A=examples/httpclient
- name: Build httpserver
continue-on-error: ${{ matrix.rust-toolchain == 'nightly' }}
run: make ARCH=${{ matrix.arch }} A=examples/httpserver
- name: Build shell
continue-on-error: ${{ matrix.rust-toolchain == 'nightly' }}
run: make ARCH=${{ matrix.arch }} A=examples/shell
- uses: arceos-org/setup-musl@v1
with:
arch: ${{ matrix.arch }}
- name: Build helloworld-c
continue-on-error: ${{ matrix.rust-toolchain == 'nightly' }}
run: make ARCH=${{ matrix.arch }} A=examples/helloworld-c
- name: Build httpclient-c
continue-on-error: ${{ matrix.rust-toolchain == 'nightly' }}
run: make ARCH=${{ matrix.arch }} A=examples/httpclient-c
- name: Build httpserver-c
continue-on-error: ${{ matrix.rust-toolchain == 'nightly' }}
run: make ARCH=${{ matrix.arch }} A=examples/httpserver-c
build-for-other-platforms:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
rust-toolchain: [nightly, nightly-2025-05-20]
env:
RUSTUP_TOOLCHAIN: ${{ matrix.rust-toolchain }}
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-softfloat, loongarch64-unknown-none-softfloat
- uses: Swatinem/rust-cache@v2
with:
shared-key: cargo-bin-cache-${{ matrix.rust-toolchain }}
cache-targets: false
# Test custom config file
- name: Build helloworld for x86_64-pc-oslab
continue-on-error: ${{ matrix.rust-toolchain == 'nightly' }}
run: make PLAT_CONFIG=$(pwd)/configs/custom/x86_64-pc-oslab.toml A=examples/helloworld
- name: Build httpclient for x86_64-pc-oslab
continue-on-error: ${{ matrix.rust-toolchain == 'nightly' }}
run: make PLAT_CONFIG=$(pwd)/configs/custom/x86_64-pc-oslab.toml A=examples/httpclient FEATURES=page-alloc-4g,driver-ixgbe
- name: Build httpserver for x86_64-pc-oslab
continue-on-error: ${{ matrix.rust-toolchain == 'nightly' }}
run: make PLAT_CONFIG=$(pwd)/configs/custom/x86_64-pc-oslab.toml A=examples/httpserver FEATURES=page-alloc-4g,driver-ixgbe
- name: Build shell for x86_64-pc-oslab
continue-on-error: ${{ matrix.rust-toolchain == 'nightly' }}
run: make PLAT_CONFIG=$(pwd)/configs/custom/x86_64-pc-oslab.toml A=examples/shell FEATURES=page-alloc-4g,driver-ramdisk
# Test app `helloworld-myplat` for various platforms
- name: Build helloworld-myplat for x86-pc
continue-on-error: ${{ matrix.rust-toolchain == 'nightly' }}
run: |
make ARCH=x86_64 defconfig
make ARCH=x86_64 A=examples/helloworld-myplat SMP=4 APP_FEATURES=x86-pc
make MYPLAT=axplat-x86-pc A=examples/helloworld-myplat SMP=4 APP_FEATURES=x86-pc
- name: Build helloworld-myplat for aarch64-qemu-virt
continue-on-error: ${{ matrix.rust-toolchain == 'nightly' }}
run: |
make ARCH=aarch64 defconfig
make ARCH=aarch64 A=examples/helloworld-myplat SMP=4 APP_FEATURES=aarch64-qemu-virt
make MYPLAT=axplat-aarch64-qemu-virt A=examples/helloworld-myplat SMP=4 APP_FEATURES=aarch64-qemu-virt
- name: Build helloworld-myplat for aarch64-raspi4
continue-on-error: ${{ matrix.rust-toolchain == 'nightly' }}
run: |
make MYPLAT=axplat-aarch64-raspi defconfig
make MYPLAT=axplat-aarch64-raspi A=examples/helloworld-myplat APP_FEATURES=aarch64-raspi4
- name: Build helloworld-myplat for aarch64-bsta1000b
continue-on-error: ${{ matrix.rust-toolchain == 'nightly' }}
run: |
make MYPLAT=axplat-aarch64-bsta1000b defconfig
make MYPLAT=axplat-aarch64-bsta1000b A=examples/helloworld-myplat APP_FEATURES=aarch64-bsta1000b
- name: Build helloworld-myplat for aarch64-phytium-pi
continue-on-error: ${{ matrix.rust-toolchain == 'nightly' }}
run: |
make MYPLAT=axplat-aarch64-phytium-pi defconfig
make MYPLAT=axplat-aarch64-phytium-pi A=examples/helloworld-myplat APP_FEATURES=aarch64-phytium-pi
- name: Build helloworld-myplat for loongarch64-qemu-virt
continue-on-error: ${{ matrix.rust-toolchain == 'nightly' }}
run: |
make ARCH=loongarch64 defconfig
make ARCH=loongarch64 A=examples/helloworld-myplat SMP=4 APP_FEATURES=loongarch64-qemu-virt
make MYPLAT=axplat-loongarch64-qemu-virt A=examples/helloworld-myplat SMP=4 APP_FEATURES=loongarch64-qemu-virt
- name: Build helloworld-myplat for riscv64-qemu-virt
continue-on-error: ${{ matrix.rust-toolchain == 'nightly' }}
run: |
make ARCH=riscv64 defconfig
make ARCH=riscv64 A=examples/helloworld-myplat SMP=4 APP_FEATURES=riscv64-qemu-virt
make MYPLAT=axplat-riscv64-qemu-virt A=examples/helloworld-myplat SMP=4 APP_FEATURES=riscv64-qemu-virt
# Test platform `aarch64-raspi4` for various apps
- name: Setup aarch64-raspi4
run: |
git checkout .
make MYPLAT=axplat-aarch64-raspi defconfig
cargo axplat add axplat-aarch64-raspi -p arceos-helloworld -F smp --git https://github.com/arceos-org/axhal_crates.git
cargo axplat add axplat-aarch64-raspi -p arceos-shell -F smp --git https://github.com/arceos-org/axhal_crates.git
echo "extern crate axplat_aarch64_raspi;" >> examples/helloworld/src/main.rs
echo "extern crate axplat_aarch64_raspi;" >> examples/shell/src/main.rs
- name: Build helloworld for aarch64-raspi4
continue-on-error: ${{ matrix.rust-toolchain == 'nightly' }}
run: make MYPLAT=axplat-aarch64-raspi A=examples/helloworld
- name: Build shell for aarch64-raspi4
continue-on-error: ${{ matrix.rust-toolchain == 'nightly' }}
run: make MYPLAT=axplat-aarch64-raspi A=examples/shell FEATURES=page-alloc-4g,driver-bcm2835-sdhci BUS=mmio
# Test platform `aarch64-bsta1000b` for various apps
- name: Setup aarch64-bsta1000b
run: |
git checkout .
make MYPLAT=axplat-aarch64-bsta1000b defconfig
cargo axplat add axplat-aarch64-bsta1000b -p arceos-helloworld -F smp --git https://github.com/arceos-org/axhal_crates.git
cargo axplat add axplat-aarch64-bsta1000b -p arceos-shell -F smp --git https://github.com/arceos-org/axhal_crates.git
echo "extern crate axplat_aarch64_bsta1000b;" >> examples/helloworld/src/main.rs
echo "extern crate axplat_aarch64_bsta1000b;" >> examples/shell/src/main.rs
- name: Build helloworld for aarch64-bsta1000b
continue-on-error: ${{ matrix.rust-toolchain == 'nightly' }}
run: make MYPLAT=axplat-aarch64-bsta1000b A=examples/helloworld
- name: Build shell for aarch64-bsta1000b
continue-on-error: ${{ matrix.rust-toolchain == 'nightly' }}
run: make MYPLAT=axplat-aarch64-bsta1000b A=examples/shell FEATURES=page-alloc-4g,driver-ramdisk BUS=mmio
# Test platform `aarch64-phytium-pi` for various apps
- name: Setup aarch64-phytium-pi
run: |
git checkout .
make MYPLAT=axplat-aarch64-phytium-pi defconfig
cargo axplat add axplat-aarch64-phytium-pi -p arceos-helloworld -F smp --git https://github.com/arceos-org/axhal_crates.git
cargo axplat add axplat-aarch64-phytium-pi -p arceos-shell -F smp --git https://github.com/arceos-org/axhal_crates.git
echo "extern crate axplat_aarch64_phytium_pi;" >> examples/helloworld/src/main.rs
echo "extern crate axplat_aarch64_phytium_pi;" >> examples/shell/src/main.rs
- name: Build helloworld for aarch64-phytium-pi
continue-on-error: ${{ matrix.rust-toolchain == 'nightly' }}
run: make MYPLAT=axplat-aarch64-phytium-pi A=examples/helloworld
- name: Build shell for aarch64-phytium-pi
continue-on-error: ${{ matrix.rust-toolchain == 'nightly' }}
run: make MYPLAT=axplat-aarch64-phytium-pi A=examples/shell FEATURES=page-alloc-4g,driver-ramdisk BUS=mmio
# Test custom config file for C apps
- uses: arceos-org/setup-musl@v1
with:
arch: x86_64
- name: Setup x86_64-pc-oslab for C apps
run: make PLAT_CONFIG=$(pwd)/configs/custom/x86_64-pc-oslab.toml defconfig
- name: Build helloworld-c for x86_64-pc-oslab
continue-on-error: ${{ matrix.rust-toolchain == 'nightly' }}
run: make PLAT_CONFIG=$(pwd)/configs/custom/x86_64-pc-oslab.toml A=examples/helloworld-c
- name: Build httpclient-c for x86_64-pc-oslab
continue-on-error: ${{ matrix.rust-toolchain == 'nightly' }}
run: make PLAT_CONFIG=$(pwd)/configs/custom/x86_64-pc-oslab.toml A=examples/httpclient-c FEATURES=page-alloc-4g,driver-ixgbe
- name: Build httpserver-c for x86_64-pc-oslab
continue-on-error: ${{ matrix.rust-toolchain == 'nightly' }}
run: make PLAT_CONFIG=$(pwd)/configs/custom/x86_64-pc-oslab.toml A=examples/httpserver-c FEATURES=page-alloc-4g,driver-ixgbe
# Necessary checks for macOS builds
build-for-macos:
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
rust-toolchain: [nightly, nightly-2025-05-20]
env:
RUSTUP_TOOLCHAIN: ${{ matrix.rust-toolchain }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.rust-toolchain }}
components: rust-src, clippy, llvm-tools
targets: x86_64-unknown-none
- uses: Swatinem/rust-cache@v2
with:
shared-key: cargo-bin-cache-${{ matrix.rust-toolchain }}
cache-targets: false
- name: Clippy for the default target
continue-on-error: ${{ matrix.rust-toolchain == 'nightly' }}
run: make clippy
- name: Build helloworld
continue-on-error: ${{ matrix.rust-toolchain == 'nightly' }}
run: make A=examples/helloworld
# Test for other platforms
- run: make PLATFORM=x86_64-pc-oslab defconfig
- name: Build helloworld for x86_64-pc-oslab
continue-on-error: ${{ matrix.rust-toolchain == 'nightly' }}
run: make PLATFORM=x86_64-pc-oslab A=examples/helloworld
- name: Build shell for x86_64-pc-oslab
continue-on-error: ${{ matrix.rust-toolchain == 'nightly' }}
run: make PLATFORM=x86_64-pc-oslab A=examples/shell FEATURES=page-alloc-4g,driver-ramdisk
- run: make PLATFORM=aarch64-raspi4 defconfig
- name: Build helloworld for aarch64-raspi4
continue-on-error: ${{ matrix.rust-toolchain == 'nightly' }}
run: make PLATFORM=aarch64-raspi4 SMP=4 A=examples/helloworld
- run: make PLATFORM=aarch64-bsta1000b defconfig
- name: Build helloworld for aarch64-bsta1000b
continue-on-error: ${{ matrix.rust-toolchain == 'nightly' }}
run: make PLATFORM=aarch64-bsta1000b A=examples/helloworld SMP=8
- run: make PLATFORM=aarch64-phytium-pi defconfig
- name: Build helloworld for aarch64-phytium-pi
continue-on-error: ${{ matrix.rust-toolchain == 'nightly' }}
run: make PLATFORM=aarch64-phytium-pi A=examples/helloworld SMP=4