> For the complete documentation index, see [llms.txt](https://docs.testery.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.testery.io/integrations/ci-cd-integration-guide/circleci.md).

# Set Up CircleCI to Run Testery Tests

Testery integrates with CircleCI via the [Testery CLI](/integrations/testery-cli-docs.md).

You'll need to define a GitHub Actions workflow. This is done by creating a yml file in the `.github/workflows` folder in your repository.

**Step 1. Retrieve your Testery API Token.** To retrieve your token, click **Settings → Integrations → Show API Token** and copy the token that is displayed. Keep this token secure as it allows access to Testery on your behalf.

**Step 2. Store your Testery API Token as a** [**secret environment variable in CircleCI**](https://circleci.com/docs/2.0/env-vars/#section=projects)**.**

**Step 3.** **Add steps to your CircleCI job to install the** [**Testery CLI**](/integrations/testery-cli-docs.md) **and create the test run.**

Here is a sample `.circleci/config.yml`

```yaml
version: 2 # use CircleCI 2.0
jobs: # A basic unit of work in a run
  build: # runs not using Workflows must have a `build` job as entry point
    working_directory: ~/circleci-demo-python-django
    docker: # run the steps with Docker
      - image: circleci/python:3.6.4
    steps: # steps that comprise the `build` job
      - checkout # check out source code to working directory
      - run: sudo chown -R circleci:circleci /usr/local/bin
      - run: sudo chown -R circleci:circleci /usr/local/lib/python3.6/site-packages
      - restore_cache:
      # Read about caching dependencies: https://circleci.com/docs/2.0/caching/
          key: deps9-{{ .Branch }}-{{ checksum "Pipfile.lock" }}
      - run:
          command: |
            pip install testery --upgrade
            testery create-test-run --token "${TESTERY_TOKEN}"  --git-ref "$CIRCLE_SHA1" --build-id "$CIRCLE_BUILD_NUM" --environment "<your-tetsery-environment>" --project "<your-project-key>" --wait-for-results
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.testery.io/integrations/ci-cd-integration-guide/circleci.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
