test(add): add some test case to test codecov #20
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
push: | |
branches: [main] | |
name: main | |
jobs: | |
test: | |
name: Test Suite | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v2 | |
- name: Install stable toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: stable | |
override: true | |
- name: Build | |
env: | |
RUSTFLAGS: -Cinstrument-coverage | |
run: cargo build | |
- name: Test | |
env: | |
LLVM_PROFILE_FILE: grcov-%p-%m.profraw | |
RUSTFLAGS: -Cinstrument-coverage | |
run: cargo test | |
- name: Generate coverage | |
run: | | |
cargo install grcov | |
grcov $(find . -name "grcov-*.profraw" -print) \ | |
--branch \ | |
--ignore-not-existing \ | |
--binary-path ./target/debug/ \ | |
-s . \ | |
-t lcov \ | |
--ignore "/*" \ | |
-o lcov.info | |
- name: Upload to CodeCov | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: ./lcov.info | |
fail_ci_if_error: true |