Start services for your CI tests

This documentation is part of the Use the CLI guide. View the full guide here: Install and use the Stackhero CLI to manage your stacks and services from the command line, scripts, CI, and AI agents.

Your tests can run against a real Stackhero service instead of a mock: your GitHub Actions or GitLab CI pipeline adds the service, runs the tests, and deletes it when the run ends. It takes a few lines:

  1. Create an access token, and store it as the STACKHERO_TOKEN secret of your CI.
  2. Create a stack for your CI, once: stackhero stack-create --name="CI". Each run adds its own service to it, so runs can overlap safely.
  3. In the job, run service-add, then timeout 15m stackhero service-wait-for, then service-configuration-get to read the credentials.
  4. In a step that always runs (if: always() on GitHub Actions, after_script on GitLab CI), run service-delete --confirm. You are never billed for a service your tests no longer use.

Each database, cache, message broker, and search engine has a complete guide with ready-to-copy YAML for both platforms and a real smoke test. For example: PostgreSQL, MySQL, Redis, RabbitMQ, and Elasticsearch.