name: CI
on: [push, pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
RUSTFLAGS: -Dwarnings
RUSTDOCFLAGS: -Dwarnings
jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install | Toolchain
uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
- name: Build | Cargo
run: cargo build --all-targets
- name: Lint | Clippy
run: cargo clippy --all-targets -- -Wclippy::all -Wclippy::cargo
- name: Check | Formatting
run: cargo fmt --check
- name: Test | Cargo
run: cargo test
- name: Check | Docs
run: cargo doc --no-deps
- name: Lint | ShellCheck
run: shellcheck pre-commit.sh
msrv:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install | Toolchain
uses: dtolnay/rust-toolchain@1.54
- name: Build | Cargo
run: cargo build --all-targets
- name: Test | Cargo
run: cargo test
docs:
runs-on: ubuntu-latest
needs: ci
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
permissions:
contents: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/checkout@v4
- name: Install | Toolchain
uses: dtolnay/rust-toolchain@stable
- name: Build | Documentation
run: |
cargo doc --all-features --package=dropclock
echo '<meta http-equiv="refresh" content="0; url=dropclock/index.html">' > target/doc/index.html
- name: Setup | Pages
uses: actions/configure-pages@v4
- name: Upload | Artifact
uses: actions/upload-pages-artifact@v3
with:
path: "target/doc"
- name: Deploy | Pages
id: deployment
uses: actions/deploy-pages@v4