From 8afaf7e88b7a42f236162b6ad895548e3e9e7a93 Mon Sep 17 00:00:00 2001 From: Christopher Kolstad Date: Fri, 16 May 2025 14:51:45 +0200 Subject: [PATCH] fix(ci): update config to make GHA reporting be better --- .github/workflows/build.yaml | 2 +- .github/workflows/build_coverage.yaml | 10 ++++++---- vitest.config.ts | 25 ++++++++++++++----------- 3 files changed, 21 insertions(+), 16 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 662414ce45..42be544b5f 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -18,7 +18,7 @@ jobs: name: build permissions: contents: read - # Needed for the github-reporter from vite to make comments on PRs + # Needed for the github-reporter from vitest to make comments on PRs pull-requests: write services: # Label used to access the service container diff --git a/.github/workflows/build_coverage.yaml b/.github/workflows/build_coverage.yaml index a1201884a7..6d78d16e53 100644 --- a/.github/workflows/build_coverage.yaml +++ b/.github/workflows/build_coverage.yaml @@ -9,14 +9,16 @@ on: - website/** - frontend/** - coverage/** + pull_request: + paths-ignore: + - website/** + - frontend/** + - coverage/** jobs: coverage: runs-on: ubuntu-latest - strategy: - matrix: - node-version: [20.x] services: # Label used to access the service container postgres: @@ -35,7 +37,7 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Use Node.js ${{ matrix.node-version }} + - name: Use Node.js 22 uses: actions/setup-node@v4 with: node-version: 22.x diff --git a/vitest.config.ts b/vitest.config.ts index 241b9a459b..c091af2a94 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -5,17 +5,20 @@ export default defineConfig({ globals: true, globalSetup: ['./src/test-setup.ts'], setupFiles: ['./src/test/errorWithMessage.ts'], - reporters: [ - [ - 'junit', - { - suiteName: 'Unleash Unit Tests', - outputFile: 'reports/jest-junit.xml', - classnameTemplate: '{filename} - {filepath}', - }, - ], - ['default'], - ], + reporters: process.env.GITHUB_ACTIONS + ? [ + ['dot'], + [ + 'junit', + { + suiteName: 'Unleash Unit Tests', + outputFile: 'reports/jest-junit.xml', + classnameTemplate: '{filename} - {filepath}', + }, + ], + ['github-actions'], + ] + : [['default']], testTimeout: 30000, exclude: [ ...configDefaults.exclude,