Skip to content

ci: always deploy to gh pages #7

ci: always deploy to gh pages

ci: always deploy to gh pages #7

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: --deny warnings
RUSTDOCFLAGS: --deny warnings
jobs:
# Run tests.
test:
name: Tests
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Install dependencies
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev
- name: Populate target directory from cache
uses: Leafwing-Studios/cargo-cache@v2
- name: Run tests
run: |
cargo test --workspace --all-features --all-targets
# Workaround for https://github.com/rust-lang/cargo/issues/6669
cargo test --workspace --all-features --doc
# Run clippy lints.
clippy:
name: Clippy
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- name: Install dependencies
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev
- name: Populate target directory from cache
uses: Leafwing-Studios/cargo-cache@v2
- name: Run clippy lints
run: cargo clippy --workspace --all-targets --all-features -- --deny warnings
# Check formatting.
format:
name: Format
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- name: Run cargo fmt
run: cargo fmt --all -- --check
# Check documentation.
doc-cargo:
name: Docs
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Install dependencies
run: sudo apt-get update; sudo apt-get install --no-install-recommends libasound2-dev libudev-dev
- name: Populate target directory from cache
uses: Leafwing-Studios/cargo-cache@v2
- name: Check documentation
run: cargo doc --workspace --all-features --document-private-items --no-deps
doc-mkdocs:
name: Mkdocs
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install MkDocs dependencies
run: pip install -r docs/docs-requirements.txt
- name: Build site with MkDocs
run: mkdocs build
- name: Cache static site artifacts
uses: actions/upload-artifact@v3
with:
name: site
path: site
deploy-gh-pages:
name: Deploy to GH Pages
needs: doc-mkdocs
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
# Deploy to the github-pages environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/download-artifact@v3
with:
name: site
path: site
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v2
with:
path: site
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2