Skip to content

ci: use matrix, add riscv64 #406

ci: use matrix, add riscv64

ci: use matrix, add riscv64 #406

Workflow file for this run

name: CI
on:
pull_request:
merge_group:
env:
RUSTFLAGS: -Dwarnings
RUSTDOCFLAGS: -Dwarnings
jobs:
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: mkroening/rust-toolchain-toml@main
- run: rustup component add clippy
- name: Clippy
run: |
cargo clippy --all-targets
cargo clippy -Zbuild-std=std,panic_abort --target=x86_64-unknown-hermit --all-targets
cargo clippy -Zbuild-std=std,panic_abort --target=aarch64-unknown-hermit --all-targets
cargo clippy -Zbuild-std=std,panic_abort --target=riscv64gc-unknown-hermit --all-targets
format:
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: mkroening/rust-toolchain-toml@main
- run: rustup component add rustfmt
- name: Format
run: cargo fmt -- --check
check-docs:
name: Check docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: mkroening/rust-toolchain-toml@main
- name: Check docs
run: cargo doc --no-deps --document-private-items
kvm:
name: KVM
runs-on: [self-hosted]
steps:
- name: Install QEMU
run: |
sudo apt-get update
sudo apt-get install -y qemu-kvm
- uses: actions/checkout@v4
with:
submodules: true
- uses: mkroening/rust-toolchain-toml@main
- name: Download loader
uses: dsaltares/[email protected]
with:
repo: hermit-os/loader
file: hermit-loader-x86_64
- name: Build dev profile
run: cargo build -Zbuild-std=std,panic_abort --target x86_64-unknown-hermit --package rusty_demo
- name: Install uhyve
run: cargo +stable install --locked uhyve
- name: Check KVM availability
shell: bash
run: |
lscpu
kvm-ok
- name: Test debug version (Uhyve)
run: uhyve --verbose -c 1 target/x86_64-unknown-hermit/debug/rusty_demo
env:
RUST_LOG: debug
- name: Test debug profile (Qemu)
run: |
qemu-system-x86_64 -display none -smp 1 -m 128M -serial stdio \
-enable-kvm -cpu qemu64,apic,fsgsbase,rdtscp,xsave,xsaveopt,fxsr,rdrand \
-kernel hermit-loader-x86_64 \
-initrd target/x86_64-unknown-hermit/debug/rusty_demo
- name: Build release profile
run: cargo build -Zbuild-std=std,panic_abort --target x86_64-unknown-hermit --package rusty_demo --release
- name: Test release version (Uhyve)
run: uhyve --verbose -c 1 target/x86_64-unknown-hermit/release/rusty_demo
env:
RUST_LOG: debug
- name: Test release profile (Qemu)
run: |
qemu-system-x86_64 -display none -smp 1 -m 128M -serial stdio \
-enable-kvm -cpu qemu64,apic,fsgsbase,rdtscp,xsave,xsaveopt,fxsr,rdrand \
-kernel hermit-loader-x86_64 \
-initrd target/x86_64-unknown-hermit/release/rusty_demo
run-hermit:
name: Run
runs-on: ubuntu-latest
defaults:
run:
working-directory: kernel
strategy:
matrix:
arch: [x86_64, aarch64, riscv64]
package: [rusty_demo, httpd]
profile: [dev, release]
include:
- arch: x86_64
packages: qemu-system-x86
- arch: aarch64
packages: qemu-system-aarch64
- arch: riscv64
packages: qemu-system-misc
flags: --no-default-features
- package: httpd
netdev: rtl8139
flags: --features ci,dhcpv4
exclude:
- arch: aarch64
package: httpd
- arch: riscv64
package: httpd
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install Packages
run: |
sudo apt-get update
sudo apt-get install ${{ matrix.packages }}
- name: Download loader
uses: dsaltares/fetch-gh-release-asset@master
with:
repo: hermit-os/loader
file: hermit-loader-${{ matrix.arch }}
- uses: mkroening/rust-toolchain-toml@main
- uses: mkroening/rust-toolchain-toml@main
with:
toolchain-file: 'kernel/rust-toolchain.toml'
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.arch }}-${{ matrix.profile }}
save-if: ${{ github.ref == 'refs/heads/main' }}
workspaces: |
.
kernel
kernel/hermit-builtins
- name: Run Demo
run: >
cargo xtask ci qemu
--arch ${{ matrix.arch }}
--package ${{ matrix.package }}
--profile ${{ matrix.profile }}
${{ matrix.netdev == 'rtl8139' && '--features rtl8139' || '' }}
${{ matrix.netdev && format('--netdev {0}', matrix.netdev) || '' }}
${{ matrix.flags }}