From abd888d7f28575f0cc1ed7d03db42f5675d694e1 Mon Sep 17 00:00:00 2001 From: Libish Murugesan <38063326+libishm1@users.noreply.github.com> Date: Sun, 29 Nov 2026 10:05:50 +0300 Subject: [PATCH] CI: unit tests and lint gate the deploy; tests on every pull request The first step of the unit test plan after Dr Jabi's review (26 November): nothing ran the tests automatically and the site deployed on a build alone. - deploy-frontend.yml: a test job (npm test, npm run lint) that the build needs, so a failing test or lint error stops the deploy. - test.yml (new): unit tests, lint and a build on every pull request into main that touches the frontend or the workflows. Both test jobs use Node 22: npm test passes a glob to node --test, which Node 20 does not expand. The build and deploy keep Node 20. --- .github/workflows/deploy-frontend.yml | 23 +++++++++++++++ .github/workflows/test.yml | 41 +++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/deploy-frontend.yml b/.github/workflows/deploy-frontend.yml index e138972..eddeaf9 100644 --- a/.github/workflows/deploy-frontend.yml +++ b/.github/workflows/deploy-frontend.yml @@ -20,7 +20,30 @@ concurrency: cancel-in-progress: true jobs: + # The release gate (unit test plan, 26 November): a failing unit test or + # lint error stops the deploy. Node 22, since `npm test` passes a glob to + # `node --test`, which Node 20 does not expand. + test: + runs-on: ubuntu-latest + defaults: + run: + working-directory: topologicpy-web-frontend + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: '22' + cache: 'npm' + cache-dependency-path: topologicpy-web-frontend/package-lock.json + - name: Install + run: npm ci + - name: Unit tests + run: npm test + - name: Lint + run: npm run lint + build: + needs: test runs-on: ubuntu-latest defaults: run: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..cbab577 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,41 @@ +name: Tests + +# The pull-request level of the release gate (unit test plan, 26 November): +# unit tests, lint and a build on every pull request into main. A red run +# should block the merge. +on: + pull_request: + branches: [main] + paths: + - 'topologicpy-web-frontend/**' + - '.github/workflows/**' + workflow_dispatch: + +permissions: + contents: read + +concurrency: + group: tests-${{ github.ref }} + cancel-in-progress: true + +jobs: + test: + runs-on: ubuntu-latest + defaults: + run: + working-directory: topologicpy-web-frontend + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: '22' + cache: 'npm' + cache-dependency-path: topologicpy-web-frontend/package-lock.json + - name: Install + run: npm ci + - name: Unit tests + run: npm test + - name: Lint + run: npm run lint + - name: Build + run: npm run build