
Amplitude Data works best when you integrate it into your continuous integration (CI) workflow alongside your test suite. Amplitude Data integrates with all common CI providers, and you can configure it for custom environments.

After you add Amplitude Data to your CI environment, Amplitude Data verifies your analytics against every build.

{% callout type="note" heading="" %}
Amplitude Data checks your analytics implementation against the tracking plan version your project checks in. If your team made changes to your tracking plan since the last call to `ampli pull`, those changes won't cause a failure in CI.
{% /callout %}

## Step 1: Create an API token

Create an API token for [your Amplitude Data account](https://data.amplitude.com/) by going to _Settings > API Tokens_. Ampli uses this token for authentication when running inside CI to update your tracking plan's implementation status.

{% callout type="warning" heading="" %}
Keep your token secret. Your token has global permissions on your account.
{% /callout %}

## Step 2: Configure a CI environment variable

Create an environment variable in your CI service called `AMPLI_TOKEN` and set it to the API token you created. Use this environment variable to pass the token to `ampli status` when it runs inside CI.

For example, the [Netlify](https://docs.netlify.com/configure-builds/environment-variables/) environment variables screen lists environment variables for each site.

Read the documentation for your CI service to get step-by-step instructions:

- [Bitbucket Pipelines](https://confluence.atlassian.com/bitbucket/variables-in-pipelines-794502608.html)
- [CircleCI](https://circleci.com/docs/2.0/env-vars/)
- [GitLab CI](https://docs.gitlab.com/ee/ci/variables/)
- [Jenkins](https://jenkins.io/doc/pipeline/tour/environment/#credentials-in-the-environment)
- [Travis CI](https://docs.travis-ci.com/user/environment-variables/)

## Step 3: Prepare your project

At this point, you've run `ampli pull` and `ampli status` in your project's root folder. The folder contains an `ampli.json` file with metadata about the current state of the Ampli Wrapper in your project. When you run `ampli status` on your local machine or in CI, Ampli verifies your analytics against this file.

For non-JavaScript and non-TypeScript projects, you don't need more configuration.

For JavaScript and TypeScript projects, you can install Ampli locally as a dev dependency. Installing Ampli locally in the project's `node_modules` folder simplifies Ampli installation and usage for your team and CI environment.

### Install Ampli as a dev dependency

To install Ampli locally, run `npm install @amplitude/ampli -D`.

## Step 4: Run Ampli in CI

To integrate Ampli with your CI system, change your CI configuration to run [`ampli status`](/docs/sdks/ampli/ampli-cli#status) as part of the build process.

### Docker containers

Amplitude provides [Docker containers](https://hub.docker.com/u/amplitudeinc) that include the dependencies required to run the Ampli CLI.

#### amplitudeinc/ampli

Use the [ampli image](https://hub.docker.com/r/amplitudeinc/ampli) to verify any Ampli SDK runtime except .NET.

#### amplitudeinc/ampli-all

Use the [ampli-all image](https://hub.docker.com/r/amplitudeinc/ampli-all) to verify any Ampli SDK runtime, including .NET C#. The `ampli-all` image is larger than the `ampli` image.

{% callout type="note" heading="" %}
Amplitude deprecated the `amplitudeinc/ampli-dotnet` and `amplitudeinc/ampli-swift` containers.

Use the latest version of `amplitudeinc/ampli-all` instead.
{% /callout %}

### GitHub Actions

Use Ampli CLI Docker containers in your GitHub Actions workflows by setting the `container.image` value.

Refer to [GitHub's documentation](https://docs.github.com/en/actions/using-jobs/running-jobs-in-a-container) to learn more about how to run GitHub Actions in containers.

{% code-group %}
```yaml ampli
name: Ampli Implementation Check
on: pull_request

jobs:
    build:
    runs-on: ubuntu-latest
    container:
        image: amplitudeinc/ampli

    steps:
        - name: Checkout repo
        uses: actions/checkout@v3

        - name: Verify analytics implementation and update status in Data
        run: ampli status -t ${{secrets.AMPLI_TOKEN}} [--update]
```

```yaml ampli-all
name: Ampli Implementation Check
on: pull_request

jobs:
    build:
    runs-on: ubuntu-latest
    container:
        image: amplitudeinc/ampli-all

    steps:
        - name: Checkout repo
        uses: actions/checkout@v3

        - name: Verify analytics implementation and update status in Data
        run: ampli status -t ${{secrets.AMPLI_TOKEN}} [--update]
```
{% /code-group %}

### Bitbucket Pipelines

Use Ampli CLI Docker containers in your `bitbucket-pipelines.yml` by setting the `image` value.

{% code-group %}
```yaml ampli
- step:
    name: Run 'ampli status' in CI
    image: amplitudeinc/ampli
        script:
        - ampli status [-u] -t $AMPLI_TOKEN
```

```yaml ampli-all
- step:
    name: Run 'ampli status' in CI
    image: amplitudeinc/ampli-all
        script:
        - ampli status [-u] -t $AMPLI_TOKEN
```
{% /code-group %}

### Other CI systems

The examples above are for GitHub and Bitbucket, but you can use the same images in any CI system that supports containers.

Ampli now runs inside your CI system.
