Skip to content

Added codecov configuration #8

Added codecov configuration

Added codecov configuration #8

Workflow file for this run

# This is a basic workflow to help you get started with Actions
name: CI
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "main" branch
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
- name: Build project
run: cargo build --verbose
- name: Run tests
run: cargo test
- name: Run linter
run: cargo clippy -- -D warnings
- name: Generate documentation
run: cargo doc --no-deps --document-private-items
code_coverage:
needs: build
runs-on: ubuntu-latest
if: github.event_name == 'push' || github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v3
- name: Install dependencies
run: sudo apt-get update && sudo apt-get install -y libcurl4-openssl-dev libelf-dev libdw-dev cmake gcc
# Install tarpaulin, a Rust coverage tool
- name: Install cargo-tarpaulin
run: cargo install cargo-tarpaulin
# Run tarpaulin to generate coverage report
- name: Run coverage
run: cargo tarpaulin --out Xml
# Upload coverage report to Codecov
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: ./cobertura.xml # Specify the report generated by tarpaulin
fail_ci_if_error: true
verbose: true
# Display coverage in GitHub PR
- name: Coverage badge
run: |
curl -s https://codecov.io/gh/${{ github.repository }}/branch/${{ github.ref_name }}/graph/badge.svg \
-o coverage-badge.svg