You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Github Action enabling integration between Junit runners and Trunk Analytics.
Platform Support
Platform
Architecture
Status
Linux
x64, ARM64
Supported
macOS
x64, ARM64
Supported
Windows
x64
Experimental
Usage
Running this action will upload junit.xml files to Trunk Flaky Tests.
Example
name: Upload Test Results to Trunkon:
workflow_dispatch:
jobs:
upload-test-results:
runs-on: ubuntu-latestname: Run tests and upload resultstimeout-minutes: 60steps:
- name: Checkoutuses: actions/checkout@v3
- name: Run testsid: unit-tests# Execute your tests.run: mkdir -p target/path && touch target/path/junit_report.xmlcontinue-on-error: true
- name: Upload resultsuses: trunk-io/analytics-uploader@v2with:
# Path to your test results.junit-paths: "target/path/**/*_test.xml"# Provide your Trunk organization url slug.# To find your org slug, log into app.trunk.io and you should be redirected to a URL like:# https://app.trunk.io/my-trunk-org-slug/repo-owner/repo-name/ci-analyticsorg-slug: my-trunk-org-slug# Provide the ID of the Trunk test collection to upload to.# Find it on the collection's page in app.trunk.io → Flaky Tests → Collections.test-collection-id: abcdabcd# Provide your Trunk API token as a GitHub secret.# You can find Trunk token by navigating to app.trunk.io → Settings → Manage Organization → Organization API Token → View.# To add it as a GitHub secret, see https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions.token: ${{ secrets.TRUNK_API_TOKEN }}# The outcome of the testing stepprevious-step-outcome: ${{ steps.unit-tests.outcome }}
Arguments
Input Sources (At least one required)
Parameter
Description
junit-paths
Comma-separated list of glob paths to junit files.
xcresult-path
Path to the xcresult directory.
bazel-bep-path
Path to the bazel BEP file to parse in place of junits.
swift-test-xunit-paths
Comma-separated list of glob paths to junit files written by swift test --xunit-output, whose tests are attributed to the file each is declared in. Defaults to TRUNK_SWIFT_TEST_XUNIT_PATHS.
Required Parameters
Parameter
Description
org-slug
Organization slug.
test-collection-id
8 character alphanumeric ID of the test collection to upload to. Required unless your organization is still migrating from legacy repo uploads.
token
Organization token. Must be explicitly passed in or defined as an environment variable named TRUNK_API_TOKEN. Defaults to the TRUNK_API_TOKEN when left empty.
allow-forked-pr-uploads
Upload from a forked pull request, which cannot read repository secrets and so has no token. Requires test-collection-id; the collection must have forked-PR uploads enabled in Trunk.
Optional Parameters
Parameter
Description
Default
repo-head-branch
Value to override branch of repository head.
repo-root
The root directory of the repository.
run
The command to run before uploading test results.
cli-version
The version of trunk-analytics-cli to use, downloaded from trunk.io/releases/analytics-cli. latest resolves to the current release.
latest
use-bazel-target-for-codeowners
Use the Bazel target label as a fallback path for CODEOWNERS association when no file attribute is present in the JUnit XML. Only relevant when uploading a Bazel BEP file via bazel-bep-path.
false
allow-missing-junit-files
Whether or not to allow missing junit files in the upload invocation.
true
variant
User specified variant of a set of tests being uploaded. Not usually necessary: set it only when the same tests run in different environments (for example, iOS and Android) and should be tracked separately.
verbose
Enable verbose logging
false
previous-step-outcome
The outcome of the previous step in the workflow. Set this equal to steps.[id].outcome where [id] is the id of the corresponding test run.
show-failure-messages
Show failure outputs in upload. This is experimental, do not rely on this.
false
dry-run
Run without uploading the results to the server. They will instead be dumped to the directory that the action is run in.
false
use-cache
Cache the trunk-analytics-cli binary to reduce subsequent downloads. Set to false to download it on every run.
true
Questions
For any questions, contact us on Slack or refer to our docs.