feat: [M3-7806] - Linode Create Refactor - Part 1 #1862
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: [pull_request] | |
jobs: | |
base_branch: | |
if: github.event.pull_request.draft == false | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
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" | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
**/node_modules | |
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} | |
- name: Install Dependencies | |
run: yarn --frozen-lockfile | |
- name: Build @linode/validation | |
run: yarn build:validation | |
- name: Build @linode/api-v4 | |
run: yarn build:sdk | |
- name: Run Base Branch Coverage | |
run: yarn coverage:summary | |
- name: Write Base Coverage to an Artifact | |
run: | | |
coverage_json=$(cat ./packages/manager/coverage/coverage-summary.json) | |
pct=$(echo "$coverage_json" | jq -r '.total.statements.pct') | |
echo "$pct" > ref_code_coverage.txt | |
- name: Upload Base Coverage Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ref_code_coverage | |
path: ref_code_coverage.txt | |
current_branch: | |
if: github.event.pull_request.draft == false | |
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" | |
- uses: actions/cache@v3 | |
with: | |
path: | | |
**/node_modules | |
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} | |
- name: Install Dependencies | |
run: yarn --frozen-lockfile | |
- name: Build @linode/validation | |
run: yarn build:validation | |
- name: Build @linode/api-v4 | |
run: yarn build:sdk | |
- name: Run Current Branch Coverage | |
run: yarn coverage:summary | |
- name: Write PR Number to an Artifact | |
run: | | |
echo "${{ github.event.number }}" > pr_number.txt | |
- name: Write Current Coverage to an Artifact | |
run: | | |
coverage_json=$(cat ./packages/manager/coverage/coverage-summary.json) | |
pct=$(echo "$coverage_json" | jq -r '.total.statements.pct') | |
echo "$pct" > current_code_coverage.txt | |
- name: Upload PR Number Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: pr_number | |
path: pr_number.txt | |
- name: Upload Current Coverage Artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: current_code_coverage | |
path: current_code_coverage.txt |