// This skill should be used when creating or improving GitHub Actions CI/CD workflows for Breenix kernel development. Use for authoring new test workflows, optimizing existing CI pipelines, adding new test types, fixing workflow configuration issues, or adapting workflows for new kernel features.
| name | github-workflow-authoring |
| description | This skill should be used when creating or improving GitHub Actions CI/CD workflows for Breenix kernel development. Use for authoring new test workflows, optimizing existing CI pipelines, adding new test types, fixing workflow configuration issues, or adapting workflows for new kernel features. |
Create and improve GitHub Actions workflows for Breenix OS kernel development and testing.
This skill provides patterns, templates, and best practices for authoring GitHub Actions workflows specifically for Breenix kernel development. It addresses the unique challenges of OS kernel CI/CD: QEMU virtualization, custom Rust targets, userspace binary building, timeout management, and kernel-specific test patterns.
Use this skill when:
Breenix requires specific Rust configuration:
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2025-06-24 # Pinned for consistency
override: true
target: x86_64-unknown-none # Custom kernel target
components: rust-src, llvm-tools-preview
Critical: The Rust nightly version is pinned to avoid unexpected breakage from compiler changes.
All kernel tests require QEMU and supporting tools:
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
qemu-system-x86 \
qemu-utils \
ovmf \
mtools \
dosfstools \
xorriso \
nasm \
lld
CRITICAL: Before running kernel tests that execute userspace code, userspace binaries must be built:
- name: Build userspace tests
run: |
export PATH="$PATH:$(rustc --print sysroot)/lib/rustlib/x86_64-unknown-linux-gnu/bin"
cd userspace/tests
./build.sh
Forgetting this step causes kernel tests to fail mysteriously!
Breenix uses the xtask pattern for complex test workflows:
- name: Run Ring-3 smoke test
run: cargo run -p xtask -- ring3-smoke
This handles:
Different workflows need different timeouts:
jobs:
quick-test:
timeout-minutes: 20 # Build + simple smoke test
full-integration:
timeout-minutes: 45 # Complete test suite with shared QEMU
code-quality:
timeout-minutes: 15 # Clippy and static analysis
Rule of thumb: CI environments are 2-3x slower than local development machines. Budget accordingly.
Proper caching reduces build times from ~10 minutes to ~2 minutes:
- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: cargo-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
Cache invalidates when Cargo.lock changes, ensuring fresh builds for dependency updates.
Always upload logs, especially on failure:
- name: Upload logs
if: always() # Run even if previous steps failed
uses: actions/upload-artifact@v4
with:
name: breenix-logs
path: |
logs/*.log
target/xtask_ring3_smoke_output.txt
target/xtask_ring3_enosys_output.txt
if-no-files-found: ignore
retention-days: 7
This enables post-mortem analysis of failed runs.
Runs on every push to provide quick feedback:
name: Ring-3 Smoke Test
on:
push:
branches: [ "**" ]
pull_request:
jobs:
ring3-smoke:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- name: Install Rust
# ... (see above)
- name: Cache cargo
# ... (see above)
- name: Install system dependencies
# ... (see above)
- name: Build userspace tests
# ... (see above)
- name: Run smoke test
run: cargo run -p xtask -- ring3-smoke
- name: Upload logs
if: always()
# ... (see above)
Purpose: Verify basic kernel functionality (boot, userspace execution) quickly.
Runs on kernel code changes:
name: Code Quality
on:
push:
paths:
- 'kernel/**'
- '.github/workflows/code-quality.yml'
jobs:
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
with:
components: clippy, rust-src
- name: Run Clippy
run: |
cd kernel
cargo clippy --target x86_64-unknown-none \
-- -Dclippy::debug_assert_with_mut_call
Purpose: Catch code quality issues before they reach main branch.
For tests that take too long to run on every commit:
name: Full Integration Tests
on:
workflow_dispatch: # Only run manually
jobs:
integration:
timeout-minutes: 45
# ... full test suite
Purpose: Comprehensive testing before releases or major merges.
The skill includes reference material in the references/ directory:
breenix-ci-patterns.md: Comprehensive CI patterns, timeout strategies, caching, success signalsTo reference these during workflow authoring:
cat github-workflow-authoring/references/breenix-ci-patterns.md
When creating a new workflow:
ring3-smoke.yml or code-quality.ymlCause: Rust toolchain not installed or wrong action version
Fix: Use actions-rs/toolchain@v1 or dtolnay/rust-toolchain
Cause: Missing custom target
Fix: Add target: x86_64-unknown-none to toolchain setup
bootloader"Cause: Missing rust-src component
Fix: Add rust-src to components list
Cause: QEMU not installed in CI environment Fix: Add qemu-system-x86 to apt-get install list
Cause: CI environment slower, or test hung Fix: Increase timeout-minutes or investigate kernel hang
Cause: Cache key collision or partial build artifacts Fix: Change cache key (add version suffix) or clear cache
Cause: Userspace binaries not built before kernel test Fix: Add userspace build step before kernel test runs
Test multiple configurations:
strategy:
matrix:
mode: [uefi, bios]
features: [testing, production]
steps:
- run: cargo run --bin qemu-${{ matrix.mode }} --features ${{ matrix.features }}
Skip steps based on conditions:
- name: Upload logs
if: failure() # Only on failure
# or
if: always() # Always run
# or
if: success() # Only on success
env:
CI: true
RUST_BACKTRACE: full
BREENIX_TIMEOUT: 60 # Used by xtask
When adding new kernel features that require CI testing:
ring3-fork-test)Let's say you want to add CI for testing the fork() syscall:
name: Fork System Call Test
on:
push:
paths:
- 'kernel/src/process/**'
- 'kernel/src/syscall/**'
- 'userspace/tests/fork_test*'
jobs:
fork-test:
runs-on: ubuntu-latest
timeout-minutes: 25
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: nightly-2025-06-24
override: true
target: x86_64-unknown-none
components: rust-src, llvm-tools-preview
- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: cargo-${{ runner.os }}-fork-${{ hashFiles('**/Cargo.lock') }}
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y qemu-system-x86 ovmf nasm
- name: Build userspace tests
run: |
export PATH="$PATH:$(rustc --print sysroot)/lib/rustlib/x86_64-unknown-linux-gnu/bin"
cd userspace/tests
./build.sh
- name: Run fork test
run: cargo run -p xtask -- fork-test
- name: Upload logs
if: always()
uses: actions/upload-artifact@v4
with:
name: fork-test-logs
path: |
logs/*.log
target/xtask_fork_test_output.txt
retention-days: 7
Then update xtask/src/main.rs:
#[derive(StructOpt)]
enum Cmd {
Ring3Smoke,
Ring3Enosys,
ForkTest, // New test
}
fn main() -> Result<()> {
match Cmd::from_args() {
Cmd::Ring3Smoke => ring3_smoke(),
Cmd::Ring3Enosys => ring3_enosys(),
Cmd::ForkTest => fork_test(),
}
}
fn fork_test() -> Result<()> {
// Similar to ring3_smoke but looks for fork-specific signals
// ...
}
When a workflow fails:
GitHub workflow authoring for Breenix requires understanding:
Always reference the existing workflows as templates, test locally before committing, and leverage the xtask pattern for complex test logic.