Update ci.yml #38
Workflow file for this run
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
name: CI | |
on: | |
push: | |
branches: [ "cli_ci_cd" ] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
Build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: checkout | |
uses: actions/checkout@v3 | |
- name: cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- name: install toolchain | |
run: rustup toolchain add stable | |
- name: install dependencies | |
run: sudo apt-get update; sudo apt-get install pkg-config libx11-dev libasound2-dev libudev-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev | |
- name: build | |
run: cargo build | |
Test: | |
name: Test | |
needs: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: install toolchain | |
run: rustup add component --component llvm-tools-preview | |
- name: run cargo test | |
env: | |
LLVM_PROFILE_FILE: "target/coverage/grcov-%p-%m.profraw" | |
RUSTFLAGS: -Cinstrument-coverage | |
run: cargo test | |
Test-coverage: | |
name: Test-coverage | |
needs: Test | |
runs-on: ubuntu-latest | |
steps: | |
- name: install grcov | |
run: cargo install grcov --force | |
- name: generate code coverage | |
run: | | |
grcov $(find . -name "grcov-*.profraw" -print) \ | |
--branch \ | |
--ignore-not-existing \ | |
--binary-path ./target/debug/ \ | |
-s . \ | |
-t lcov \ | |
--ignore "/*" \ | |
-o lcov.info | |
- name: check code coverage | |
uses: VeryGoodOpenSource/very_good_coverage@v2 | |
with: | |
path: lcov.info | |
min_coverage: 30.0 |