Skip to content

JS Quality Tests

JS Quality Tests #561

Workflow file for this run

name: JS Quality Tests
on:
pull_request:
paths:
- 'packages/**/*.ts'
- 'packages/**/*.tsx'
- 'packages/**/*.js'
- 'packages/**/*.jsx'
- 'packages/**/*.scss'
- 'package.json'
- 'package-lock.json'
workflow_run:
workflows: ["Update WP Deps"]
types:
- completed
env:
fail-fast: true
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
node-version: [22]
name: Test JS (node ${{ matrix.node-version }})
steps:
- name: Checkout
uses: actions/checkout@v4
if: github.event_name != 'workflow_run'
- name: Checkout
uses: boxuk/wp-checkout-deps-auto-update@main
id: checkout-deps
if: github.event_name == 'workflow_run'
with:
workflow_run_id: ${{ github.event.workflow_run.id }}
- name: Mark Check as Pending
if: github.event_name == 'workflow_run'
env:
GH_TOKEN: ${{ github.token }}
run: |
gh api repos/${{ github.repository }}/statuses/${{ steps.checkout-deps.outputs.pr-head-sha }} \
-f state=pending \
-f description="JS Quality Tests are in progress" \
-f context="JS Quality Tests"
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: npm
- name: Setup dependencies
run: npm ci
- name: Lint JS
run: npm run lint
- name: Unit Test
run: npm run test
- name: Type Coverage
run: npm run type-coverage
- name: Build
run: npm run build
- name: Mark Check as Success
if: github.event_name == 'workflow_run' && success()
env:
GH_TOKEN: ${{ github.token }}
run: |
gh api repos/${{ github.repository }}/statuses/${{ steps.checkout-deps.outputs.pr-head-sha }} \
-f state=success \
-f target_url=https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} \
-f description="JS Quality Tests completed successfully" \
-f context="JS Quality Tests"
- name: Mark Check as Failure
if: github.event_name == 'workflow_run' && failure()
env:
GH_TOKEN: ${{ github.token }}
run: |
gh api repos/${{ github.repository }}/statuses/${{ steps.checkout-deps.outputs.pr-head-sha }} \
-f state=failure \
-f target_url=https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }} \
-f description="JS Quality Tests failed" \
-f context="JS Quality Tests"