Merge pull request #1303 from PrivateBin/test-improvments

Add upload test results job
This commit is contained in:
rugk 2024-05-05 20:38:25 +02:00 committed by GitHub
commit b7528f4427
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 72 additions and 3 deletions

42
.github/workflows/test-results.yml vendored Normal file
View file

@ -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

View file

@ -9,6 +9,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
# https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs#handling-failures # https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs#handling-failures
continue-on-error: ${{ matrix.experimental }} continue-on-error: ${{ matrix.experimental }}
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
@ -98,9 +99,16 @@ jobs:
# testing # testing
- name: Run unit tests - name: Run unit tests
run: ../vendor/bin/phpunit --no-coverage run: ../vendor/bin/phpunit --no-coverage --log-junit results.xml
working-directory: tst 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: Mocha:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
@ -123,5 +131,23 @@ jobs:
working-directory: js working-directory: js
- name: Run unit tests - name: Run unit tests
run: npm test run: npm run ci-test
working-directory: js 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 }}

View file

@ -15,7 +15,8 @@
"@peculiar/webcrypto": "^1.1.1" "@peculiar/webcrypto": "^1.1.1"
}, },
"scripts": { "scripts": {
"test": "mocha" "test": "mocha",
"ci-test": "mocha --reporter-option output=mocha-results.xml"
}, },
"repository": { "repository": {
"type": "git", "type": "git",