• Stars
    star
    297
  • Rank 140,075 (Top 3 %)
  • Language
    TypeScript
  • License
    Apache License 2.0
  • Created almost 4 years ago
  • Updated 4 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Reports junit test results as GitHub Pull Request Check
:octocat:

action-junit-report

... reports JUnit test results as GitHub pull request check.



What's included 🚀Setup 🛠️Sample 🖥️Contribute 🧬License 📓


What's included 🚀

  • Flexible JUnit parser with wide support
  • Supports nested test suites
  • Blazingly fast execution
  • Lighweight
  • Rich build log output

This action processes JUnit XML test reports on pull requests and shows the result as a PR check with summary and annotations.

Based on action for Surefire Reports by ScaCap

Setup

Configure the workflow

name: build
on:
  pull_request:

jobs:
  build:
    name: Build and Run Tests
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Code
        uses: actions/checkout@v1
      - name: Build and Run Tests
        run: # execute your tests generating test results
      - name: Publish Test Report
        uses: mikepenz/action-junit-report@v3
        if: success() || failure() # always run even if the previous step fails
        with:
          report_paths: '**/build/test-results/test/TEST-*.xml'

Inputs

Input Description
report_paths Required. Glob expression to junit report paths. Defaults to: **/junit-reports/TEST-*.xml.
token Optional. GitHub token for creating a check run. Set to ${{ github.token }} by default.
test_files_prefix Optional. Prepends the provided prefix to test file paths within the report when annotating on GitHub.
exclude_sources Optional. Provide , seperated array of folders to ignore for source lookup. Defaults to: /build/,/__pycache__/
check_name Optional. Check name to use when creating a check run. The default is JUnit Test Report.
suite_regex Optional. Regular expression for the named test suites. E.g. Test*
commit Optional. The commit SHA to update the status. This is useful when you run it with workflow_run.
fail_on_failure Optional. Fail the build in case of a test failure.
require_tests Optional. Fail if no test are found.
require_passed_tests Optional. Fail if no passed test are found. (This is stricter than require_tests, which accepts skipped tests).
include_passed Optional. By default the action will skip passed items for the annotations. Enable this flag to include them.
check_retries Optional. If a testcase is retried, ignore the original failure.
check_title_template Optional. Template to configure the title format. Placeholders: {{FILE_NAME}}, {{SUITE_NAME}}, {{TEST_NAME}}.
summary Optional. Additional text to summary output
update_check Optional. Uses an alternative API to update checks, use for cases with more than 50 annotations. Default: false.
annotate_only Optional. Will only annotate the results on the files, won't create a check run. Defaults to false.
transformers Optional. Array of Transformers offering the ability to adjust the fileName. Defaults to: [{"searchValue":"::","replaceValue":"/"}]
job_summary Optional. Enables the publishing of the job summary for the results. Defaults to true. May be required to disable Enterprise Server
detailed_summary Optional. Include table with all test results in the summary. Defaults to false.
annotate_notice Optional. Annotate passed test results along with warning/failed ones. Defaults to false. (Changed in v3.5.0)
follow_symlink Optional. Enables to follow symlinks when searching test files via the globber. Defaults to false.
job_name Optional. Specify the name of a check to update
annotations_limit Optional. Specify the limit for annotations. This will also interrupt parsing all test-suites if the limit is reached. Defaults to: No Limit.
Common `report_paths`

  • Surefire: **/target/surefire-reports/TEST-*.xml

Action outputs

After action execution it will return the test counts as output.

# ${{steps.{CHANGELOG_STEP_ID}.outputs.total}}

A full set list of possible output values for this action.

Output Description
outputs.total The total number of test cases covered by this test-step.
outputs.passed The number of passed test cases.
outputs.skipped The number of skipped test cases.
outputs.failed The number of failed test cases.

PR run permissions

The action requires write permission on the checks. If the GA token is read-only (this is a repository configuration) please enable write permission via:

permissions:
  checks: write

Additionally for security reasons, the github token used for pull_request workflows is marked as read-only. If you want to post checks to a PR from an external repository, you will need to use a separate workflow which has a read/write token, or use a PAT with elevated permissions.

Example

name: build
on:
  pull_request:

jobs:
  build:
    name: Build and Run Tests
    runs-on: ubuntu-latest
    steps:
      - name: Checkout Code
        uses: actions/checkout@v3
      - name: Build and Run Tests
        run: # execute your tests generating test results
      - name: Upload Test Report
        uses: actions/upload-artifact@v3
        if: always() # always run even if the previous step fails
        with:
          name: junit-test-results
          path: '**/build/test-results/test/TEST-*.xml'
          retention-days: 1

---
name: report
on:
  workflow_run:
    workflows: [build]
    types: [completed]
    
permissions:
  checks: write

jobs:
  checks:
    runs-on: ubuntu-latest
    steps:
      - name: Download Test Report
        uses: dawidd6/action-download-artifact@v2
        with:
          name: junit-test-results
          workflow: ${{ github.event.workflow.id }}
          run_id: ${{ github.event.workflow_run.id }}
      - name: Publish Test Report
        uses: mikepenz/action-junit-report@v3
        with:
          commit: ${{github.event.workflow_run.head_sha}}
          report_paths: '**/build/test-results/test/TEST-*.xml'

