forked from TabbyML/tabby
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add coverage for rust test (TabbyML#1411)
* add rust coverage * add coverage * update * update
- Loading branch information
Showing
1 changed file
with
48 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
@@ -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 |