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-12 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        if: always()
13        env:
14          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)
  • test_runner: gradle
  • report_path: build/test-results/test
Ant
  • test_runner: ant
  • report_path: .
Bazel
  • test_runner: bazel
  • report_path: .
Behave (Python)
  • test_runner: behave
  • report_path: ./reports/
CTest
  • test_runner: ctest
  • report_path: Testing/
cucumber
  • test_runner: cucumber
  • report_path: ./reports/
Cypress
  • test_runner: cypress
  • report_path: ./report/
Go Test
  • test_runner: go-test
  • report_path: report.xml
GoogleTest
  • test_runner: googletest
  • report_path: ./report/
Gradle
  • test_runner: gradle
  • report_path: build/test-results/test
Jest
  • test_runner: jest
  • report_path: .
Maven
  • test_runner: maven
  • report_path: './**/target/surefire-reports'
minitest
  • test_runner: minitest
  • report_path: "**/reports"
Nunit Console Runner
  • test_runner: nunit
  • report_path: TestResult.xml
pytest
  • test_runner: pytest
  • report_path: ./test-results/
Robot
  • test_runner: robot
  • report_path: output.xml
RSpec
  • test_runner: rspec
  • report_path: report/rspec.xml

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 --junit-xml option, e.g. --junit-xml=test-results/results.xml

If you are using pytest 6 or newer, you must also specify junit_family=legacy (docs)

Robot None needed
RSpec Use rspec_junit_formatter to output test results to a file

Next steps

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        if: always()
23        env:
24          LAUNCHABLE_TOKEN: ${{ secrets.LAUNCHABLE_TOKEN }}