Skip to content

Commit b2db592

Browse files
committed
[CI] check build and doc CI tasks under macOS
1 parent 9e97050 commit b2db592

File tree

3 files changed

+57
-8
lines changed

3 files changed

+57
-8
lines changed

.github/workflows/build.yml

Lines changed: 52 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,10 @@ jobs:
3838
run: make clippy ARCH=${{ matrix.arch }}
3939

4040
build:
41-
runs-on: ${{ matrix.os }}
41+
runs-on: ubuntu-latest
4242
strategy:
4343
fail-fast: false
4444
matrix:
45-
os: [ubuntu-latest]
4645
arch: [x86_64, riscv64, aarch64, loongarch64]
4746
rust-toolchain: [nightly, nightly-2025-05-20]
4847
env:
@@ -86,11 +85,10 @@ jobs:
8685
run: make ARCH=${{ matrix.arch }} A=examples/httpserver-c
8786

8887
build-for-other-platforms:
89-
runs-on: ${{ matrix.os }}
88+
runs-on: ubuntu-latest
9089
strategy:
9190
fail-fast: false
9291
matrix:
93-
os: [ubuntu-latest]
9492
rust-toolchain: [nightly, nightly-2025-05-20]
9593
env:
9694
RUSTUP_TOOLCHAIN: ${{ matrix.rust-toolchain }}
@@ -151,3 +149,53 @@ jobs:
151149
continue-on-error: ${{ matrix.rust-toolchain == 'nightly' }}
152150
run: make PLATFORM=x86_64-pc-oslab A=examples/httpserver-c FEATURES=page-alloc-4g,driver-ixgbe
153151

152+
# Necessary checks for macOS builds
153+
build-for-macos:
154+
runs-on: macos-latest
155+
strategy:
156+
fail-fast: false
157+
matrix:
158+
rust-toolchain: [nightly, nightly-2025-05-20]
159+
steps:
160+
- uses: actions/checkout@v4
161+
- uses: dtolnay/rust-toolchain@stable
162+
with:
163+
toolchain: ${{ matrix.rust-toolchain }}
164+
components: rust-src, clippy
165+
targets: x86_64-unknown-none, riscv64gc-unknown-none-elf, aarch64-unknown-none-softfloat, loongarch64-unknown-none-softfloat
166+
- uses: Swatinem/rust-cache@v2
167+
with:
168+
shared-key: cargo-bin-cache
169+
cache-targets: false
170+
- name: Clippy for the default target
171+
continue-on-error: ${{ matrix.rust-toolchain == 'nightly' }}
172+
run: make clippy
173+
174+
- run: cargo install cargo-binutils
175+
- name: Build helloworld
176+
continue-on-error: ${{ matrix.rust-toolchain == 'nightly' }}
177+
run: make A=examples/helloworld
178+
179+
# Test for other platforms
180+
- run: make PLATFORM=x86_64-pc-oslab defconfig
181+
- name: Build helloworld for x86_64-pc-oslab
182+
continue-on-error: ${{ matrix.rust-toolchain == 'nightly' }}
183+
run: make PLATFORM=x86_64-pc-oslab A=examples/helloworld
184+
- name: Build shell for x86_64-pc-oslab
185+
continue-on-error: ${{ matrix.rust-toolchain == 'nightly' }}
186+
run: make PLATFORM=x86_64-pc-oslab A=examples/shell FEATURES=page-alloc-4g,driver-ramdisk
187+
188+
- run: make PLATFORM=aarch64-raspi4 defconfig
189+
- name: Build helloworld for aarch64-raspi4
190+
continue-on-error: ${{ matrix.rust-toolchain == 'nightly' }}
191+
run: make PLATFORM=aarch64-raspi4 SMP=4 A=examples/helloworld
192+
193+
- run: make PLATFORM=aarch64-bsta1000b defconfig
194+
- name: Build helloworld for aarch64-bsta1000b
195+
continue-on-error: ${{ matrix.rust-toolchain == 'nightly' }}
196+
run: make PLATFORM=aarch64-bsta1000b A=examples/helloworld SMP=8
197+
198+
- run: make PLATFORM=aarch64-phytium-pi defconfig
199+
- name: Build helloworld for aarch64-phytium-pi
200+
continue-on-error: ${{ matrix.rust-toolchain == 'nightly' }}
201+
run: make PLATFORM=aarch64-phytium-pi A=examples/helloworld SMP=4

.github/workflows/docs.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ env:
77

88
jobs:
99
doc:
10-
runs-on: ubuntu-latest
10+
runs-on: ${{ matrix.os }}
1111
strategy:
12+
matrix:
13+
os: [ubuntu-latest, macos-latest]
1214
fail-fast: false
1315
permissions:
1416
contents: write
@@ -24,10 +26,9 @@ jobs:
2426
shared-key: cargo-bin-cache
2527
cache-targets: false
2628
- name: Build docs
27-
continue-on-error: ${{ github.ref != env.default-branch && github.event_name != 'pull_request' }}
2829
run: make doc_check_missing
2930
- name: Deploy to Github Pages
30-
if: ${{ github.ref == env.default-branch }}
31+
if: ${{ github.ref == env.default-branch && matrix.os == 'ubuntu-latest' }}
3132
uses: JamesIves/github-pages-deploy-action@v4
3233
with:
3334
single-commit: true

modules/axhal/src/platform/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
//! Platform-specific operations.
22
33
cfg_if::cfg_if! {
4-
if #[cfg(target_arch = "aarch64")]{
4+
if #[cfg(all(target_arch = "aarch64", target_os = "none"))]{
55
mod aarch64_common;
66
}
77
}

0 commit comments

Comments
 (0)