Skip to main content
Use these pipelines to install dependencies and run npx momentic run. Set MOMENTIC_API_KEY in your provider’s secret store. Sharding examples are included for CircleCI, Buildkite, and Azure DevOps. For GitHub Actions and GitLab CI, see GitHub Actions and GitLab CI. More configs live in momentic-ai/examples. Every example assumes momentic is a dev dependency in the root package.json:
package.json

CircleCI

For CircleCI, create .circleci/config.yml in your repository:
config.yml

CircleCI authentication

Set the MOMENTIC_API_KEY environment variable in your CircleCI project settings.
  1. Create an API key in the Momentic dashboard.
Copy the value. You add it as a CI secret in the next step.
  1. Go to your CircleCI project settings and click the Environment Variables tab. Create a new secret called MOMENTIC_API_KEY and enter your API key.
  2. CircleCI automatically loads environment variables stored in project settings into the CI environment. The CI file needs no changes.

CircleCI sharding

To shard your tests, pass the --shard-index and --shard-count options to the momentic run command. The --shard-index is the index of the current shard (starting from 1), and --shard-count is the total number of shards. To collect test results inside a single run group in the Momentic dashboard, add a separate step after all tests complete to merge and upload results.
config.yml

Jenkins

Configure a NodeJS tool named NodeJS 22 in Jenkins with Node.js 22.12.0 or later in the 22.x line. Node.js 23 is unsupported. Commit package-lock.json for npm ci, then create this Jenkinsfile:
Jenkinsfile

Jenkins authentication

Add the momentic-api-key credential to your Jenkins instance.
  1. Create an API key in the Momentic dashboard.
Copy the value. You add it as a CI secret in the next step.
  1. In Manage Jenkins > Credentials, add a new global credential.
  2. At the top of your Jenkinsfile, provide the following environment variables to the pipeline:
Jenkinsfile

Travis CI

For Travis CI, create .travis.yml in your repository:
.travis.yml

Travis CI authentication

Set the MOMENTIC_API_KEY environment variable in your Travis repository settings.
  1. Create an API key in the Momentic dashboard.
Copy the value. You add it as a CI secret in the next step.
  1. Go to your Travis repository settings and scroll down to the Environment Variables section. Create a new variable called MOMENTIC_API_KEY and enter the value of your API key.
  2. Travis CI automatically loads environment variables stored in project settings into the CI environment. The CI file needs no changes.

Buildkite

Run Momentic on Buildkite. Buildkite is auto-detected, so Momentic reads git metadata (branch, commit, pipeline) from the agent. Create a file called .buildkite/pipeline.yml in your repository with the following contents:
.buildkite/pipeline.yml

Buildkite authentication

To run tests, you must authenticate with Momentic by providing the MOMENTIC_API_KEY environment variable.
  1. Create an API key in the Momentic dashboard.
Copy the value. You add it as a CI secret in the next step.
  1. Store it with the Buildkite secrets tooling your agents use: the secrets Buildkite plugin, your secrets manager, or an agent environment hook. Do not commit it to the pipeline file.
  2. Expose it to the momentic steps as MOMENTIC_API_KEY:
.buildkite/pipeline.yml

Buildkite sharding

Buildkite exposes the parallel job index as BUILDKITE_PARALLEL_JOB (0-indexed) and the total as BUILDKITE_PARALLEL_JOB_COUNT. Momentic’s --shard-index is 1-indexed, so add one. To collect every shard into a single run group in the dashboard, add a step that merges and uploads results after the tests finish.
.buildkite/pipeline.yml

Buildkite Test Analytics

Momentic can emit a Buildkite-format JSON report with the buildkite-json reporter for Buildkite Test Analytics:

Azure DevOps

Run Momentic on Azure Pipelines. Momentic detects Azure DevOps when System.CollectionUri contains azure and reads git metadata from dotted environment variables such as Build.SourceVersion. Create a file called azure-pipelines.yml in your repository with the following contents:
azure-pipelines.yml

Azure DevOps authentication

To run tests, you must authenticate with Momentic by providing the MOMENTIC_API_KEY environment variable.
  1. Create an API key in the Momentic dashboard.
Copy the value. You add it as a CI secret in the next step.
  1. Add it as a secret pipeline variable named MOMENTIC_API_KEY. Mark it as secret so logs mask it. Do not commit it to the pipeline file.
  2. Azure does not pass secret variables to scripts on its own. Map the variable into the environment of each momentic step with env:, as shown above.

Azure DevOps sharding

Use a parallel job strategy and use the 1-indexed System.JobPositionInPhase and total System.TotalJobsInPhase for --shard-index / --shard-count. To collect every shard into a single run group in the dashboard, add a job that merges and uploads results after the tests finish.
azure-pipelines.yml