CI improvements #5
Workflow file for this run
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: [pull_request, create] | ||
| jobs: | ||
| build: | ||
| if: github.event_name == 'pull_request' | ||
| name: Code Quality (fmt, clippy, clang-format) | ||
| strategy: | ||
| matrix: | ||
| include: | ||
| # Just format/clippy jobs | ||
| - os: linux | ||
| arch: x86_64 | ||
| features: "" | ||
| - os: linux | ||
| arch: x86_64 | ||
| features: "amd-sev" | ||
| - os: linux | ||
| arch: x86_64 | ||
| features: "tdx" | ||
| - os: linux | ||
| arch: x86_64 | ||
| features: "net,blk,gpu,snd" | ||
| - os: linux | ||
| arch: aarch64 | ||
| features: "" | ||
| - os: linux | ||
| arch: aarch64 | ||
| features: "net,blk,gpu,snd" | ||
| - os: macos | ||
| arch: aarch64 | ||
| features: "efi,gpu" | ||
| runs-on: ${{ | ||
| (matrix.os == 'linux' && matrix.arch == 'x86_64') && 'ubuntu-latest' || | ||
| (matrix.os == 'linux' && matrix.arch == 'aarch64') && 'ubuntu-24.04-arm' || | ||
| (matrix.os == 'macos' && matrix.arch == 'aarch64') && 'macos-latest' || | ||
| format('UNSUPPORTED-COMBINATION-{0}-{1}', matrix.os, matrix.arch) | ||
| }} | ||
| env: | ||
| LIBCLANG_PATH: ${{ matrix.os == 'macos' && '/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: | ||
| needs: code-quality-fmt-clippy | ||
| if: github.event_name == 'pull_request' | ||
| name: Unit Tests | ||
| strategy: | ||
| matrix: | ||
| include: | ||
| - os: linux | ||
| arch: x86_64 | ||
| - os: linux | ||
| arch: aarch64 | ||
| - os: macos | ||
| arch: aarch64 | ||
| runs-on: ${{ | ||
| (matrix.os == 'linux' && matrix.arch == 'x86_64') && 'ubuntu-latest' || | ||
| (matrix.os == 'linux' && matrix.arch == 'aarch64') && 'ubuntu-24.04-arm' || | ||
| (matrix.os == 'macos' && matrix.arch == 'aarch64') && 'macos-latest' || | ||
| format('UNSUPPORTED-COMBINATION-{0}-{1}', matrix.os, matrix.arch) | ||
| }} | ||
| env: | ||
| LIBCLANG_PATH: ${{ matrix.os == 'macos' && '/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 | ||