Skip to content

feat: add code coverage #570

feat: add code coverage

feat: add code coverage #570

Workflow file for this run

name: Linting and Testing
on:
push:
pull_request:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
check:
permissions:
pull-requests: write
id-token: write
pages: write
checks: write
contents: write
runs-on: ubuntu-24.04-8core-bakunin
steps:
- uses: actions/checkout@v4
- name: Setup Rust cache
uses: Swatinem/rust-cache@v2
- name: Install Rust toolchain
run: |
rustup set profile minimal
rustup show
- name: Ensure Rust formatting
uses: actions-rs/cargo@v1
with:
command: fmt
args: -- --check
- name: Install Protoc
uses: arduino/setup-protoc@v1
with:
version: 3.20.1
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Check Clippy errors
uses: actions-rs/clippy-check@v1
env:
SKIP_WASM_BUILD: 1
with:
args: --color=always --tests -- -D warnings
token: ${{ secrets.GITHUB_TOKEN }}
# - name: Run tests
# env:
# RUST_BACKTRACE: 1
# SKIP_WASM_BUILD: 1
# run: cargo test
- uses: jwalton/gh-find-current-pr@v1
id: findPr
- name: Install cargo-llvm-cov
if: success() && steps.findPr.outputs.number
uses: taiki-e/install-action@cargo-llvm-cov
- name: Install cargo-xtask
if: success() && steps.findPr.outputs.number
run: cargo install cargo-xtask
- name: Generate code coverage
if: success() && steps.findPr.outputs.number
run: cargo xtask coverage
env:
RUST_BACKTRACE: 1
SKIP_WASM_BUILD: 1
- name: Generate coverage summary report
if: success() && steps.findPr.outputs.number
uses: irongut/[email protected]
with:
filename: target/cov.xml
badge: true
format: markdown
hide_branch_rate: false
hide_complexity: true
indicators: true
output: both
- name: Add coverage PR report comment
if: success() && steps.findPr.outputs.number
uses: marocchino/sticky-pull-request-comment@v2
with:
header: report
number: ${{ steps.findPr.outputs.pr }}
recreate: true
path: code-coverage-results.md