From ceaf716e708ff6a107dfc25632c4084fc58c2ed7 Mon Sep 17 00:00:00 2001 From: abk1969 Date: Sun, 10 May 2026 18:10:34 +0200 Subject: [PATCH] ci: add GitHub Actions workflow for vitest + build Runs npm ci, npm run test:coverage, npm run build on every push to main and every pull request. Node 20 matches the Dockerfile build stage. Concurrency group cancels superseded runs on the same branch. README gets a tests badge. Co-Authored-By: Claude Opus 4.7 (1M context) --- .github/workflows/test.yml | 37 +++++++++++++++++++++++++++++++++++++ README.md | 1 + 2 files changed, 38 insertions(+) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..704334e --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,37 @@ +name: tests + +on: + push: + branches: [main] + pull_request: + branches: [main] + +# Cancel in-progress runs for the same branch when a new commit lands — +# the latest commit's result is the one that matters. +concurrency: + group: tests-${{ github.ref }} + cancel-in-progress: true + +jobs: + vitest: + name: vitest + build + runs-on: ubuntu-latest + timeout-minutes: 5 + + steps: + - uses: actions/checkout@v4 + + - name: Setup Node 20 + uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'npm' + + - name: Install dependencies + run: npm ci + + - name: Run unit tests with coverage + run: npm run test:coverage + + - name: Verify production build + run: npm run build diff --git a/README.md b/README.md index 68e2792..57ac234 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,7 @@ ![status](https://img.shields.io/badge/status-decision--support-CC785C?style=flat-square) ![regulation](https://img.shields.io/badge/Regulation-(EU)%202024%2F1689-1A1915?style=flat-square) ![iso](https://img.shields.io/badge/anchor-ISO%2FIEC%2042001%20%2B%2027090-6E6A60?style=flat-square) +[![tests](https://img.shields.io/github/actions/workflow/status/abk1969/ai_act_compass/test.yml?branch=main&label=tests&style=flat-square)](https://github.com/abk1969/ai_act_compass/actions/workflows/test.yml) ---