Add the coroutine support and make the coroutine and thread hybrid scheduling. #2262
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
shared-key: cargo-bin-cache | |
cache-targets: false | |
- 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 | |
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 | |
cache-targets: false | |
# Test various config files | |
- 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 various config files 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] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: dtolnay/rust-toolchain@stable | |
with: | |
toolchain: ${{ matrix.rust-toolchain }} | |
components: rust-src, clippy | |
targets: x86_64-unknown-none | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
shared-key: cargo-bin-cache | |
cache-targets: false | |
- name: Clippy for the default target | |
continue-on-error: ${{ matrix.rust-toolchain == 'nightly' }} | |
run: make clippy | |
- run: cargo install cargo-binutils | |
- 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 |