Skip to content

Adding workflow files #505

Adding workflow files

Adding workflow files #505

Workflow file for this run

name: Build and Test
on:
merge_group:
workflow_dispatch:
pull_request:
branches: [ main, v4 ]
push:
branches: [ main, v4 ]
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
env:
NODE_VERSION: 22
CACHE_KEY: "${{ github.ref }}-${{ github.run_id }}-${{ github.run_attempt }}"
jobs:
build:
name: Build Package
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
- name: Install pnpm
shell: bash
run: |
npm i -g pnpm
pnpm --version # Verify installation
- name: Setup pnpm cache
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
unit:
needs: build
name: Run Unit Tests
runs-on: ubuntu-latest
strategy:
matrix:
node: [20, 22]
steps:
- uses: actions/checkout@v4
- name: Setup Node and pnpm
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: 'pnpm'
- name: Install pnpm
shell: bash
run: |
npm i -g pnpm
pnpm --version # Verify installation
- name: Restore build artifacts
uses: actions/cache/restore@v4
with:
path: .
key: build-${{ github.ref }}-${{ github.run_id }}-${{ github.run_attempt }}
- name: Run Unit Tests
run: pnpm test:unit
- uses: codecov/codecov-action@v4 # Latest version
coverage:
needs: build
name: Run Coverage Tests
runs-on: ubuntu-latest
strategy:
matrix:
node: [20, 22]
steps:
- uses: actions/checkout@v4
- name: Setup Node and pnpm
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: 'pnpm'
- name: Install pnpm
shell: bash
run: |
npm i -g pnpm
pnpm --version # Verify installation
- name: Restore build artifacts
uses: actions/cache/restore@v4
with:
path: .
key: build-${{ github.ref }}-${{ github.run_id }}-${{ github.run_attempt }}
- name: Run Test Coverage
run: pnpm test:coverage
- uses: codecov/codecov-action@v4