Skip to content

Commit

Permalink
Add code coverage (via tarpaulin)
Browse files Browse the repository at this point in the history
  • Loading branch information
measure-fi committed Nov 30, 2022
1 parent e0e54ff commit 2e3f243
Show file tree
Hide file tree
Showing 4 changed files with 215 additions and 137 deletions.
30 changes: 5 additions & 25 deletions .github/workflows/Basic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,8 @@ jobs:
target: wasm32-unknown-unknown
override: true

- name: Run unit tests
uses: actions-rs/cargo@v1
with:
command: unit-test
args: --locked
env:
RUST_BACKTRACE: 1
- run: cargo check --verbose --locked --all-targets
- run: cargo test --verbose --locked --no-fail-fast

- name: Compile WASM contract
uses: actions-rs/cargo@v1
Expand All @@ -51,24 +46,9 @@ jobs:
toolchain: stable
override: true
components: rustfmt, clippy

- name: Run cargo fmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check

- name: Run cargo clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: -- -D warnings

- name: Generate Schema
uses: actions-rs/cargo@v1
with:
command: schema
args: --locked
- run: cargo fetch --verbose --locked
- run: cargo clippy --all --all-targets -- -D warnings
- run: cargo fmt --all -- --check

- name: Schema Changes
# fails if any changes not committed
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Coverage

on: [pull_request]

jobs:
coverage:
runs-on: ubuntu-latest
env:
CARGO_TERM_COLOR: always
steps:
- uses: actions/checkout@v3
- name: Install Rust
run: rustup update nightly
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Generate code coverage
run: cargo +nightly llvm-cov --all-features --workspace --lcov --output-path lcov.info
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
files: lcov.info
fail_ci_if_error: true
Loading

0 comments on commit 2e3f243

Please sign in to comment.