CI/CD
This chapter covers the CI/CD pipelines configured for the OAuth2-Passkey project using GitHub Actions.
Overview
The project has three GitHub Actions workflows:
| Workflow | File | Purpose |
|---|---|---|
| CI | ci.yml | Testing, linting, security audit |
| Coverage | coverage.yml | Code coverage reporting |
| Documentation | docs.yml | GitHub Pages deployment |
CI Workflow
The main CI workflow (.github/workflows/ci.yml) runs on every push and pull request to master and develop branches.
Jobs
Test Suite
Runs tests across multiple Rust versions:
| Version | Required | Purpose |
|---|---|---|
| stable | Yes | Primary testing target |
| beta | No (can fail) | Early warning for upcoming changes |
| nightly | No (can fail) | Bleeding edge compatibility |
Steps performed (stable only):
- Check formatting (
cargo fmt --all -- --check) - Run clippy (
cargo clippy --all-targets --all-features)
Steps performed (all versions):
- Build core library (
oauth2_passkey) - Build Axum integration (
oauth2_passkey_axum) - Test core library
- Test Axum integration (with all features)
- Test Axum integration (with no default features)
Security Audit
Runs cargo audit to check for known vulnerabilities in dependencies.
- name: Run security audit
run: cargo audit --ignore RUSTSEC-2023-0071
The --ignore flag excludes known advisories that have been reviewed and accepted.
Documentation Build
Verifies that rustdoc builds without warnings:
- name: Build documentation
run: |
cargo doc --no-deps --manifest-path oauth2_passkey/Cargo.toml
cargo doc --no-deps --manifest-path oauth2_passkey_axum/Cargo.toml --all-features
env:
RUSTDOCFLAGS: "-D warnings"
MSRV Check
Verifies compatibility with the Minimum Supported Rust Version (currently 1.88):
- name: Install Rust 1.88
uses: dtolnay/rust-toolchain@stable
with:
toolchain: "1.88"
- name: Check MSRV compatibility
run: |
cargo check --manifest-path oauth2_passkey/Cargo.toml
cargo check --manifest-path oauth2_passkey_axum/Cargo.toml --all-features
Coverage Workflow
The coverage workflow (.github/workflows/coverage.yml) generates code coverage reports on pushes and pull requests to master.
How It Works
-
Generate Coverage: Uses
cargo-llvm-covto run tests with coverage instrumentation- name: Generate coverage report run: cargo llvm-cov --all-features --workspace --lcov --output-path lcov.info -
Upload to Codecov: Sends coverage data to Codecov for tracking and visualization
- name: Upload coverage to Codecov uses: codecov/codecov-action@v4 -
Archive Report: Saves the coverage report as a GitHub artifact (retained for 30 days)
Viewing Coverage
- Codecov Dashboard: View coverage trends and file-level details at codecov.io
- GitHub Artifacts: Download
lcov.infofrom the workflow run’s artifact section
Documentation Workflow
The documentation workflow (.github/workflows/docs.yml) deploys the mdBook documentation to GitHub Pages.
Deployment URL
The documentation is published at:
https://ktaka-ccmp.github.io/oauth2-passkey/
This URL follows GitHub’s standard naming convention:
https://{username}.github.io/{repository-name}/
This is a fixed GitHub Pages specification and cannot be changed (unless you configure a custom domain).
Triggers
on:
push:
branches:
- master
paths:
- 'docs/**'
- '.github/workflows/docs.yml'
workflow_dispatch:
- Automatic: Push to
masterbranch with changes indocs/directory - Manual: Trigger via
workflow_dispatchfrom GitHub Actions UI
How It Works
-
Build Step: mdBook compiles the documentation from
docs/src/into static HTML indocs/book/- name: Build documentation run: mdbook build docs -
Upload Step: The generated
docs/book/directory is uploaded as a GitHub Pages artifact- name: Upload artifact uses: actions/upload-pages-artifact@v3 with: path: 'docs/book' -
Deploy Step: The artifact is deployed to GitHub Pages
- name: Deploy to GitHub Pages uses: actions/deploy-pages@v4
Required GitHub Settings
For this workflow to function, the repository must have GitHub Pages configured:
- Go to Settings → Pages
- Under Source, select GitHub Actions
This enables the actions/deploy-pages action to publish content to GitHub Pages.
Summary
| Workflow | Trigger | Key Outputs |
|---|---|---|
| CI | Push/PR to master, develop | Test results, lint status |
| Coverage | Push/PR to master | Coverage report on Codecov |
| Documentation | Push to master (docs/) | Live site at GitHub Pages |