Skip to content

CI

CI #658

Workflow file for this run

name: CI
on:
pull_request:
merge_group:
env:
GH_TOKEN: ${{ github.token }}
RUSTFLAGS: -Dwarnings
RUSTDOCFLAGS: -Dwarnings
jobs:
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: dtolnay/rust-toolchain@nightly
with:
components: rust-src
- uses: mkroening/rust-toolchain-toml@main
- run: rustup component add clippy llvm-tools
- 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: dtolnay/rust-toolchain@nightly
with:
components: rust-src
- uses: mkroening/rust-toolchain-toml@main
- run: rustup component add llvm-tools
- 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
run: gh release download --repo hermit-os/loader --pattern 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,hermit/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
run: gh release download --repo hermit-os/loader --pattern hermit-loader-${{ matrix.arch }}
- name: Dowload OpenSBI
if: matrix.arch == 'riscv64'
run: |
gh release download v1.4 --repo riscv-software-src/opensbi --pattern 'opensbi-*-rv-bin.tar.xz'
tar -xvf opensbi-*-rv-bin.tar.xz opensbi-1.4-rv-bin/share/opensbi/lp64/generic/firmware/fw_jump.bin
- 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 Hermit
run: >
cargo xtask ci qemu
--arch ${{ matrix.arch }}
--package ${{ matrix.package }}
--profile ${{ matrix.profile }}
${{ matrix.netdev == 'rtl8139' && '--features hermit/rtl8139' || '' }}
${{ matrix.netdev && format('--netdev {0}', matrix.netdev) || '' }}
${{ matrix.flags }}