Using Launchable GitHub Actions
This guide explains connecting your GitHub Actions workflow to your Launchable workspace. When complete, data from your test runs will be sent to your Launchable workspace so you can use Launchable's features.
Note: this guide does not cover Requesting and running a subset of tests. You'll need to use the Launchable CLI for that.
Create and set your API key
Create an API key on the Settings page of your Launchable workspace. (Click the cog ⚙️ icon in the sidebar.)
Then create an encrypted secret called LAUNCHABLE_TOKEN
with your Launchable API key as its value.
Add the Launchable action
Then, locate the step
in your workflow where you run tests. It might look something like this:
jobs:
tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Test
run: <YOUR TEST COMMAND HERE>
If you use actions/checkout
, set fetch-depth: 0
as shown in the example above. Without this setting, Launchable will not receive information about all your commits.
After this, add the Launchable record build and test results action (lines 6-16 below).
The Use latest version button on the GitHub Marketplace page only adds the name:
and uses:
lines.
Add the with:
, if:
, and env:
lines as shown below:
1steps:
2 - uses: actions/checkout@v3
3 with:
4 fetch-depth: 0
5 - name: Test
6 run: <YOUR TEST COMMAND HERE>
7 - name: Record test results to Launchable workspace
8 uses: launchableinc/record-build-and-test-results-action@v1.0.0
9 with:
10 report_path: <PATH TO TEST REPORT XML FILES>
11 test_runner: <YOUR TEST RUNNER HERE>
12 test_suite: <YOUR TEST SUITE NAME>
13 flavors: <YOUR TEST FLAVORS>
14 if: always()
15 env:
16 LAUNCHABLE_TOKEN: ${{ secrets.LAUNCHABLE_TOKEN }}
Then, based on your test runner, set test_runner
and report_path
values as shown below.
You may need to modify the report_path
value to match your setup, so the values below are just suggestions.
Test runner | Values |
---|---|
Android Debug Bridge (adb) |
|
Ant |
|
Bazel |
|
Behave (Python) |
|
CTest |
|
cucumber |
|
Cypress |
|
Flutter |
|
Go Test |
|
GoogleTest |
|
Gradle |
|
Jest |
|
Maven |
|
minitest |
|
Nunit Console Runner |
|
pytest |
|
Robot |
|
RSpec |
|
If you're not using any of these, but your tool outputs JUnit XML report files, you can use:
test_runner: raw
report_path: <PATH TO YOUR REPORT FILES>
If you need to record a build and record test results in separate workflows, you can use the record build action and the record test results to build action instead of the combined action described on this page. The options are the same, just split between the two actions.
Run tests
Run your workflow once you've added the action and set the variables.
If successful, you'll see Launchable output in your build logs, and you'll see your build and test session in the Launchable web app at app.launchableinc.com.
If unsuccessful, you might need to modify your test runner command to ensure it creates test reports that Launchable accepts ⤵️
Update your test runner command
Some tools need to be run in a special way to generate reports that Launchable can read:
Test runner | Modifications |
---|---|
Android Debug Bridge (adb) | None needed |
Ant | None needed |
Bazel | None needed |
Behave (Python) | Run behave with the --junit option |
CTest | Run ctest with the -T test --no-compress-output option |
cucumber | Run cucumber with the -f junit option |
Cypress | None needed |
Go Test |
Use go-junit-report to generate a JUnit XML file after you run tests. |
GoogleTest | Run with the --gtest_output option , e.g. --gtest_output=xml:./report/report.xml |
Gradle | None needed |
Jest | Run jest using jest-junit |
Maven | None needed |
minitest | Use minitest-ci to output test results to a file |
Nunit Console Runner | None needed |
pytest |
Run pytest with the If you are using pytest 6 or newer, you must also specify |
Robot | None needed |
RSpec | Use rspec_junit_formatter to output test results to a file |
Next steps
Get Test Notifications via Slack, and
See Trends in your test sessions,
Find Unhealthy Tests,
Save time running tests and run tests earlier with Predictive Test Selection
Example implementation
1name: Maven test process
2
3on:
4 push:
5 branches: [main]
6 pull_request:
7
8jobs:
9 tests:
10 runs-on: ubuntu-latest
11 steps:
12 - uses: actions/checkout@v3
13 with:
14 fetch-depth: 0
15 - name: Test
16 run: mvn test
17 - name: Record test results to Launchable workspace
18 uses: launchableinc/record-build-and-test-results-action@v1.0.0
19 with:
20 test_runner: maven
21 report_path: './**/target/surefire-reports'
22 test_suite: 'unit-test'
23 flavors: 'os=ubuntu-latest, java=17'
24 if: always()
25 env:
26 LAUNCHABLE_TOKEN: ${{ secrets.LAUNCHABLE_TOKEN }}