Skip to content

Commit

Permalink
test: add coverage for rust test (TabbyML#1411)
Browse files Browse the repository at this point in the history
* add rust coverage

* add coverage

* update

* update
  • Loading branch information
wsxiaoys authored Feb 8, 2024
1 parent 5d3a235 commit 8ac3f45
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/test-rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:
tests:
runs-on: ubuntu-latest
env:
CARGO_TERM_COLOR: always
SCCACHE_GHA_ENABLED: true
RUSTC_WRAPPER: sccache
CARGO_INCREMENTAL: 0
Expand Down Expand Up @@ -60,3 +61,50 @@ jobs:

- name: Run unit tests
run: cargo test --bin tabby --lib

coverage:
runs-on: ubuntu-latest
env:
CARGO_TERM_COLOR: always
SCCACHE_GHA_ENABLED: true
RUSTC_WRAPPER: sccache
CARGO_INCREMENTAL: 0
steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}

- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov

- name: Sccache cache
uses: mozilla-actions/[email protected]
with:
version: "v0.4.0"

- name: Cargo registry cache
uses: actions/cache@v3
with:
key: cargo-${{ runner.os }}-${{ hashFiles('**/Cargo.toml') }}-${{ github.sha }}
restore-keys: |
cargo-${{ runner.os }}-${{ hashFiles('**/Cargo.toml') }}-
cargo-${{ runner.os }}-
path: |
~/.cargo/registry
~/.cargo/git
- run: bash ./ci/prepare_build_environment.sh

- name: Generate code coverage
run: cargo llvm-cov --bin tabby --lib --lcov --output-path lcov.info

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: lcov.info
fail_ci_if_error: true

0 comments on commit 8ac3f45

Please sign in to comment.