Skip to content

Commit addc59a

Browse files
author
Aaron Roller
committed
added falure demonstration AM-337/gtest
1 parent dc5ef42 commit addc59a

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

.github/workflows/release.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,21 @@ jobs:
6363
with:
6464
name: alternate-report-path-reports
6565
path: somewhere/custom-report.html
66+
test-show-failure:
67+
runs-on: ubuntu-18.04
68+
name: Demonstrates failure case
69+
steps:
70+
- uses: actions/checkout@v1
71+
- id: xunit-viewer
72+
uses: ./ #use the current project relative to root
73+
with:
74+
results: test/failure
75+
- name: Attach the report
76+
if: always()
77+
uses: actions/upload-artifact@v1
78+
with:
79+
name: ${{ steps.xunit-viewer.outputs.report-name }}
80+
path: ${{ steps.xunit-viewer.outputs.report-dir }}
6681
test-detection:
6782
runs-on: ubuntu-18.04
6883
name: Run tests to ensure detection is working

action.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ outputs:
2525
description: "The file path where the report can be found. Equal to 'output' input."
2626
report-dir:
2727
description: "The directory where the report can be found."
28+
report-name:
29+
description: "Use this name with Artifact Upload for unique attachments"
2830
runs:
2931
using: 'docker'
3032
image: 'Dockerfile'

entrypoint.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,11 @@ mkdir -p "$(dirname "$output")"
3939

4040
xunit-viewer --results="$results" --output="$output" --console=true --title="$title"
4141

42+
recommended_attachment_name=echo "test-results-$GITHUB_REPOSITORY-$GITHUB_WORKFLOW-$HOSTNAME-$GITHUB_RUN_ID"
4243

4344
echo ::set-output name=report-file::"$output" #reference available to other actions
4445
echo ::set-output name=report-dir::"$report_dir" #for easy attachment of a folder
46+
echo ::set-output name=report-name::"$recommended_attachment_name" #to provide a globally unique name for downloading results
4547

4648
# report non zero exit code if any failure or error detected
4749
if "$fail" == "true";then

0 commit comments

Comments
 (0)