A GitHub Action that generates a human-readable test report from the Xcode result bundle and shows it on GitHub Checks.
The result is formatted into a test report that shows the success or failure of the tests, code coverages, logs, activities, and saved screenshots.
Here is an example result.
This action only works on macOS builders.
By default xcodebuild
will generate the xcresult
bundle file to a randomly named directory in DerivedData
. To use this action xcodebuild
needs to generate xcresult
bundle to an accessible location.
This can be done using the -resultBundlePath
flag in xcodebuild
.
The following action uses a script action to invoke xcodebuild and store the results
in TestResults.xcresult
jobs:
test:
runs-on: macos-11
- name: Run Tests
run: |
xcodebuild -scheme MyFramework -resultBundlePath TestResults test
For complete input/output documentation, see action.yml.
- uses: kishikawakatsumi/xcresulttool@v1
with:
path: TestResults.xcresult
if: success() || failure()
# ^ This is important because the action will be run
# even if the test fails in the previous step.
jobs:
test:
runs-on: macos-11
name: Test
steps:
- uses: actions/checkout@v2
- name: Test
run: |
xcodebuild -scheme MyFramework -resultBundlePath TestResults test
- uses: kishikawakatsumi/xcresulttool@v1
with:
path: TestResults.xcresult
if: success() || failure()
# ^ This is important because the action will be run
# even if the test fails in the previous step.
- uses: kishikawakatsumi/xcresulttool@v1
with:
path: |
results/Example.xcresult
results/TestResult.xcresult
results/Result.xcresult
if: success() || failure()
- uses: kishikawakatsumi/xcresulttool@v1
with:
# Path to the xcresult bundle.
path: 'TestResults.xcresult'
# The GitHub authentication token to create the check.
#
# Default: ${{ github.token }}
token: ''
# Title for the check results.
#
# Default: 'Xcode test results'
title:
# Whether to show the details of passed tests;
# if false, only failed tests will be reported in detail section.
#
# Default: true
show-passed-tests:
# Whether to show code coverage (if coverage data exists).
#
# Default: true
show-code-coverage:
# Whether to upload the xcresult bundles. possible values: always, failure, never. Specifying failure will only upload the bundle if all the tests do not pass.
#
# Default: 'always'
upload-bundles:
GitHub Checks has a maximum text limit of 65535 characters. Currently, any text longer than that will be automatically truncated.
There is a limit of 50 annotations in GitHub Checks. Currently, any annotations longer than that will be automatically truncated.
You can set the show-passed-tests
option to false
to reduce the output to avoid the limitation.