---
updatedAt: 2026-03-12T23:39:57.000Z
agentTools:
  projectIndex: https://help.rainforestqa.com/llms.txt
---

# Using the CLI for Continuous Integration

Learn how to integrate Rainforest into your CI/CD pipeline.

<br />

<HTMLBlock>{`
<style>
.cm-s-neo {
  white-space: break-spaces;
  word-break: break-word;
}
</style>
`}</HTMLBlock>

## Overview

Rainforest makes it easy to integrate testing into your release process. Configure virtually any CI tool to run Rainforest tests as part of your CI/CD pipeline. If you are looking for more information on running tests from the CLI please visit our page on [executing tests from the CLI](https://help.rainforestqa.com/docs/running-tests-from-the-cli). For more information, see:

* <a href="https://github.com/rainforestapp/rainforest-cli" target="_blank">The Rainforest CLI</a>
* <a href="https://github.com/rainforestapp/ci-sample" target="_blank">CI Sample Repository</a>

If you use <a href="https://circleci.com/" target="_blank">CircleCI</a>, a hosted continuous integration (CI) server, our <a href="https://circleci.com/developer/orbs/orb/rainforest-qa/rainforest" target="_blank">CircleCI Orb</a> allows for an easy, out-of-the-box integration.

Likewise, if you use <a href="https://docs.github.com/en/actions" target="_blank">GitHub Actions</a> for your CI/CD, we offer a <a href="https://github.com/marketplace/actions/rainforest-qa-github-action" target="_blank">GitHub Action</a> for easy integration there as well.

## CI Integration with the Rainforest CLI

To integrate Rainforest with any CI server or deployment tool, we wrote a command-line interface that triggers a run of your tests from any script. For more information, see [How to Install the CLI](https://help.rainforestqa.com/docs/how-to-install-the-cli) . You can find your API token in the <a href="https://app.rainforestqa.com/settings/integrations" target="_blank">Settings > Integrations</a> page of your Rainforest Account.

Run a specific run group using the following command:

```
rainforest run --run-group <run_group_id>
```

**Note**: This can also be copied from Settings section of the run group page with the corresponding run group ID. Additionally this run will follow the run group settings you have set, if you would like set a different <code>--execution-method</code> be sure to specify in the command.
This would look like:

```
rainforest run --run-group <run_group_id> --execution-method automation
```

Run all your tests using the following command:

```
rainforest run --token <YOUR API TOKEN> --fail-fast --description "CI automatic run" all
```

The `--fail-fast` option makes the Rainforest tool return immediately after the first failure.
The `--description` option adds an arbitrary description to the run.
For a comprehensive list of options, refer to our <a href="https://github.com/rainforestapp/rainforest-cli" target="_blank">open-source project</a>.

To view examples of how to configure standard CI tools to automatically run your test suite, see our <a href="https://github.com/rainforestapp/ci-sample" target="_blank">CI Sample Repository</a>.

## Git Triggers with Rainforest CLI

The Rainforest CLI supports triggering based on the contents of a `git commit` message. This is useful when Rainforest is integrated into your CI server, but you want more control over what is tested.

To enable this feature, add `--git-trigger` to the command line options you pass to Rainforest. With this flag enabled, the CLI client does nothing unless the last commit message for your project contains `@rainforest` and one or more hashtags. Here’s an example:

`"Fixed the login button"` is the last commit.
Instead of triggering `rainforest "Fixed the login button. @rainforest #login"`, we start a `rainforest run` with anything tagged `login`.

Use `git-trigger` to enable teams to test feature branches for speed before your work is merged into a release branch. For more details on how to get started with this workflow, contact our Support team.

## CI Integration with CircleCI

For the whole picture, we encourage you to consult CircleCI’s <a href="https://circleci.com/docs/2.0/getting-started/" target="_blank">Getting Started</a> documentation. If CircleCI is already set up, check out our <a href="https://circleci.com/developer/orbs/orb/rainforest-qa/rainforest" target="_blank">CircleCI Orb</a> to easily integrate Rainforest tests into your CI flow.

### The config.yml File

The primary way to configure the CircleCI tool is to store a file in your git repository. You can see the sample configuration for our project <a href="https://github.com/rainforestapp/ci-sample/blob/master/.circleci/config.yml" target="_blank">here</a>.

Notice that instead of entering the Rainforest API key directly in the `config.yml` file, we use environment-specific <Glossary>test data</Glossary>. We do this for security reasons. We don’t want to expose sensitive information to any reader of the file, especially when the repository is public. For more information, see [Using Test Data](using-test-data) .

Configure test data in your project’s <a href="https://app.rainforestqa.com/settings/steps" target="_blank">Test Data</a> settings. You can find your Rainforest API token by navigating to your <a href="https://app.rainforestqa.com/settings/integrations" target="_blank">Integrations</a> settings.

<Image align="center" alt={441} caption="Your Rainforest API token." title="Screen Shot 2021-05-24 at 2.25.28 PM.png" src="https://files.readme.io/e568960-Screen_Shot_2021-05-24_at_2.25.28_PM.png" />

Create a `RAINFOREST_TOKEN` environment variable in CircleCI corresponding to your test data, and you’re done. For more information, see CircleCI’s <a href="https://circleci.com/docs/2.0/env-vars/#setting-environment-variables-for-all-commands-without-adding-them-to-git" target="_blank">Using Environment Variables</a>.

Our project is configured to provide a <a href="https://www.rainforestqa.com/blog/2017-05-18-the-role-of-qa-testing-in-continuous-delivery" target="_blank">continuous delivery</a> flow by default. Every time code is pushed to the `develop` branch, CircleCI:

1. Runs the automated tests.
2. Deploys the `develop` branch to a staging server.
3. Runs the Rainforest tests using the CLI on the staging server.
4. Once the Rainforest tests are successful, CircleCI pushes the `develop` branch to the `master` branch.
5. The previous step triggers another CI build, which pushes the code to production.

If any step fails, the build fails. This prevents the deployment of broken code to your users.

## Testing Your Setup

You can test your setup by committing a change to your `develop` branch and pushing it to your git repository. CircleCI picks up the change and deploys your code. With a new continuous delivery flow and QA process, you can move fast while not breaking anything.

**Note:** If you don’t see an API token in your Rainforest settings, click the Rotate API Token button to generate a new one.

<hr />

*If you have any questions, reach out to us at <support@rainforestqa.com>.*