Skip to content

refactor: [M3-8632] - Use pnpm as our package manager #7380

refactor: [M3-8632] - Use pnpm as our package manager

refactor: [M3-8632] - Use pnpm as our package manager #7380

Workflow file for this run

name: Code Coverage
on: [pull_request]
jobs:
base_branch:
if: github.event.pull_request.draft == false
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.base_ref }} # The base branch of the PR (develop)
- uses: pnpm/action-setup@v4
with:
run_install: false
- name: Use Node.js v20.17 LTS
uses: actions/setup-node@v4
with:
node-version: "20.17"
cache: "pnpm"
- name: Install Dependencies
run: pnpm install --frozen-lockfile
- name: Build @linode/validation
run: pnpm build:validation
- name: Build @linode/api-v4
run: pnpm build:sdk
- name: Run Base Branch Coverage
run: pnpm 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@v4
with:
name: ref_code_coverage
path: ref_code_coverage.txt
current_branch:
# We want to make sure we only run on open PRs (not drafts), but also should run even if the base branch coverage job fails.
# If the base branch coverage job fails to create a report, the current branch coverage job will fail as well, but this may help us debug the CI on the current branch.
if: ${{ always() && github.event.pull_request.draft == false }}
runs-on: ubuntu-latest
needs: base_branch
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
with:
run_install: false
- name: Use Node.js v20.17 LTS
uses: actions/setup-node@v4
with:
node-version: "20.17"
cache: "pnpm"
- name: Install Dependencies
run: pnpm install --frozen-lockfile
- name: Build @linode/validation
run: pnpm build:validation
- name: Build @linode/api-v4
run: pnpm build:sdk
- name: Run Current Branch Coverage
run: pnpm 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@v4
with:
name: pr_number
path: pr_number.txt
- name: Upload Current Coverage Artifact
uses: actions/upload-artifact@v4
with:
name: current_code_coverage
path: current_code_coverage.txt