Skip to content

CI

CI #148

Workflow file for this run

name: CI
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main ]
schedule:
- cron: '0 0 * * *' # Run nightly to catch regressions
permissions:
contents: write
pages: write
id-token: write
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
# TODO:
# 1. Add Clippy
# 2. Add mock Funderberker testing
# 3. Add feature testing
jobs:
unit_tests:
name: Unit Test Individual Crates
runs-on: ubuntu-latest
strategy:
matrix:
crate: [kernel, drivers, hypervisor, logger, macros, pmm, scheduler, slab, utils]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
key: crate-${{ matrix.crate }}
toolchain: nightly
- name: Test ${{ matrix.crate }}
run: cargo test -p ${{ matrix.crate }} --verbose
formatting:
name: Check Formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
toolchain: nightly
- uses: Swatinem/rust-cache@v2
- name: Check formatting
run: cargo fmt --all -- --check
docs_tests:
name: Documentation Testing
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
with:
toolchain: nightly
- uses: Swatinem/rust-cache@v2
- name: Run doc tests
run: cargo test --workspace --doc --verbose
linting:
name: Linting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
with:
toolchain: nightly
- uses: Swatinem/rust-cache@v2
- name: Run Cargo Check
run: |
cargo check
documentation:
name: Generate Documentation
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
needs: [unit_tests, formatting, docs_tests, linting]
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
with:
toolchain: nightly
- uses: Swatinem/rust-cache@v2
with:
key: docs
- name: Generate documentation
run: |
cargo doc --workspace --no-deps --all-features
echo '<meta http-equiv="refresh" content="0; url=kernel">' > target/doc/index.html
- name: Upload documentation artifacts
uses: actions/upload-pages-artifact@v3
with:
path: target/doc
deploy_docs:
name: Deploy Documentation to GitHub Pages
runs-on: ubuntu-latest
needs: documentation
if: github.ref == 'refs/heads/main'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4