feat: [M3-7128] - Coverage Report - Part 1 #2
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: Code Coverage | |
# on: | |
# workflow_run: | |
# workflows: | |
# - ci | |
# types: | |
# - completed | |
# jobs: | |
# compare_pr_coverage: | |
# name: Compare PR Code Coverage | |
# runs-on: ubuntu-latest | |
# steps: | |
# - uses: actions/checkout@v3 | |
# - name: Use Node.js v18.14.0 | |
# uses: actions/setup-node@v3 | |
# with: | |
# node-version: "18.14" | |
# - name: Download code coverage report from base branch | |
# uses: actions/download-artifact@v3 | |
# with: | |
# name: ref-lcov.info | |
# - name: Install dependencies | |
# run: yarn | |
# - name: Run test coverage | |
# run: yarn test | |
# # Compares two code coverage files and generates report as a comment | |
# - name: Generate Code Coverage report | |
# id: code-coverage | |
# uses: barecheck/code-coverage-action@v1 | |
# with: | |
# github-token: ${{ secrets.GITHUB_TOKEN }} | |
# barecheck-github-app-token: ${{ secrets.BARECHECK_GITHUB_APP_TOKEN }} | |
# lcov-file: "./coverage/lcov.info" | |
# base-lcov-file: "./coverage/base-lcov.info" | |
# minimum-ratio: 0 # Fails Github action once code coverage is decreasing | |
# send-summary-comment: true | |
# show-annotations: "warning" # Possible options warning|error | |
name: Code Coverage | |
on: [pull_request] | |
jobs: | |
base_branch_coverage: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Node.js v18.14.0 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "18.14" | |
- name: Install dependencies | |
run: yarn | |
- name: Run test coverage | |
run: yarn test | |
- name: Upload code coverage for ref branch | |
uses: actions/upload-artifact@v3 | |
with: | |
name: base-lcov.info | |
path: ./coverage/lcov.info | |
checks: | |
runs-on: ubuntu-latest | |
needs: base_branch_coverage | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Node.js v18.14.0 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "18.14" | |
- name: Download code coverage report from base branch | |
uses: actions/download-artifact@v3 | |
with: | |
name: base-lcov.info | |
path: ./coverage | |
- name: Install dependencies | |
run: yarn | |
- name: Run test coverage | |
run: yarn test | |
# Compares two code coverage files and generates report as a comment | |
- name: Generate Code Coverage report | |
id: code-coverage | |
uses: barecheck/code-coverage-action@v1 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
barecheck-github-app-token: ${{ secrets.BARECHECK_GITHUB_APP_TOKEN }} | |
lcov-file: "./coverage/lcov.info" | |
base-lcov-file: "./coverage/base-lcov.info" | |
minimum-ratio: 0 # Fails Github action once code coverage is decreasing | |
send-summary-comment: true | |
show-annotations: "warning" # Possible options warning|error |