Skip to content

Commit

Permalink
Update main.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
trollLemon committed Aug 28, 2023
1 parent 6309940 commit e6c61d3
Showing 1 changed file with 32 additions and 32 deletions.
64 changes: 32 additions & 32 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
name: Rust
name: Rust Code Coverage

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

env:
CARGO_TERM_COLOR: always
branches:
- main # Customize this to your main branch name

jobs:
build:

coverage:
name: Generate and Upload Code Coverage
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
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'
- name: Codecov
# You may pin to the exact commit or the version.
# uses: codecov/codecov-action@81cd2dc8148241f03f5839d295e000b8f761e378
uses: codecov/codecov-action@v3
with:
# Repository upload token - get it from codecov.io. Required only for private repositories
# token: # optional
# Specify whether the Codecov output should be verbose
verbose: true
fail_ci_if_error: true
- name: Checkout Repository
uses: actions/checkout@v2

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true

- name: Install grcov
run: cargo install grcov

- name: Build and Test with Coverage
run: |
RUSTFLAGS="-Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort" \
cargo test --no-fail-fast
- name: Generate lcov.info
run: |
grcov . -s . --binary-path ./target/debug/ -t lcov --ignore "/*" -o lcov.info
- name: Upload to Codecov
uses: codecov/codecov-action@v3
with:
files: ./lcov.info
# Add your Codecov token as a secret in your repository
token: ${{ secrets.CODECOV_TOKEN }}

0 comments on commit e6c61d3

Please sign in to comment.