chore: add cicd for running unit test when creating PR #5
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: Build and Test | |
on: | |
pull_request: | |
branches: | |
- next | |
jobs: | |
test_and_build: | |
runs-on: ubuntu-latest | |
env: | |
EXCLUDED_PACKAGE_OA_RENDERERS: '!./packages/vckit-oa-renderers/' | |
EXCLUDED_PACKAGE_CREDENTIAL_OA: '!./packages/credential-oa/' | |
EXCLUDED_PACKAGE_EXPLORER: '!./packages/demo-explorer/' | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Install pnpm | |
run: npm i pnpm --global | |
- name: Install Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '21' | |
- name: Install dependencies | |
run: pnpm i --filter ${{ env.EXCLUDED_PACKAGE_OA_RENDERERS }} --filter ${{ env.EXCLUDED_PACKAGE_CREDENTIAL_OA }} --filter ${{ env.EXCLUDED_PACKAGE_EXPLORER }} | |
- name: Build | |
run: pnpm -r --stream --filter ${{ env.EXCLUDED_PACKAGE_OA_RENDERERS }} --filter ${{ env.EXCLUDED_PACKAGE_CREDENTIAL_OA }} --filter ${{ env.EXCLUDED_PACKAGE_EXPLORER }} build | |
- name: Run tests | |
run: | | |
pnpm test:packages --changedSince=origin/next --ci --json --coverage --testLocationInResults --outputFile=report.json | |
- name: Coverage | |
uses: artiomtr/jest-coverage-report-action@v2 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
coverage-file: report.json | |
base-coverage-file: report.json | |
threshold: 80 |