Skip to content

Commit 1250fd0

Browse files
committed
Update from CI
1 parent 4ee9ece commit 1250fd0

File tree

2 files changed

+3257
-2090
lines changed

2 files changed

+3257
-2090
lines changed

README.md

Lines changed: 50 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,13 @@ Produce an easy-to-read summary of your project's test data as part of your GitH
99
* Integrates easily with your existing GitHub Actions workflow
1010
* Produces summaries from JUnit XML and TAP test output
1111
* Compatible with most testing tools for most development platforms
12-
* Customizable to show just a summary, just failed tests, or all test results.
12+
* Produces step outputs, so you can pass summary data to other actions
13+
* Customizable to show just a summary, just failed tests, or all test results
14+
* Output can go to the [GitHub job summary](https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#adding-a-job-summary) (default), to a file or `stdout`
1315

1416
Getting Started
1517
---------------
16-
To set up the test summary action, just add a few lines of YAML to your GitHub Actions workflow. For example, if your test harness produces JUnit XML outputs in the `test/results/` directory, and you want to produce a test summary in a file named `test-summary.md`, add a new step to your workflow YAML after your build and test step:
18+
To set up the test summary action, just add a few lines of YAML to your GitHub Actions workflow. For example, if your test harness produces JUnit XML outputs in the `test/results/` directory, and you want the output attached to the job summary, add a new step to your workflow YAML after your build and test step:
1719

1820
```yaml
1921
- name: Test Summary
@@ -37,11 +39,20 @@ Update `paths` to match the test output file(s) that your test harness produces.
3739

3840
> Note the `if: always()` conditional in this workflow step: you should always use this so that the test summary creation step runs _even if_ the previous steps have failed. This allows your test step to fail -- due to failing tests -- but still produce a test summary.
3941

40-
Upload the markdown
41-
-------------------
42-
The prior "getting started" step generates a summary in GitHub-flavored Markdown (GFM). Once the markdown is generated, you can upload it as a build artifact, add it to a pull request comment, or add it to an issue. For example, to upload the markdown generated in the prior example as a build artifact:
42+
Generating and uploading a markdown file
43+
----------------------------------------
44+
You can also generate the summary in a GitHub-flavored Markdown (GFM) file, and upload it as a build artifact, add it to a pull request comment, or add it to an issue. Use the `output` parameter to define the target file.
45+
46+
For example, to create a summary and upload the markdown as a build artifact:
4347

4448
```yaml
49+
- name: Test Summary
50+
uses: test-summary/action@v2
51+
with:
52+
paths: "test/results/**/TEST-*.xml"
53+
output: test-summary.md
54+
if: always()
55+
4556
- name: Upload test summary
4657
uses: actions/upload-artifact@v3
4758
with:
@@ -50,6 +61,29 @@ The prior "getting started" step generates a summary in GitHub-flavored Markdown
5061
if: always()
5162
```
5263

64+
Outputs
65+
-------
66+
This action also generates several outputs you can reference in other steps, or even from your job or workflow. These outputs are `passed`, `failed`, `skipped`, and `total`.
67+
68+
For example, you may want to send a summary to Slack:
69+
70+
```yaml
71+
- name: Test Summary
72+
id: test_summary
73+
uses: test-summary/action@v2
74+
with:
75+
paths: "test/results/**/TEST-*.xml"
76+
if: always()
77+
- name: Notify Slack
78+
uses: slackapi/[email protected]
79+
with:
80+
payload: |-
81+
{
82+
"message": "${{ steps.test_summary.outputs.passed }}/${{ steps.test_summary.outputs.total }} tests passed"
83+
}
84+
if: always()
85+
```
86+
5387
Examples
5488
--------
5589
There are examples for setting up a GitHub Actions step with many different platforms [in the examples repository](https://github.com/test-summary/examples).
@@ -94,13 +128,24 @@ Options are specified on the [`with` map](https://docs.github.com/en/actions/usi
94128
```yaml
95129
- uses: test-summary/action@v2
96130
with:
131+
paths: "test/results/**/TEST-*.xml"
97132
output: "test/results/summary.md"
98133
```
99134

100135
If this is not specified, the output will be to the workflow summary.
101136

102137
This file is [GitHub Flavored Markdown (GFM)](https://github.github.com/gfm/) and may include permitted HTML.
103138

139+
* **`show`: the test results to summarize in a table** (optional)
140+
This controls whether a test summary table is created or not, as well as what tests are included. It could be `all`, `none`, `pass`, `skip`, or `fail`. The default is `fail` - that is, the summary table will only show the failed tests. For example, if you wanted to show failed and skipped tests:
141+
142+
```yaml
143+
- uses: test-summary/action@v2
144+
with:
145+
paths: "test/results/**/TEST-*.xml"
146+
show: "fail, skip"
147+
```
148+
104149
FAQ
105150
---
106151
* **How is the summary graphic generated? Does any of my data ever leave GitHub?**

0 commit comments

Comments
 (0)