Format code with cargo fmt #74
This file contains hidden or 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: | |
| branches: [main] | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| check: | |
| name: Check & Test | |
| runs-on: self-hosted | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: rustfmt, clippy | |
| - name: Install protoc | |
| run: sudo apt-get update && sudo apt-get install -y protobuf-compiler | |
| - name: Cache cargo | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/bin/ | |
| ~/.cargo/registry/index/ | |
| ~/.cargo/registry/cache/ | |
| ~/.cargo/git/db/ | |
| target/ | |
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
| - name: Check formatting | |
| run: cargo fmt --all -- --check | |
| # Use native target for clippy (avoids musl cross-compilation toolchain) | |
| - name: Clippy | |
| run: cargo clippy --workspace --target x86_64-unknown-linux-gnu -- -D warnings | |
| # Use native target for tests (sudo needed for TUN/TAP tests) | |
| - name: Test | |
| run: | | |
| sudo -E cargo test --workspace --target x86_64-unknown-linux-gnu | |
| sudo chown -R $(id -u):$(id -g) target/ | |
| build: | |
| name: Build ISO | |
| runs-on: self-hosted | |
| needs: check | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Build with Docker | |
| run: make docker | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: build-artifacts | |
| path: | | |
| mvirt-uos/target/mvirt-uos.efi | |
| target/x86_64-unknown-linux-musl/release/mvirt | |
| target/x86_64-unknown-linux-musl/release/mvirt-vmm | |
| retention-days: 7 |