From b1398cfaad8a61e99c30118d19b3f980826d9068 Mon Sep 17 00:00:00 2001 From: David Jennes Date: Mon, 8 Apr 2024 15:28:40 +0200 Subject: [PATCH] Rework PR check actions to check for "debug logging", and if set, to disable the junit reporter (it silences test "crashes") --- .github/workflows/laravel-build-and-test.yml | 8 ++++++-- .github/workflows/node-build-and-test.yml | 11 +++++++---- .github/workflows/nuxt-build-and-test.yml | 9 +++++++-- .github/workflows/web-build-and-test.yml | 11 ++++++++--- 4 files changed, 28 insertions(+), 11 deletions(-) diff --git a/.github/workflows/laravel-build-and-test.yml b/.github/workflows/laravel-build-and-test.yml index d038ad3..b2d0e02 100644 --- a/.github/workflows/laravel-build-and-test.yml +++ b/.github/workflows/laravel-build-and-test.yml @@ -110,9 +110,13 @@ jobs: php artisan config:cache php artisan migrate --seed - name: Run tests - run: vendor/bin/pest --log-junit="test-reports/junit.xml" + run: | + if [ "$RUNNER_DEBUG" != '1' ]; then + TEST_REPORTER='--log-junit="test-reports-junit.xml"' + fi + vendor/bin/pest $TEST_REPORTER - name: Publish test report uses: mikepenz/action-junit-report@v4 if: always() # always run even if the previous step fails with: - report_paths: test-reports/junit.xml + report_paths: test-reports-junit.xml diff --git a/.github/workflows/node-build-and-test.yml b/.github/workflows/node-build-and-test.yml index 9c9426e..eb62bc2 100644 --- a/.github/workflows/node-build-and-test.yml +++ b/.github/workflows/node-build-and-test.yml @@ -169,10 +169,13 @@ jobs: name: app-build - name: Run tests run: | - if test -f '.env.test'; then cp -f '.env.test' '.env'; fi - node --test -r dotenv/config \ - --test-reporter=junit \ - --test-reporter-destination="test-report-junit.xml" + if test -f '.env.test'; then + cp -f '.env.test' '.env' + fi + if [ "$RUNNER_DEBUG" != '1' ]; then + TEST_REPORTER='--test-reporter=junit --test-reporter-destination="test-report-junit.xml"' + fi + node --test -r dotenv/config $TEST_REPORTER - name: Publish test report uses: mikepenz/action-junit-report@v4 if: always() # always run even if the previous step fails diff --git a/.github/workflows/nuxt-build-and-test.yml b/.github/workflows/nuxt-build-and-test.yml index 443cbaf..048e9df 100644 --- a/.github/workflows/nuxt-build-and-test.yml +++ b/.github/workflows/nuxt-build-and-test.yml @@ -92,8 +92,13 @@ jobs: name: app-build - name: Run tests run: | - if test -f '.env.test'; then cp -f '.env.test' '.env'; fi - pnpm vitest --run --reporter=junit --outputFile="test-reports/junit.xml" + if test -f '.env.test'; then + cp -f '.env.test' '.env' + fi + if [ "$RUNNER_DEBUG" != '1' ]; then + TEST_REPORTER='--reporter=junit --outputFile="test-report-junit.xml"' + fi + pnpm vitest --run $TEST_REPORTER - name: Publish test report uses: mikepenz/action-junit-report@v4 if: always() # always run even if the previous step fails diff --git a/.github/workflows/web-build-and-test.yml b/.github/workflows/web-build-and-test.yml index 9bbc3cd..2a1348c 100644 --- a/.github/workflows/web-build-and-test.yml +++ b/.github/workflows/web-build-and-test.yml @@ -107,10 +107,15 @@ jobs: run: pnpm install --frozen-lockfile - name: Run tests run: | - if test -f '.env.test'; then cp -f '.env.test' '.env'; fi - pnpm vitest --run --reporter=junit --outputFile="test-reports/junit.xml" + if test -f '.env.test'; then + cp -f '.env.test' '.env' + fi + if [ "$RUNNER_DEBUG" != '1' ]; then + TEST_REPORTER='--reporter=junit --outputFile="test-report-junit.xml"' + fi + pnpm vitest --run $TEST_REPORTER - name: Publish test report uses: mikepenz/action-junit-report@v4 if: always() # always run even if the previous step fails with: - report_paths: test-reports/junit.xml + report_paths: test-reports-junit.xml