Skip to content

Commit

Permalink
feat(test_framework): Add workflow scripts to show test results in PRs
Browse files Browse the repository at this point in the history
The trigger for running tests is disabled until we want to enable them.
In order to run, these scripts (like other workflow scripts) must be in
the main branch (master).
  • Loading branch information
salinecitrine committed Jan 21, 2024
1 parent 6d2f749 commit 6f9b141
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/process_test_results.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Process Test Results

on:
workflow_run:
workflows: ["Run Tests"]
types:
- completed

permissions: {}

jobs:
process-test-results:
name: Process 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 Artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
github-token: ${{ github.token }}
run-id: ${{ github.event.workflow_run.id }}

- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
with:
time_unit: milliseconds
commit: ${{ github.event.workflow_run.head_sha }}
event_file: artifacts/Event File/event.json
event_name: ${{ github.event.workflow_run.event }}
files: "artifacts/Test Results/*.json"
35 changes: 35 additions & 0 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Run Tests

on:
# push:
# branches-ignore:
# - master

jobs:
upload-event_file:
name: Upload Event File
runs-on: ubuntu-latest
steps:
- name: Upload Event File
uses: actions/upload-artifact@v4
with:
name: Event File
path: ${{ github.event_path }}

run-tests:
name: Run Tests
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Run Tests
run: docker-compose -f tools/headless_testing/docker-compose.yml up

- name: Upload Test Results
if: always()
uses: actions/upload-artifact@v4
with:
name: Test Results
path: |
tools/headless_testing/testlog/results.json

0 comments on commit 6f9b141

Please sign in to comment.