name: Test Coverage
on:
push:
branches: [main, master]
pull_request:
branches: [main, master]
permissions:
contents: write
pages: write
id-token: write
env:
CARGO_TERM_COLOR: always
jobs:
coverage:
name: Generate Test Coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: ๐ฆ Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
components: clippy, rustfmt
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y pkg-config libssl-dev
- name: Install cargo-tarpaulin
uses: actions-rs/install@v0.1
with:
crate: cargo-tarpaulin
version: latest
- name: Cache Cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-coverage-${{ hashFiles('**/Cargo.lock') }}
- name: ๐ฆ Install dependencies
run: cargo fetch
- name: ๐งช Run tests with coverage
run: cargo tarpaulin --verbose --all-features --workspace --timeout 120 --out html
- name: ๐ Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: ./cobertura.xml
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false
docs:
name: Generate Documentation
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: ๐ฆ Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y pkg-config libssl-dev
- name: Cache Cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-docs-${{ hashFiles('**/Cargo.lock') }}
- name: ๐ฆ Install dependencies
run: cargo fetch
- name: ๐ Generate documentation
run: cargo doc --no-deps --all-features
- name: Setup Pages
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
uses: actions/configure-pages@v4
- name: Upload artifact
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
uses: actions/upload-pages-artifact@v3
with:
path: ./target/doc
- name: Deploy to GitHub Pages
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master'
id: deployment
uses: actions/deploy-pages@v4