Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test-report action #114

Merged
merged 2 commits into from
Sep 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions test-report/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# <!--name-->test-report<!--/name-->

[![usages](https://img.shields.io/badge/usages-white?logo=githubactions&logoColor=blue)](https://github.com/search?q=elastic%2Foblt-actions%2Ftest-report+%28path%3A.github%2Fworkflows+OR+path%3A**%2Faction.yml+OR+path%3A**%2Faction.yaml%29&type=code)

<!--description-->
Shows test results in GitHub UI: .NET (xUnit, NUnit, MSTest), Dart, Flutter, Java (JUnit), JavaScript (JEST, Mocha)
<!--/description-->

## Inputs

<!--inputs-->
| Name | Description | Required | Default |
|-----------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------|---------------|
| `artifact` | Name or regex of artifact containing test results | `false` | `all` |
| `name` | Name of the check run | `false` | `JUnit Tests` |
| `path` | Coma separated list of paths to test results<br>Supports wildcards via [fast-glob](https://github.com/mrmlnc/fast-glob)<br>All matched result files must be of same format<br> | `true` | `**/*.xml` |
| `reporter` | Format of test results. Supported options:<br> - dart-json<br> - dotnet-trx<br> - flutter-json<br> - java-junit<br> - jest-junit<br> - mocha-json<br> - mochawesome-json<br> | `true` | `java-junit` |
| `list-suites` | Limits which test suites are listed. Supported options:<br> - all<br> - failed<br> | `true` | `all` |
| `list-tests` | Limits which test cases are listed. Supported options:<br> - all<br> - failed<br> - none<br> | `true` | `all` |
| `fail-on-error` | Set this action as failed if test report contain any failed test | `true` | `true` |
| `only-summary` | Allows you to generate only the summary.<br>If enabled, the report will contain a table listing each test results file and the number of passed,<br>failed, and skipped tests.<br>Detailed listing of test suites and test cases will be skipped.<br> | `false` | `false` |
| `output-to` | The location to write the report to. Supported options:<br> - checks<br> - step-summary<br> | `false` | `checks` |
<!--/inputs-->

## Usage

<!--usage action="elastic/oblt-actions/**" version="env:VERSION"-->
```yaml
on:
workflow_run:
workflows:
- test
types:
- completed

permissions:
contents: read
actions: read
checks: write

jobs:
report:
runs-on: ubuntu-latest
steps:
- uses: elastic/oblt-actions/test-report@v1
with:
artifact: test-results
name: JUnit Tests
path: "**/*-python-agent-junit.xml"
reporter: java-junit
```
<!--/usage-->
81 changes: 81 additions & 0 deletions test-report/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
---
name: 'test-report'
description: |
Shows test results in GitHub UI: .NET (xUnit, NUnit, MSTest), Dart, Flutter, Java (JUnit), JavaScript (JEST, Mocha)
inputs:
artifact:
description: Name or regex of artifact containing test results
default: 'all'
required: false
name:
description: Name of the check run
default: 'JUnit Tests'
required: false
path:
description: |
Coma separated list of paths to test results
Supports wildcards via [fast-glob](https://github.com/mrmlnc/fast-glob)
All matched result files must be of same format
default: '**/*.xml'
required: true
reporter:
description: |
Format of test results. Supported options:
- dart-json
- dotnet-trx
- flutter-json
- java-junit
- jest-junit
- mocha-json
- mochawesome-json
default: 'java-junit'
required: true
list-suites:
description: |
Limits which test suites are listed. Supported options:
- all
- failed
required: true
default: 'all'
list-tests:
description: |
Limits which test cases are listed. Supported options:
- all
- failed
- none
required: true
default: 'all'
fail-on-error:
description: Set this action as failed if test report contain any failed test
required: true
default: 'true'
only-summary:
description: |
Allows you to generate only the summary.
If enabled, the report will contain a table listing each test results file and the number of passed,
failed, and skipped tests.
Detailed listing of test suites and test cases will be skipped.
default: 'false'
required: false
output-to:
description: |
The location to write the report to. Supported options:
- checks
- step-summary
default: 'checks'
required: false
runs:
using: "composite"
steps:
- name: Report test results
uses: phoenix-actions/test-reporting@f957cd93fc2d848d556fa0d03c57bc79127b6b5e # v15
with:
artifact: ${{ inputs.artifact }}
name: ${{ inputs.name }}
path: ${{ inputs.path }}
reporter: ${{ inputs.reporter }}
list-suites: ${{ inputs.list-suites }}
list-tests: ${{ inputs.list-tests }}
fail-on-error: ${{ inputs.fail-on-error }}
only-summary: ${{ inputs.only-summary }}
output-to: ${{ inputs.output-to }}
Loading