Run Stably CLI commands in any CI/CD environment with environment variable authentication.
The Stably CLI can run in any CI/CD environment, not just GitHub Actions. This guide covers how to authenticate and run tests using environment variables, making it easy to integrate with GitHub Actions, GitLab CI, CircleCI, Jenkins, Bitbucket Pipelines, and other CI systems.
In CI environments, authentication is handled through environment variables instead of interactive browser login. You must set two environment variables:
Once the environment variables are set, you can run any Stably CLI command without interactive authentication. Stably is fully Playwright compatible — all Playwright CLI options are supported:
Copy
# Run all testsnpx stably test# Run with Playwright optionsnpx stably test --headed --project=chromium# Run specific test filenpx stably test tests/login.spec.ts# More Playwright optionsnpx stably test --workers=4 --retries=2 --grep="login"
stages: - teststably_tests: stage: test image: node:20 variables: STABLY_API_KEY: $STABLY_API_KEY STABLY_PROJECT_ID: $STABLY_PROJECT_ID before_script: - npm ci - npx stably install script: - npx stably test
In GitLab, add STABLY_API_KEY and STABLY_PROJECT_ID as CI/CD variables in Settings > CI/CD > Variables. Mark them as Protected and Masked for security.
Add STABLY_API_KEY and STABLY_PROJECT_ID in CircleCI under Project Settings > Environment Variables. Project-level environment variables are automatically available to all jobs — no need to redeclare them in the config file.