Monitoring Java Tests using GitHub Actions
We tailor-built Foresight work flawlessly with GitHub Actions to offer you the best seamless monitoring/debugging experience.
You can integrate your GitHub Actions pipeline workflow with Foresight to monitor the test runs of your Java project with Maven and Gradle.

Prerequisites

The required parameters are the Thundra API Key and the Thundra Project ID, which can be obtained from the project settings screen.
Once you get your keys, make sure to set it as a secret.
Be aware that to trace JUnit5 tests, junit-platform-launcher and junit-platform-engine dependencies must be available at classpath during test execution.
As you can add those dependencies one by one, you can also simply add only junit-platform-runner dependency which includes both other dependencies mentioned above transitively.

Supported Runtimes

Foresight supports:
for Github Actions.

Starting with a Maven workflow template

A GitHub Action to integrate your Maven with Thundra Agent.
1
# ...
2
3
steps:
4
- uses: actions/[email protected]
5
- name: Set up JDK 1.8
6
uses: actions/[email protected]
7
with:
8
java-version: 1.8
9
- name: Thundra Maven Test Instrumentation
10
uses: thundra-io/[email protected]
11
with:
12
apikey: ${{ secrets.THUNDRA_APIKEY }}
13
project_id: ${{ secrets.THUNDRA_PROJECT_ID }}
14
15
# Modify or remove the command if you already have one
16
command: mvn clean install
Copied!
If you are looking for manual integration for Maven, learn more

Parameters

Name
Requirement
Description
apikey
Required
Thundra API Key
project_id
Required
Your project id from Thundra. Will be used to filter and classify your testruns.
command
Optional
The Maven command you want to run. The given command will be executed right after the instrumentation. However, if it's not present, the action will end once the instrumentation is finished. This is optional in case you want to do more before you actually run your tests.
instrumenter_version
Optional
In the action itself, we use a Java script to manipulate pom.xml files. This script is released and versioned separately from the action. Hence, if there is some breaking change or specific version you want to use, you can use it by defining this parameter. You can see all the available version of our instrumenter here.
agent_version
Optional
A specific version Thundra Java Agent you want to use should be defined here. Similar to instrumenter_version parameter. You can see all the available version of our agent here.

Starting with a Gradle workflow

A GitHub Action to instrument your Gradle with Thundra Agent.
1
# ...
2
3
steps:
4
- uses: actions/[email protected]
5
- name: Set up JDK 1.8
6
uses: actions/[email protected]
7
with:
8
java-version: 1.8
9
- name: Thundra Gradle Test Instrumentation
10
uses: thundra-io/[email protected]
11
with:
12
apikey: ${{ secrets.THUNDRA_APIKEY }}
13
project_id: ${{ secrets.THUNDRA_PROJECT_ID }}
14
15
# Modify or remove the command if you already have one
16
command: ./gradlew build
Copied!
If you are looking for manual integration for Gradle, learn more

Parameters

Name
Requirement
Description
apikey
Required
Thundra API Key
project_id
Required
Your project id from Thundra. Will be used to filter and classify your testruns.
command
Optional
The Gradle command you want to run. The given command will be executed with the instrumentation init script. However, if it's not present, the action will end once the instrumentation init script is generated. This is optional in case you want to do more before you actually run your tests. See the Manual Usage for more.
plugin_version
Optional
In the action itself, we use a Gradle plugin to run your tests. This plugin is released and versioned separately from the action. Hence, if there is some breaking change or specific version you want to use, you can use it by defining this parameter. You can see all the available version of our plugin here.
agent_version
Optional
A specific version Thundra Java Agent you want to use should be defined here. Similar to plugin_version parameter. You can see all the available version of our agent here.
Last modified 15d ago