Skip to content

feat(xtask): add ci subcommand #1529

feat(xtask): add ci subcommand

feat(xtask): add ci subcommand #1529

Workflow file for this run

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: taiki-e/install-action@cargo-hack
- name: Install NASM
run: |
sudo apt-get update
sudo apt-get install nasm
- uses: actions/checkout@v4
- 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:
- name: Install NASM
run: |
sudo apt-get update
sudo apt-get install nasm
- uses: actions/checkout@v4
- 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:
- name: Install NASM
run: |
sudo apt-get update
sudo apt-get install nasm
- uses: actions/checkout@v4
- 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:
- name: Install QEMU, NASM
run: |
sudo apt-get update
sudo apt-get install qemu-system-x86 nasm
- uses: actions/checkout@v4
- 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/[email protected]
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: Install QEMU, NASM
run: |
sudo apt-get update
sudo apt-get install qemu-system-x86 nasm libcap-ng-dev libseccomp-dev socat
- 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
- uses: mkroening/rust-toolchain-toml@main
- uses: Swatinem/rust-cache@v2
- name: Download loader
uses: dsaltares/[email protected]
with:
repo: hermitcore/rusty-loader
file: rusty-loader-x86_64
- name: Install virtiofsd
run: cargo install virtiofsd
- name: rusty_demo with pci-ids and virtiofsd
run: cargo xtask ci qemu --arch x86_64 --package rusty_demo --features pci-ids --virtiofsd
working-directory: ./kernel
- name: rusty_demo with pci-ids and virtiofsd (release)
run: cargo xtask ci qemu --arch x86_64 --package rusty_demo --features pci-ids --virtiofsd --release
working-directory: ./kernel
- name: httpd with virtio-net-pci and dhcpv4
run: cargo xtask ci qemu --arch x86_64 --package httpd --features ci,dhcpv4 --netdev virtio-net-pci
working-directory: ./kernel
- name: httpd with virtio-net-pci and dhcpv4 (release)
run: cargo xtask ci qemu --arch x86_64 --package httpd --features ci,dhcpv4 --netdev virtio-net-pci --release
working-directory: ./kernel
- name: httpd with rtl8139 and dhcpv4
run: cargo xtask ci qemu --arch x86_64 --package httpd --features ci,dhcpv4,rtl8139 --netdev rtl8139
working-directory: ./kernel
- name: httpd with rtl8139 and dhcpv4 (release)
run: cargo xtask ci qemu --arch x86_64 --package httpd --features ci,dhcpv4,rtl8139 --netdev rtl8139 --release
working-directory: ./kernel
- name: hello_world on microVM (release)
run: cargo xtask ci qemu --arch x86_64 --package hello_world --no-default-features --microvm --release
working-directory: ./kernel
- name: Test udp profile
run: cargo xtask ci qemu --arch x86_64 --package testudp --features udp,dhcpv4 --netdev virtio-net-pci
working-directory: ./kernel
- name: Test udp profile
run: cargo xtask ci qemu --arch x86_64 --package testudp --features udp,dhcpv4 --netdev virtio-net-pci --release
working-directory: ./kernel
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/[email protected]
with:
repo: hermitcore/rusty-loader
file: rusty-loader-aarch64
- uses: mkroening/rust-toolchain-toml@main
- name: Install QEMU
run: |
sudo apt-get update
sudo apt-get install qemu-system-aarch64
- uses: Swatinem/rust-cache@v2
- name: rusty_demo with pci-ids
run: cargo xtask ci qemu --arch aarch64 --package rusty_demo --features pci-ids
working-directory: ./kernel
- name: rusty_demo with pci-ids (release)
run: cargo xtask ci qemu --arch aarch64 --package rusty_demo --features pci-ids --release
working-directory: ./kernel
- name: httpd with dhcpv4
run: cargo xtask ci qemu --arch aarch64 --package httpd --features ci,dhcpv4 --netdev virtio-net-pci
working-directory: ./kernel
# FIXME: Make test less flaky and remove continue-on-error
continue-on-error: true
- name: httpd with dhcpv4 (release)
run: cargo xtask ci qemu --arch aarch64 --package httpd --features ci,dhcpv4 --netdev virtio-net-pci --release
working-directory: ./kernel
# FIXME: Make test less flaky and remove continue-on-error
continue-on-error: true