diff --git a/.github/workflows/test-results.yml b/.github/workflows/test-results.yml new file mode 100644 index 00000000..26429607 --- /dev/null +++ b/.github/workflows/test-results.yml @@ -0,0 +1,42 @@ +name: Test Results + +on: + workflow_run: + workflows: ["Tests"] + types: + - completed +permissions: {} + +jobs: + test-results: + name: Test Results + runs-on: ubuntu-latest + if: github.event.workflow_run.conclusion != 'skipped' + + permissions: + checks: write + + # needed unless run with comment_mode: off + pull-requests: write + + # required by download step to access artifacts API + actions: read + + steps: + - name: Download and Extract Artifacts + uses: dawidd6/action-download-artifact@e7466d1a7587ed14867642c2ca74b5bcc1e19a2d + with: + run_id: ${{ github.event.workflow_run.id }} + path: artifacts + + - name: Publish Test Results + uses: EnricoMi/publish-unit-test-result-action@v2 + with: + check_name: "Test Results (${{ github.event.workflow_run.event || github.event_name }})" + commit: ${{ github.event.workflow_run.head_sha }} + event_file: artifacts/Event File/event.json + event_name: ${{ github.event.workflow_run.event }} + files: | + artifacts/**/*.xml + artifacts/**/*.trx + artifacts/**/*.json diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 00cab65c..0c59f0e8 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -9,6 +9,7 @@ jobs: runs-on: ubuntu-latest # https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs#handling-failures continue-on-error: ${{ matrix.experimental }} + steps: - name: Checkout uses: actions/checkout@v4 @@ -98,9 +99,16 @@ jobs: # testing - name: Run unit tests - run: ../vendor/bin/phpunit --no-coverage + run: ../vendor/bin/phpunit --no-coverage --log-junit results.xml working-directory: tst + - name: Upload Test Results + if: always() + uses: actions/upload-artifact@v4 + with: + name: Test Results (PHP ${{ matrix.php-versions }}) + path: tst/results.xml + Mocha: runs-on: ubuntu-latest steps: @@ -123,5 +131,23 @@ jobs: working-directory: js - name: Run unit tests - run: npm test + run: npm run ci-test working-directory: js + + - name: Upload Test Results + if: always() + uses: actions/upload-artifact@v4 + with: + name: Test Results (Mocha) + path: js/mocha-results.xml + + event_file: + name: "Event File" + runs-on: ubuntu-latest + steps: + - name: Upload + uses: actions/upload-artifact@v4 + with: + name: Event File + path: ${{ github.event_path }} + diff --git a/js/package.json b/js/package.json index a0b4899b..e0bb8865 100644 --- a/js/package.json +++ b/js/package.json @@ -15,7 +15,8 @@ "@peculiar/webcrypto": "^1.1.1" }, "scripts": { - "test": "mocha" + "test": "mocha", + "ci-test": "mocha --reporter-option output=mocha-results.xml" }, "repository": { "type": "git",