Merge pull request #1307 from PrivateBin/experimental-8.4

Add upload test results job in CI
This commit is contained in:
El RIDO 2024-05-12 10:12:25 +02:00 committed by GitHub
commit 9239c0267f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 74 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

@ -7,6 +7,9 @@ jobs:
Composer: Composer:
runs-on: ubuntu-latest 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: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
@ -96,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:
@ -121,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",