Skip to content
Snippets Groups Projects
Commit 395b99fe authored by olemorud's avatar olemorud Committed by Ole Morud
Browse files

[ci] Add test summary on PRs with comments

parent ade13e1f
No related branches found
No related tags found
No related merge requests found
...@@ -196,7 +196,7 @@ def test(workdir: str, shell_log: str, extra_ctest_flags: str): ...@@ -196,7 +196,7 @@ def test(workdir: str, shell_log: str, extra_ctest_flags: str):
result, shell_log = subprocess_with_log(f""" result, shell_log = subprocess_with_log(f"""
cd '{workdir}/build' cd '{workdir}/build'
ctest -j{os.cpu_count()} {extra_ctest_flags} ctest -j{os.cpu_count()} --output-junit TestResults.xml {extra_ctest_flags}
""", shell_log) """, shell_log)
if result != 0: if result != 0:
......
...@@ -145,4 +145,20 @@ jobs: ...@@ -145,4 +145,20 @@ jobs:
--incremental true --incremental true
--base_ref ${{ github.ref_name }} --base_ref ${{ github.ref_name }}
--repository ${{ github.server_url }}/${{ github.repository }} --repository ${{ github.server_url }}/${{ github.repository }}
" "
\ No newline at end of file
- name: Upload test results
uses: actions/upload-artifact@v3
with:
name: Test Results ${{ matrix.image }} ${{ matrix.config }}
path: /tmp/workspace/build/TestResults.xml
event_file:
name: "Upload Event Payload"
runs-on: ubuntu-latest
steps:
- name: Upload
uses: actions/upload-artifact@v3
with:
name: Event File
path: ${{ github.event_path }}
name: Test Summary PR comment
on:
workflow_run:
# do NOT use quotes: https://stackoverflow.com/a/72551795/17876693
workflows: [ROOT CI]
types:
- completed
permissions: {}
jobs:
comment-test-results:
name: Publish Test Results
if: github.event.workflow_run.event == 'pull_request'
runs-on: ubuntu-latest
permissions:
checks: write
pull-requests: write
actions: read
steps:
- name: Download and Extract Artifacts
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
mkdir -p artifacts && cd artifacts
artifacts_url=${{ github.event.workflow_run.artifacts_url }}
gh api --paginate "$artifacts_url" -q '.artifacts[] | [.name, .archive_download_url] | @tsv' | while read artifact
do
IFS=$'\t' read name url <<< "$artifact"
gh api $url > "$name.zip"
unzip -d "$name" "$name.zip"
done
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
with:
commit: ${{ github.event.workflow_run.head_sha }}
event_file: artifacts/Event File/event.json
event_name: ${{ github.event.workflow_run.event }}
files: "artifacts/**/*.xml"
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment