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 }}
- run: sudo apt-get update
- run: sudo apt-get install -y libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libxkbcommon-dev libssl-dev
- uses: actions-rust-lang/setup-rust-toolchain@v1.4.4
with:
components: llvm-tools-preview
- uses: SierraSoftworks/setup-grcov@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
version: latest
- 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
- run: sudo apt-get update
- run: sudo apt-get install -y libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libxkbcommon-dev libssl-dev
- uses: actions-rust-lang/setup-rust-toolchain@v1.4.4
with:
components: llvm-tools-preview
- uses: SierraSoftworks/setup-grcov@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
version: latest
- name: Run tests with code coverage
run: ./test_coverage.sh
- 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 send-summary-comment: true
show-annotations: "warning" - name: Upload screenshots for failed UI tests
uses: actions/upload-artifact@v3
if: ${{ always() }}
with:
name: actual-screenshots
path: |
src/app/tests/actual
retention-days: 5
if-no-files-found: ignore