name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
pages: write
id-token: write
concurrency:
group: "pages"
cancel-in-progress: false
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: thumbv6m-none-eabi
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Build (no_std default)
run: cargo build --verbose
- name: Build (no_std, bare-metal cross-compile)
run: cargo build --no-default-features --target thumbv6m-none-eabi --verbose
- name: Test (no_std default)
run: cargo test --verbose
- name: Build (alloc feature)
run: cargo build --features alloc --verbose
- name: Test (alloc feature)
run: cargo test --features alloc --verbose
- name: Clippy
run: cargo clippy -- -D warnings
- name: Format check
run: cargo fmt --check
docs:
name: Build and deploy docs
runs-on: ubuntu-latest
needs: test
if: github.ref == 'refs/heads/main'
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Generate API docs (cargo doc)
run: |
cargo doc --no-deps --features alloc
# Move cargo doc output into docs/api/ so Pages serves it alongside the Jekyll site
mkdir -p docs/api
cp -r target/doc/* docs/api/
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Build Jekyll site
uses: actions/jekyll-build-pages@v1
with:
source: ./docs
destination: ./_site
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4