-
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: cache cargo binaries and install grcov from cargo
Ref: actions-rs/grcov#105
- Loading branch information
1 parent
bbc82fe
commit da5c7d7
Showing
1 changed file
with
18 additions
and
22 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 |
---|---|---|
|
@@ -26,6 +26,11 @@ jobs: | |
with: | ||
path: ~/.cargo/git | ||
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} | ||
- name: Cache cargo binaries | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.cargo/bin | ||
key: ${{ runner.os }}-cargo-bin-${{ hashFiles('**/Cargo.lock') }} | ||
- name: Cache cargo build | ||
uses: actions/cache@v3 | ||
with: | ||
|
@@ -46,33 +51,24 @@ jobs: | |
command: build | ||
args: --release | ||
env: | ||
CARGO_INCREMENTAL: '0' | ||
RUSTFLAGS: '-Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cinstrument-coverage' | ||
RUSTDOCFLAGS: '-Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cinstrument-coverage' | ||
CARGO_INCREMENTAL: "0" | ||
RUSTFLAGS: "-Cinstrument-coverage" | ||
RUSTDOCFLAGS: "-Cinstrument-coverage" | ||
- name: Test | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: test | ||
args: --all-features --no-fail-fast | ||
env: | ||
CARGO_INCREMENTAL: '0' | ||
RUSTFLAGS: '-Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cinstrument-coverage' | ||
RUSTDOCFLAGS: '-Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Cinstrument-coverage' | ||
- name: Download grcov | ||
run: | | ||
set -eux; | ||
mkdir -p "${HOME}/.local/bin" | ||
curl -sL https://github.com/mozilla/grcov/releases/download/v0.8.13/grcov-x86_64-unknown-linux-gnu.tar.bz2 | tar jxf - -C "${HOME}/.local/bin" | ||
echo "$HOME/.local/bin" >> $GITHUB_PATH | ||
- name: grcov | ||
id: coverage | ||
run: | | ||
set -eux; | ||
grcov . --binary-path ./target/debug/deps/ -s . -t lcov --branch --ignore-not-existing --ignore '../*' --ignore "/*" -o ./lcov.info | ||
echo "report=./lcov.info" >> $GITHUB_OUTPUT | ||
#uses: actions-rs/[email protected] | ||
CARGO_INCREMENTAL: "0" | ||
RUSTFLAGS: "-Cinstrument-coverage" | ||
RUSTDOCFLAGS: "-Cinstrument-coverage" | ||
- name: Install grcov | ||
run: if [[ ! -e ~/.cargo/bin/grcov ]]; then cargo install grcov; fi | ||
- name: Run grcov | ||
run: grcov . --binary-path target/debug/deps/ -s . -t lcov --branch --ignore-not-existing --ignore '../**' --ignore '/*' -o coverage.lcov | ||
- uses: codecov/codecov-action@v3 | ||
with: | ||
files: ${{ steps.coverage.outputs.report }} | ||
flags: rust | ||
fail_ci_if_error: true # optional (default = false) | ||
files: ./coverage.lcov | ||
flags: rust | ||
fail_ci_if_error: true # optional (default = false) |