ci: install kernel toolchain too #1615
Workflow file for this run
This file contains 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: CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
merge_group: | |
env: | |
RUSTFLAGS: -Dwarnings | |
RUSTDOCFLAGS: -Dwarnings | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
check: | |
name: Check | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: taiki-e/install-action@cargo-hack | |
- name: Install NASM | |
run: | | |
sudo apt-get update | |
sudo apt-get install nasm | |
- uses: mkroening/rust-toolchain-toml@main | |
- uses: Swatinem/rust-cache@v2 | |
- name: Check each feature | |
run: cargo hack check --package hermit-kernel --each-feature --no-dev-deps --target x86_64-unknown-none | |
env: | |
RUSTFLAGS: | |
clippy: | |
name: Clippy | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install NASM | |
run: | | |
sudo apt-get update | |
sudo apt-get install nasm | |
- uses: mkroening/rust-toolchain-toml@main | |
- run: rustup component add clippy | |
- uses: Swatinem/rust-cache@v2 | |
- run: cargo xtask clippy | |
format: | |
name: Format | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: mkroening/rust-toolchain-toml@main | |
- run: rustup component add rustfmt | |
- run: cargo fmt -- --check | |
check-docs: | |
name: Check docs | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install NASM | |
run: | | |
sudo apt-get update | |
sudo apt-get install nasm | |
- uses: mkroening/rust-toolchain-toml@main | |
- run: rustup target add aarch64-unknown-none-softfloat | |
- uses: Swatinem/rust-cache@v2 | |
- name: Check docs | |
run: | | |
cargo doc --package hermit-kernel --no-deps --document-private-items --target x86_64-unknown-none | |
cargo doc --package hermit-kernel --no-deps --document-private-items --target aarch64-unknown-none-softfloat --no-default-features | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install NASM | |
run: | | |
sudo apt-get update | |
sudo apt-get install nasm | |
- uses: mkroening/rust-toolchain-toml@main | |
- uses: Swatinem/rust-cache@v2 | |
- name: Build minimal kernel | |
run: | | |
cargo xtask build --arch x86_64 --no-default-features | |
cargo xtask build --arch aarch64 --no-default-features | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install QEMU, NASM | |
run: | | |
sudo apt-get update | |
sudo apt-get install qemu-system-x86 nasm | |
- uses: mkroening/rust-toolchain-toml@main | |
- uses: Swatinem/rust-cache@v2 | |
- name: Unit tests | |
run: cargo test --lib | |
env: | |
RUSTFLAGS: -Awarnings | |
- name: Download loader | |
uses: dsaltares/fetch-gh-release-asset@master | |
with: | |
repo: hermitcore/rusty-loader | |
file: rusty-loader-x86_64 | |
- name: Integration tests | |
run: cargo test --tests --no-fail-fast --target x86_64-unknown-none -- --bootloader_path=rusty-loader-x86_64 | |
env: | |
RUSTFLAGS: | |
run-x86_64: | |
name: Run Hermit for Rust (x86_64) | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout hermit-rs | |
uses: actions/checkout@v4 | |
with: | |
repository: hermitcore/hermit-rs | |
submodules: true | |
- name: Remove hermit-kernel submodule | |
run: git rm -r kernel | |
- name: Checkout hermit-kernel | |
uses: actions/checkout@v4 | |
with: | |
path: kernel | |
- name: Install QEMU, NASM | |
run: | | |
sudo apt-get update | |
sudo apt-get install qemu-system-x86 nasm libcap-ng-dev libseccomp-dev socat | |
- 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: | |
workspaces: | | |
. | |
kernel | |
- name: Download loader | |
uses: dsaltares/fetch-gh-release-asset@master | |
with: | |
repo: hermitcore/rusty-loader | |
file: rusty-loader-x86_64 | |
- name: Install virtiofsd | |
run: cargo install virtiofsd | |
- name: Build dev profile | |
run: cargo build -Zbuild-std=std,panic_abort --package rusty_demo --target x86_64-unknown-hermit --features pci-ids | |
- name: Test dev profile | |
run: | | |
mkdir -p foo | |
virtiofsd --socket-path=./vhostqemu --shared-dir ./foo --announce-submounts --sandbox none --seccomp none --inode-file-handles=never & | |
qemu-system-x86_64 -display none -smp 1 -m 1G -serial stdio \ | |
-cpu qemu64,apic,fsgsbase,rdtscp,xsave,xsaveopt,fxsr \ | |
-device isa-debug-exit,iobase=0xf4,iosize=0x04 \ | |
-kernel rusty-loader-x86_64 \ | |
-chardev socket,id=char0,path=./vhostqemu \ | |
-device vhost-user-fs-pci,queue-size=1024,chardev=char0,tag=root \ | |
-object memory-backend-file,id=mem,size=1G,mem-path=/dev/shm,share=on -numa node,memdev=mem \ | |
-initrd target/x86_64-unknown-hermit/debug/rusty_demo | |
- name: Build release profile | |
run: cargo build -Zbuild-std=std,panic_abort --package rusty_demo --target x86_64-unknown-hermit --release --features pci-ids | |
- name: Test release profile | |
run: | | |
mkdir -p foo | |
virtiofsd --socket-path=./vhostqemu --shared-dir ./foo --announce-submounts --sandbox none --seccomp none --inode-file-handles=never & | |
qemu-system-x86_64 -display none -smp 1 -m 1G -serial stdio \ | |
-cpu qemu64,apic,fsgsbase,rdtscp,xsave,xsaveopt,fxsr \ | |
-device isa-debug-exit,iobase=0xf4,iosize=0x04 \ | |
-kernel rusty-loader-x86_64 \ | |
-chardev socket,id=char0,path=./vhostqemu \ | |
-device vhost-user-fs-pci,queue-size=1024,chardev=char0,tag=root \ | |
-object memory-backend-file,id=mem,size=1G,mem-path=/dev/shm,share=on -numa node,memdev=mem \ | |
-initrd target/x86_64-unknown-hermit/release/rusty_demo | |
- name: Build httpd with DHCP support (debug, rtl8139) | |
run: cargo build -Zbuild-std=std,panic_abort --target x86_64-unknown-hermit --package httpd --features ci,dhcpv4,rtl8139 | |
- name: Test httpd with DHCP support (debug, rtl8139) | |
run: | | |
qemu-system-x86_64 -smp 1 -cpu qemu64,apic,fsgsbase,rdtscp,xsave,xsaveopt,fxsr,rdrand \ | |
-device isa-debug-exit,iobase=0xf4,iosize=0x04 -display none -m 128M -serial stdio \ | |
-kernel rusty-loader-x86_64 \ | |
-initrd target/x86_64-unknown-hermit/debug/httpd \ | |
-netdev user,id=u1,hostfwd=tcp::9975-:9975,net=192.168.76.0/24,dhcpstart=192.168.76.9 \ | |
-device rtl8139,netdev=u1 & | |
sleep 5 | |
curl http://127.0.0.1:9975/help | |
sleep 1 | |
- name: Build httpd with DHCP support (debug, virtio-net) | |
run: cargo build -Zbuild-std=std,panic_abort --target x86_64-unknown-hermit --package httpd --features ci,dhcpv4 | |
- name: Test httpd with DHCP support (debug, virtio-net) | |
run: | | |
qemu-system-x86_64 -smp 1 -cpu qemu64,apic,fsgsbase,rdtscp,xsave,xsaveopt,fxsr,rdrand \ | |
-device isa-debug-exit,iobase=0xf4,iosize=0x04 -display none -m 512M -serial stdio \ | |
-kernel rusty-loader-x86_64 \ | |
-initrd target/x86_64-unknown-hermit/debug/httpd \ | |
-netdev user,id=u1,hostfwd=tcp::9975-:9975,net=192.168.76.0/24,dhcpstart=192.168.76.9 \ | |
-device virtio-net-pci,netdev=u1,disable-legacy=on & | |
sleep 5 | |
curl http://127.0.0.1:9975/help | |
sleep 1 | |
- name: Build httpd with DHCP support (release, rtl8139) | |
run: cargo build -Zbuild-std=std,panic_abort --target x86_64-unknown-hermit --package httpd --release --features ci,dhcpv4,rtl8139 | |
- name: Test httpd with DHCP support (release, rtl8139) | |
run: | | |
qemu-system-x86_64 -smp 1 -cpu qemu64,apic,fsgsbase,rdtscp,xsave,xsaveopt,fxsr,rdrand \ | |
-device isa-debug-exit,iobase=0xf4,iosize=0x04 -display none -m 128M -serial stdio \ | |
-kernel rusty-loader-x86_64 \ | |
-initrd target/x86_64-unknown-hermit/release/httpd \ | |
-netdev user,id=u1,hostfwd=tcp::9975-:9975,net=192.168.76.0/24,dhcpstart=192.168.76.9 \ | |
-device rtl8139,netdev=u1 & | |
sleep 5 | |
curl http://127.0.0.1:9975/help | |
sleep 1 | |
- name: Build httpd with DHCP support (release, virtio-net) | |
run: cargo build -Zbuild-std=std,panic_abort --target x86_64-unknown-hermit --package httpd --release --features ci,dhcpv4 | |
- name: Test httpd with DHCP support (release, virtio-net) | |
run: | | |
qemu-system-x86_64 -smp 1 -cpu qemu64,apic,fsgsbase,rdtscp,xsave,xsaveopt,fxsr,rdrand \ | |
-device isa-debug-exit,iobase=0xf4,iosize=0x04 -display none -m 512M -serial stdio \ | |
-kernel rusty-loader-x86_64 \ | |
-initrd target/x86_64-unknown-hermit/release/httpd \ | |
-netdev user,id=u1,hostfwd=tcp::9975-:9975,net=192.168.76.0/24,dhcpstart=192.168.76.9 \ | |
-device virtio-net-pci,netdev=u1,disable-legacy=on & | |
sleep 5 | |
curl http://127.0.0.1:9975/help | |
sleep 1 | |
- name: Build minimal profile | |
run: cargo build -Zbuild-std=std,panic_abort --target x86_64-unknown-hermit --no-default-features --release --package hello_world | |
- name: Test minimal profile | |
run: | | |
FREQ=`grep 'cpu MHz' /proc/cpuinfo | head -1 | awk -F: '{print $2}' | awk '{printf("%d\n",$1 + 0.5)}'` | |
echo "FREQ = $FREQ" | |
qemu-system-x86_64 \ | |
-M microvm,x-option-roms=off,pit=off,pic=off,rtc=on \ | |
-global virtio-mmio.force-legacy=on -nodefaults -no-user-config \ | |
-display none -smp 1 -m 64M -serial stdio \ | |
-kernel rusty-loader-x86_64 \ | |
-initrd target/x86_64-unknown-hermit/release/hello_world \ | |
-cpu qemu64,apic,fsgsbase,rdtscp,xsave,xsaveopt,fxsr \ | |
-device isa-debug-exit,iobase=0xf4,iosize=0x04 \ | |
-append "-freq $FREQ" \ | |
|| qemu_status=$? | |
test $qemu_status -eq 3 | |
- name: Build udp tests (debug, virtio-net) | |
run: cargo build -Zbuild-std=std,panic_abort --target x86_64-unknown-hermit --package testudp --features udp,dhcpv4 | |
- name: Test udp profile | |
run: | | |
qemu-system-x86_64 -smp 1 -cpu qemu64,apic,fsgsbase,rdtscp,xsave,xsaveopt,fxsr,rdrand \ | |
-device isa-debug-exit,iobase=0xf4,iosize=0x04 -display none -m 512M -serial stdio \ | |
-kernel rusty-loader-x86_64 \ | |
-initrd target/x86_64-unknown-hermit/debug/testudp \ | |
-netdev user,id=u1,hostfwd=udp::9975-:9975,net=192.168.76.0/24,dhcpstart=192.168.76.9 \ | |
-device virtio-net-pci,netdev=u1,disable-legacy=on & | |
sleep 5 | |
echo "exit" | socat -d -d -d - UDP:localhost:9975 | |
- name: Build udp tests (release, virtio-net) | |
run: cargo build -Zbuild-std=std,panic_abort --release --target x86_64-unknown-hermit --package testudp --features udp,dhcpv4 | |
- name: Test udp profile | |
run: | | |
qemu-system-x86_64 -smp 1 -cpu qemu64,apic,fsgsbase,rdtscp,xsave,xsaveopt,fxsr,rdrand \ | |
-device isa-debug-exit,iobase=0xf4,iosize=0x04 -display none -m 512M -serial stdio \ | |
-kernel rusty-loader-x86_64 \ | |
-initrd target/x86_64-unknown-hermit/release/testudp \ | |
-netdev user,id=u1,hostfwd=udp::9975-:9975,net=192.168.76.0/24,dhcpstart=192.168.76.9 \ | |
-device virtio-net-pci,netdev=u1,disable-legacy=on & | |
sleep 5 | |
echo "exit" | socat -d -d -d - UDP:localhost:9975 | |
run-aarch64: | |
name: Run Hermit for Rust (aarch64) | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout hermit-rs | |
uses: actions/checkout@v4 | |
with: | |
repository: hermitcore/hermit-rs | |
submodules: true | |
- name: Remove hermit-kernel submodule | |
run: git rm -r kernel | |
- name: Checkout hermit-kernel | |
uses: actions/checkout@v4 | |
with: | |
path: kernel | |
- name: Download loader | |
uses: dsaltares/fetch-gh-release-asset@master | |
with: | |
repo: hermitcore/rusty-loader | |
file: rusty-loader-aarch64 | |
- uses: mkroening/rust-toolchain-toml@main | |
- uses: mkroening/rust-toolchain-toml@main | |
with: | |
toolchain-file: 'kernel/rust-toolchain.toml' | |
- name: Install QEMU | |
run: | | |
sudo apt-get update | |
sudo apt-get install qemu-system-aarch64 | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
workspaces: | | |
. | |
kernel | |
kernel/hermit-builtins | |
- name: Build dev profile | |
run: cargo build -Zbuild-std=std,panic_abort --target aarch64-unknown-hermit --package rusty_demo --features pci-ids | |
- name: Test dev kernel | |
run: | | |
qemu-system-aarch64 -semihosting \ | |
-kernel rusty-loader-aarch64 -machine virt,gic-version=3 \ | |
-m 512M -cpu cortex-a72 -smp 1 -display none -serial stdio \ | |
-device guest-loader,addr=0x48000000,initrd=target/aarch64-unknown-hermit/debug/rusty_demo | |
- name: Build release profile | |
run: cargo build -Zbuild-std=std,panic_abort --target aarch64-unknown-hermit --package rusty_demo --release --features pci-ids | |
- name: Test release kernel | |
run: | | |
qemu-system-aarch64 -semihosting \ | |
-kernel rusty-loader-aarch64 -machine virt,gic-version=3 \ | |
-m 512M -cpu cortex-a72 -smp 1 -display none -serial stdio \ | |
-device guest-loader,addr=0x48000000,initrd=target/aarch64-unknown-hermit/release/rusty_demo | |
- name: Build httpd with DHCP support (debug) | |
run: cargo build -Zbuild-std=std,panic_abort --target aarch64-unknown-hermit --package httpd --features ci,dhcpv4 | |
- name: Test httpd with DHCP support (debug, virtio-net) | |
run: | | |
qemu-system-aarch64 -semihosting \ | |
-kernel rusty-loader-aarch64 -machine virt,gic-version=3 \ | |
-m 512M -cpu cortex-a72 -smp 1 -display none -serial stdio \ | |
-device guest-loader,addr=0x48000000,initrd=target/aarch64-unknown-hermit/debug/httpd \ | |
-netdev user,id=u1,hostfwd=tcp::9975-:9975,net=192.168.76.0/24,dhcpstart=192.168.76.9 \ | |
-device virtio-net-pci,netdev=u1,disable-legacy=on & | |
sleep 5 | |
curl http://127.0.0.1:9975/help | |
sleep 1 | |
- name: Build httpd with DHCP support (release) | |
run: cargo build -Zbuild-std=std,panic_abort --target aarch64-unknown-hermit --package httpd --release --features ci,dhcpv4 | |
- name: Test httpd with DHCP support (release, virtio-net) | |
run: | | |
qemu-system-aarch64 -semihosting \ | |
-kernel rusty-loader-aarch64 -machine virt,gic-version=3 \ | |
-m 512M -cpu cortex-a72 -smp 1 -display none -serial stdio \ | |
-device guest-loader,addr=0x48000000,initrd=target/aarch64-unknown-hermit/release/httpd \ | |
-netdev user,id=u1,hostfwd=tcp::9975-:9975,net=192.168.76.0/24,dhcpstart=192.168.76.9 \ | |
-device virtio-net-pci,netdev=u1,disable-legacy=on & | |
sleep 5 | |
curl http://127.0.0.1:9975/help | |
sleep 1 | |
run-x86_64-kvm: | |
name: Run Hermit for Rust (x86_64 + kvm) | |
runs-on: [self-hosted] | |
steps: | |
- name: Checkout hermit-rs | |
uses: actions/checkout@v4 | |
with: | |
repository: hermitcore/hermit-rs | |
submodules: true | |
- name: Remove hermit-kernel submodule | |
run: git rm -r kernel | |
- name: Checkout hermit-kernel | |
uses: actions/checkout@v4 | |
with: | |
path: kernel | |
- name: Install QEMU, NASM | |
run: | | |
sudo apt-get update | |
sudo apt-get install qemu-system-x86 nasm | |
- name: Check KVM availability | |
shell: bash | |
run: | | |
lscpu | |
kvm-ok | |
- name: Download loader (x86_64) | |
uses: dsaltares/fetch-gh-release-asset@master | |
with: | |
file: rusty-loader-x86_64 | |
repo: hermitcore/rusty-loader | |
- name: Download loader (x86_64-fc) | |
uses: dsaltares/fetch-gh-release-asset@master | |
with: | |
file: rusty-loader-x86_64-fc | |
repo: hermitcore/rusty-loader | |
- name: Install firecracker | |
run: | | |
# https://github.com/firecracker-microvm/firecracker/blob/7c5fc8707f26c4244d48a747631ab0fb31fc4c39/docs/getting-started.md#getting-a-firecracker-binary | |
ARCH="$(uname -m)" | |
release_url="https://github.com/firecracker-microvm/firecracker/releases" | |
latest=$(basename $(curl -fsSLI -o /dev/null -w %{url_effective} ${release_url}/latest)) | |
curl -L ${release_url}/download/${latest}/firecracker-${latest}-${ARCH}.tgz \ | |
| tar -xz | |
# Rename the binary to "firecracker" | |
mv release-${latest}-$(uname -m)/firecracker-${latest}-${ARCH} firecracker | |
echo "$PWD" >> $GITHUB_PATH | |
- uses: dtolnay/rust-toolchain@stable | |
- run: cargo install uhyve | |
- uses: mkroening/rust-toolchain-toml@main | |
- uses: mkroening/rust-toolchain-toml@main | |
with: | |
toolchain-file: 'kernel/rust-toolchain.toml' | |
- uses: Swatinem/rust-cache@v2 | |
- name: Build dev profile | |
run: cargo build -Zbuild-std=std,panic_abort --package rusty_demo --target x86_64-unknown-hermit | |
- 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 rusty-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 rusty-loader-x86_64 \ | |
-initrd target/x86_64-unknown-hermit/release/rusty_demo | |
- name: Build minimal profile (debug) | |
run: cargo build -Zbuild-std=std,panic_abort --target x86_64-unknown-hermit --no-default-features --package hello_world | |
- name: Test debug profile (Firecracker) | |
run: firecracker --no-api --config-file ./kernel/fc-config.json |