Fix issue #1505 (#1511) #851
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: Test coverage | |
on: | |
push: | |
branches: 'master' | |
paths-ignore: 'docs/**' | |
env: | |
RUST_BACKTRACE: 1 | |
PRUSTI_ASSERT_TIMEOUT: 60000 | |
# The /mnt disk has 66 GB of free space; more than the working directory | |
COVERAGE_PATH: /mnt/prusti-coverage | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v3 | |
- name: Set up Java | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '15' | |
distribution: 'zulu' | |
- name: Set up the environment | |
run: python x.py setup | |
- name: Cache cargo | |
uses: Swatinem/rust-cache@v2 | |
with: | |
shared-key: "shared" | |
- name: Enable collection of source-based coverage | |
run: | | |
# Prepare directory | |
sudo mkdir "$COVERAGE_PATH" | |
sudo chmod 777 "$COVERAGE_PATH" | |
# The following are necessary for profiling (see https://github.com/mozilla/grcov) | |
echo "RUSTFLAGS=-Cinstrument-coverage" >> $GITHUB_ENV | |
echo "LLVM_PROFILE_FILE=${COVERAGE_PATH}/gcov-%p-%m.profraw" >> $GITHUB_ENV | |
- name: Report disk usage | |
run: df -h | |
- name: Build with cargo | |
run: python x.py build --all | |
- name: Build prusti-contracts-test | |
run: | | |
cd prusti-contracts/prusti-contracts-test/ | |
cargo build | |
- name: Run quick cargo tests, enabling debug dumps to cover more code | |
run: python x.py test quick | |
env: | |
PRUSTI_DUMP_DEBUG_INFO: true | |
PRUSTI_DUMP_VIPER_PROGRAM: true | |
PRUSTI_IGNORE_REGIONS: true | |
- name: Run cargo tests | |
run: python x.py test --all | |
- name: Report disk usage | |
run: df -h | |
- name: Collect coverage | |
run: | | |
curl -sL https://github.com/mozilla/grcov/releases/latest/download/grcov-x86_64-unknown-linux-gnu.tar.bz2 | tar jxf - | |
./grcov "$COVERAGE_PATH" --llvm --binary-path ./target/debug/ -s . -t lcov --branch --ignore-not-existing --ignore "/*" -o lcov.info | |
- name: Upload coverage to Codecov | |
uses: codecov/codecov-action@v1 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
file: ./lcov.info |