workflows: split out unit tests

Split out the unit tests into their own action. This decouples the unit tests
from the other tests. This means the gitlab schutzbot tests don't have to
wait until the unit tests are completed before they are triggered. This
also a step towards splitting out the tests so it is more obvious to see
which step is failing and why.
This commit is contained in:
Gianluca Zuccarelli 2025-06-27 13:39:01 +01:00 committed by Klara Simickova
parent e05079330b
commit 9247ea6196
2 changed files with 45 additions and 10 deletions

View file

@ -28,13 +28,3 @@ jobs:
run: npm run build
- name: Run lint check
run: npm run lint
- name: Run unit tests
run: npm run test:coverage
- name: Run unit tests with cockpit
run: npm run test:cockpit
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage/junit.xml
verbose: true

45
.github/workflows/unit-tests.yml vendored Normal file
View file

@ -0,0 +1,45 @@
name: Unit Tests
on:
pull_request:
branches: [ "main" ]
push:
branches: [ "main" ]
merge_group:
jobs:
unit-tests:
name: Service Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run unit tests
run: npm run test:coverage
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage/junit.xml
verbose: true
cockpit-unit-tests:
name: Cockpit Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run unit tests with cockpit
run: npm run test:cockpit