This will securely post the check results from the privileged workflow onto the PR's checks report.

Sample 🖥️

Contribute 🧬

# Install the dependencies  
$ npm install

# Verify lint is happy
$ npm run lint -- --fix

# Build the typescript and package it for distribution
$ npm run build && npm run package

# Run the tests, use to debug, and test it out
$ npm test

Credits

Original idea and GitHub Actions by: https://github.com/ScaCap/action-surefire-report

Other actions

License

Copyright (C) 2022 Mike Penz

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

More Repositories

1

MaterialDrawer

The flexible, easy to use, all in one drawer library for your Android project. Now brand new with material 2 design.
Kotlin
11,670
star
2

Android-Iconics

Android-Iconics - Use any icon font, or vector (.svg) as drawable in your application.
Kotlin
5,166
star
3

FastAdapter

The bullet proof, fast and easy to use adapter library, which minimizes developing time to a fraction...
Kotlin
3,828
star
4

AboutLibraries

AboutLibraries automatically collects all dependencies and licenses of any gradle project (Kotlin MultiPlatform), and provides easy to integrate UI components for Android and Compose-jb environments
Kotlin
3,595
star
5

LollipopShowcase

A simple app to showcase Androids Material Design and some of the cool new cool stuff in Android Lollipop. RecyclerView, CardView, ActionBarDrawerToggle, DrawerLayout, Animations, Android Compat Design, Toolbar
Java
1,762
star
6

Android-ActionItemBadge

This library offers a simple method to add a small badge icon to your ActionBar-MenuItem
Java
1,274
star
7

wallsplash-android

wall:splash is a free open source android client for the awesome unsplash.com service (Free (do whatever you want) high-resolution photos)
Java
793
star
8

release-changelog-builder-action

A GitHub action that builds your release notes / changelog fast, easy and exactly the way you want.
TypeScript
693
star
9

multiplatform-markdown-renderer

Markdown renderer for Kotlin Multiplatform Projects (Android, iOS, Desktop), using Compose.
Kotlin
363
star
10

ItemAnimators

ItemAnimators: Supercharged Animators for your RecyclerView
Java
336
star
11

Materialize

A easy helper library for Android to manage your applications StatusBarShadow, FullScreen behavior and much more over API Levels down to 10
Java
295
star
12

HypnoticCanvas

A shader modifier for Compose Multiplatform / Jetpack Compose
Kotlin
132
star
13

AnimatedGridView

A simple library which adds some basic animation if you delete fields. There's also a HeaderGridView if you need such a view for your projects :D
Java
116
star
14

CrossfadeDrawerLayout

Add a 2-Step DrawerLayout to your application, with a nice crossfade effect
Java
95
star
15

Crossfader

Crossfader is a small library to provide an easy to use and fast helper class for the great CrossFadeSlidingPaneLayout
Java
81
star
16

gradle-dependency-submission

Calculates dependencies for a Gradle build-target and submits the list to the Dependency Submission API
TypeScript
80
star
17

xray-action

... a GitHub action to import test results into "Xray" - A complete Test Management tool for Jira.
TypeScript
47
star
18

storyblok-mp-SDK

Storyblok Kotlin Multiplatform SDK (Android, JVM, JS, iOS, ...)
Kotlin
22
star
19

ModernJenkins-Theme

A quick css to beautify your jenkins (SimpleThemePlugin required)
CSS
20
star
20

HoloKitKatDrawer

[DEPRECATED] See for the MaterialDrawer for updates | Description: A simple Project to show how to use the new TranslucentDecor with a Drawer
Java
14
star
21

Storyblok-Android-SDK

Storyblok MP SDK available here: https://github.com/mikepenz/storyblok-mp-SDK
Kotlin
14
star
22

ApplicationReader

[DEPRECATED] OpenSourced source code for ApplicationReader util used for icon themeing
Java
9
star
23

Alternative-findr

[DEPRECATED!] Android application for the awesome site alternative.to
Java
6
star
24

storyblok-mp-SDK-sample

Storyblok Kotlin Multiplatform SDK sample (Android, JVM, JS)
Kotlin
6
star
25

jira-release-composite-action

Composite action, taking release notes as input, and automatically migrating tickets for release
6
star
26

storyblok-mp-SDK-blog

Blog implemented via the Storyblok Kotlin Multiplatform SDK (Android, JVM)
Kotlin
5
star
27

blog_CredentialShowcase

Simple showcase to highlight credential security
Kotlin
2
star
28

SpannableBar

Java
2
star
29

teaMSeven-MOD

[DEPRECATED] A smart tool for our awesome teaMSeven Kernel!
Java
1
star
30

InterfaceLIFT-Pane

An InterfaceLIFT Preference Pane for Mac OS X
Objective-C
1
star
31

MIcons-Builder

[DEPRECATED] MIUI Icons Builder/Configurator
JavaScript
1
star
32

release-changelog-builder-action-playground

Playground repo for testing purposes of the release-changelog-builder-action
1
star