Start services for your CI tests
This documentation is part of the Manage your stacks and services with the CLI guide. You can view the complete 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 only takes a few lines:
- Create an access token and store it as the
STACKHERO_TOKENsecret in your CI. - Create a stack for your CI, once:
stackhero stack-create --name="CI". Each run adds its own service to it, so runs can safely overlap. - In the job, run
service-add, thentimeout 15m stackhero service-wait-for, thenservice-configuration-getto read the credentials. - In a step that always runs (
if: always()on GitHub Actions,after_scripton GitLab CI), runservice-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.