# 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)**.**&#x20;

**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: 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:

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

The question should be specific, self-contained, and written in natural language.
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.
