M3 7128 part 1 joes branch #1
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: [pull_request] | |
jobs: | |
base_branch: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
# TODO: Remove this comment after merging to develop | |
# with: | |
# ref: ${{ github.base_ref }} # The base branch of the PR (develop) | |
- name: Use Node.js v18.14.0 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: "18.14" | |
- name: Install dependencies | |
run: yarn | |
- name: Run base branch coverage | |
run: yarn coverage:summary | |
- name: Read base coverage | |
id: read_base_coverage | |
run: | | |
coverage_json='./packages/manager/coverage/coverage-summary.json' | |
echo "::set-output name=baseCoverage::$coverage_json" | |
- name: Write base coverage to an artifact | |
run: | | |
echo "${{fromJson(steps.read_base_coverage.outputs.baseCoverage).total.lines.pct}}" > ref_code_coverage.txt | |
- name: Upload code coverage for base branch | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ref_code_coverage | |
path: ref_code_coverage.txt | |
current_branch: | |
runs-on: ubuntu-latest | |
needs: base_branch | |
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_code_coverage | |
- name: Install dependencies | |
run: yarn | |
- name: Run current branch coverage | |
run: yarn coverage:summary | |
- name: Read current coverage | |
id: read_current_coverage | |
run: | | |
coverage_json='./packages/manager/coverage/coverage-summary.json' | |
echo "::set-output name=currentCoverage::$coverage_json" | |
- name: Write base coverage to an artifact | |
run: | | |
echo "${{fromJson(steps.read_current_coverage.outputs.currentCoverage).total.lines.pct}}" > current_code_coverage.txt | |