Skip to content

fixed

fixed #216

Workflow file for this run

name: Code Coverage
on:
pull_request:
branches: [main]
merge_group:
jobs:
base_branch_cov:
runs-on: ubuntu-latest
steps:
- name: Get base branch
id: base
run: |
BASE_BRANCH=${{ github.base_ref }}
echo "base_branch=${BASE_BRANCH:-"main"}" >> $GITHUB_ENV
- uses: actions/checkout@v3
with:
ref: ${{ env.base_branch }}
- uses: actions-rust-lang/[email protected]
with:
components: llvm-tools-preview
- uses: SierraSoftworks/setup-grcov@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
version: latest
- name: Install latest mdbook
run: |
tag=$(curl 'https://api.github.com/repos/rust-lang/mdbook/releases/latest' | jq -r '.tag_name')
url="https://github.com/rust-lang/mdbook/releases/download/${tag}/mdbook-${tag}-x86_64-unknown-linux-gnu.tar.gz"
mkdir bin
curl -sSL $url | tar -xz --directory=bin
echo "$(pwd)/bin" >> $GITHUB_PATH
- run: mdbook build
working-directory: docs/
- name: Run tests with code coverage
run: ./test_coverage.sh
- name: Upload code coverage for ref branch
uses: actions/upload-artifact@v2
with:
name: ref-lcov.info
path: ./target/coverage/tests.lcov
checks:
name: "Execute tests with code coverage"
runs-on: ubuntu-latest
needs: base_branch_cov
steps:
- uses: actions/checkout@v3
- name: Download code coverage report from base branch
uses: actions/download-artifact@v2
with:
name: ref-lcov.info
- uses: actions-rust-lang/[email protected]
with:
components: llvm-tools-preview
- uses: SierraSoftworks/setup-grcov@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
version: latest
- name: Install latest mdbook
run: |
tag=$(curl 'https://api.github.com/repos/rust-lang/mdbook/releases/latest' | jq -r '.tag_name')
url="https://github.com/rust-lang/mdbook/releases/download/${tag}/mdbook-${tag}-x86_64-unknown-linux-gnu.tar.gz"
mkdir bin
curl -sSL $url | tar -xz --directory=bin
echo "$(pwd)/bin" >> $GITHUB_PATH
- run: mdbook build
working-directory: docs/
- name: Run tests with code coverage
run: ./test_coverage.sh
# Compares two code coverage files and generates report as a comment
- name: Code coverage report
id: code-coverage
uses: barecheck/code-coverage-action@v1
with:
barecheck-github-app-token: ${{ secrets.BARECHECK_GITHUB_APP_TOKEN }}
lcov-file: "./target/coverage/tests.lcov"
base-lcov-file: "./tests.lcov"
minimum-ratio: -0.05 # Fails Github action once code coverage is decreasing too much
send-summary-comment: true
show-annotations: "warning" # Possible options warning|error