Skip to content

Commit e1bf82f

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

File tree

3 files changed

+55
-8
lines changed

3 files changed

+55
-8
lines changed

.github/workflows/build.yml

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