Skip to content

CI

CI #904

Workflow file for this run

name: CI
on:
pull_request:
merge_group:
jobs:
test:
name: Test
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Test
run: |
cargo test --lib
cargo test --bins --examples
cargo test --doc
integration-tests:
name: Integration Tests
runs-on: [self-hosted]
steps:
- name: Install gdb
run: |
sudo apt-get update
sudo apt-get install gdb
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Integration Tests
run: cargo test --test '*'
run_images:
name: Run images
runs-on: [self-hosted]
steps:
- uses: actions/checkout@v4
with:
lfs: true
- run: git lfs checkout
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Run images
run: |
cargo run -- -v data/x86_64/hello_world
cargo run -- -v data/x86_64/hello_c
rusty_demo:
name: rusty_demo
runs-on: [self-hosted]
steps:
- name: Install NASM
run: |
sudo apt-get update
sudo apt-get install nasm
- uses: dtolnay/rust-toolchain@stable
- uses: actions/checkout@v4
with:
path: uhyve
- uses: actions/checkout@v4
with:
repository: hermitcore/hermit-rs
path: hermit-rs
submodules: true
- name: Build rusty_demo
run: cargo build -Zbuild-std=core,alloc,std,panic_abort -Zbuild-std-features=compiler-builtins-mem --target x86_64-unknown-hermit --package rusty_demo
working-directory: hermit-rs
- name: Run rusty_demo
run: RUST_LOG=debug cargo run -- --verbose ../hermit-rs/target/x86_64-unknown-hermit/debug/rusty_demo
working-directory: uhyve
- name: Run rusty_demo
run: RUST_LOG=debug cargo run --release -- --verbose ../hermit-rs/target/x86_64-unknown-hermit/debug/rusty_demo
working-directory: uhyve
fmt:
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# TODO: Remove this, once https://github.com/rust-lang/rustfmt/issues/4991 is resolved
- uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- name: Format
run: cargo fmt --all -- --check
- name: Install rustfmt for Test Kernels
run: rustup component add rustfmt
working-directory: tests/test-kernels
- name: Format Test Kernels
run: cargo fmt --all -- --check
working-directory: tests/test-kernels
clippy:
name: Clippy
runs-on: ${{ matrix.os }}
strategy:
matrix:
arch: [x86_64, aarch64]
os: [ubuntu-latest, macos-latest]
exclude:
- arch: aarch64
os: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Detect target
run: |
case ${{ matrix.os }} in
ubuntu*) suffix=unknown-linux-gnu ;;
macos*) suffix=apple-darwin ;;
esac
echo "target=${{ matrix.arch }}-$suffix" >> $GITHUB_OUTPUT
id: detect_target
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ steps.detect_target.outputs.target }}
- uses: Swatinem/rust-cache@v2
- name: Clippy
run: cargo clippy --all-targets -- -D warnings
clippy-test-kernel:
name: Clippy test-kernels
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Install clippy for Test Kernels
run: rustup component add clippy
working-directory: tests/test-kernels
- uses: Swatinem/rust-cache@v2
- name: Clippy Test Kernels
run: cargo clippy --all-targets -- -D warnings
working-directory: tests/test-kernels
env:
# TODO: Remove once we have a hermit toolchain upgrade
# capable of sparse registries
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: git
coverage:
name: Coverage
runs-on: [self-hosted]
steps:
- name: Install gdb
run: |
sudo apt-get update
sudo apt-get install gdb
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Install cargo-llvm-cov
run: curl -LsSf https://github.com/taiki-e/cargo-llvm-cov/releases/latest/download/cargo-llvm-cov-x86_64-unknown-linux-gnu.tar.gz | tar xzf - -C ~/.cargo/bin
- uses: Swatinem/rust-cache@v2
- name: Generate code coverage
run: cargo llvm-cov --lcov --output-path lcov.info
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: lcov.info