Configure flakytest in your CI

To configure your CI pipline you have to ensure two things:

  1. flakytest pytest plugin has to be installed when you run your tests. This usually means adding flakytest to your development dependencies e.g. dev-requirements.txt.
  2. The pytest process has to have access to the FLAKYTEST_SECRET_TOKEN environment variable. This usually means adding the token to your CI environment secrets.

Setting up GitHub Actions

To set up flakytest in GitHub Actions you have to add a GitHub icon secret, and then expose it to the run command.

To add the secret, go to your repository settings, and then to the Actions secrets and variables page. Add a new repository secret with the name FLAKYTEST_SECRET_TOKEN and the value of the secret token from your project page. GitHub Actions secret New Secret page

To expose the secret to the run command, you have to add it to the env section of your job. The env section is a dictionary of environment variables that will be available to the run command.

    name: Test
    runs-on: ubuntu-latest
      - name: Checkout
        uses: actions/checkout@v4
      - name: Set up Python
        uses: actions/setup-python@v4
          python-version: 3.12
      - name: Install dependencies
        run: |
          python -m pip install --upgrade pip
          pip install requirements.txt
      - name: Run tests
        run: pytest