Skip to content

ci: Update CI and add Code Coverage #425

ci: Update CI and add Code Coverage

ci: Update CI and add Code Coverage #425

Workflow file for this run

name: CI
on:
push:
branches:
- main
- devel
pull_request:
branches:
- main
- devel
jobs:
rust-lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout the source code
uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Run cargo check
uses: actions-rs/cargo@v1
with:
command: check
- name: Run rustfmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: -- --check
- name: Run Clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-features
env:
RUSTFLAGS: -D warnings
test:
name: Test
runs-on: ${{ matrix.os }}
strategy:
matrix:
rust_versions: ["stable", "1.67"]
os: [ubuntu-latest, windows-latest]
steps:
- name: Checkout the source code
uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust_versions }}
- name: Build lib
uses: actions-rs/cargo@v1
with:
command: build
- name: Test lib
uses: actions-rs/cargo@v1
with:
command: test
args: --all-features
env:
RUSTFLAGS: -D warnings
# https://github.com/marketplace/actions/rust-grcov
coverage:
name: Code Coverage
runs-on: ubuntu-latest
steps:
- name: Checkout the source code
uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
- uses: actions-rs/cargo@v1
with:
command: test
args: --all-features --no-fail-fast
env:
CARGO_INCREMENTAL: '0'
RUSTFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests'
RUSTDOCFLAGS: '-Zprofile -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cpanic=abort -Zpanic_abort_tests'
- id: coverage
uses: actions-rs/[email protected]
- name: Coveralls upload
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ${{ steps.coverage.outputs.report }}
features:
name: Test Individual Features
runs-on: ubuntu-latest
steps:
- name: Checkout the source code
uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Install jq
run: |
sudo apt-get install -y --no-install-recommends jq
- name: Test lib
run: |
for feature in $(cargo read-manifest | jq -r '.features|keys|join("\n")'); do
echo building with feature "$feature"
RUSTFLAGS='-D warnings' cargo test --no-default-features --features "$feature"
done
bench:
name: Benchmark the background_rotation feature
runs-on: ubuntu-latest
strategy:
matrix:
rust_versions: ["stable", "1.67"]
steps:
- name: Checkout the source code
uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- name: Bench features
uses: actions-rs/cargo@v1
with:
command: bench
args: --all-features
cargo-audit:
name: Audit the baseline for CVEs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- uses: actions-rs/audit-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
docs-lint:
name: Docs Lint
runs-on: ubuntu-latest
steps:
- name: Markdown Linting Action
uses: avto-dev/markdown-lint@v1
with:
config: .markdownlint.yml
args: docs/Configuration.md README.md