Skip to content

CI improvements

CI improvements #8

Workflow file for this run

name: ci
on: [pull_request, create]
jobs:
code-quality-fmt-clippy:
if: github.event_name == 'pull_request'
name: Code Quality (fmt, clippy)
strategy:
fail-fast: false
matrix:
include:
# Linux x86_64
- runner: ubuntu-latest
features: ""
- runner: ubuntu-latest
features: "amd-sev"
- runner: ubuntu-latest
features: "tdx"
- runner: ubuntu-latest
features: "net,blk,gpu,snd"
# Linux aarch64
- runner: ubuntu-24.04-arm
features: ""
- runner: ubuntu-24.04-arm
features: "net,blk,gpu,snd"
# macOS aarch64
- runner: macos-latest
features: "efi,gpu"
runs-on: ${{ matrix.runner }}
env:
LIBCLANG_PATH: ${{ matrix.runner == 'macos-latest' && '/opt/homebrew/opt/llvm/lib' || '' }}
steps:
- name: Code checkout
uses: actions/checkout@v4
- name: Setup build environment
uses: ./.github/actions/setup-build-env
- name: Create a fake init
run: touch init/init
# Formatting - only run once per OS+arch combination
- name: Formatting (clang-format)
if: matrix.features == ''
run: find init -iname '*.h' -o -iname '*.c' | xargs clang-format -n -Werror
- name: Formatting (rustfmt)
if: matrix.features == ''
run: cargo fmt -- --check
- name: Clippy
run: |
if [ -z "${{ matrix.features }}" ]; then
cargo clippy --locked -- -D warnings
else
cargo clippy --locked --features ${{ matrix.features }} -- -D warnings
fi
unit-tests:
needs: code-quality-fmt-clippy
if: github.event_name == 'pull_request'
name: Unit Tests
strategy:
matrix:
include:
- runner: ubuntu-latest
- runner: ubuntu-24.04-arm
- runner: macos-latest
runs-on: ${{ matrix.runner }}
env:
LIBCLANG_PATH: ${{ matrix.runner == 'macos-latest' && '/opt/homebrew/opt/llvm/lib' || '' }}
steps:
- name: Code checkout
uses: actions/checkout@v4
- name: Setup build environment
uses: ./.github/actions/setup-build-env
- name: Create a fake init
run: touch init/init
- name: Unit tests
run: cargo test