Change github test action #3
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: Tests | |
on: | |
push: | |
pull_request: | |
branches: | |
- main | |
jobs: | |
tests: | |
name: Run Tests | |
env: | |
PROJECT_NAME_UNDERSCORE: murray-rs | |
CARGO_INCREMENTAL: 0 | |
RUSTFLAGS: -Zprofile -Ccodegen-units=1 -Copt-level=0 -Clink-dead-code -Coverflow-checks=off -Zpanic_abort_tests -Cpanic=abort | |
RUSTDOCFLAGS: -Cpanic=abort | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
rust: | |
- nightly | |
steps: | |
# Checkout repository | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
# Setup Toolchain | |
- name: Setup Toolchain | |
uses: actions-rs/toolchain@v1 | |
with: | |
profile: minimal | |
toolchain: ${{ matrix.rust }} | |
override: true | |
# Build | |
- name: Build | |
run: cargo build $CARGO_OPTIONS | |
# Cache | |
- name: Configure cache | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: test-${{ runner.os }}-cargo-${{ matrix.rust }}-${{ hashFiles('**/Cargo.lock') }} | |
# Coverage | |
##! CARGO_INCREMENTAL, RUSTFLAGS, RUSTDOCFLAGS - added to CARGO_OPTIONS in cargo test needed for code coverage | |
- name: Generate test result and coverage report | |
run: | | |
find . -name '*.gcda' -delete | |
cargo install grcov --force; | |
rm -rf lcov.info; | |
cargo test --tests $CARGO_OPTIONS; | |
grcov $(find . \( -name "$PROJECT_NAME_UNDERSCORE*.gc*" \) -print) \ | |
--branch \ | |
--ignore-not-existing \ | |
--keep-only "src/prices/mod.rs" \ | |
--keep-only "src/blockchain/mod.rs" \ | |
--keep-only "src/lightning/mod.rs" \ | |
--keep-only "tests/*" \ | |
--binary-path ./target/debug/ \ | |
-s . \ | |
-t lcov \ | |
-o lcov.info; | |
- name: Upload coverage reports to Codecov | |
uses: codecov/[email protected] | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
slug: Guilospanck/murray-rs | |
files: ./lcov.info | |
fail_ci_if_error: true |