- A clean machine for every run, with nothing left over from the previous one.
- More power than the CI runner when you need it (the
largeandxlargesizes), and Docker on thevmruntime. - The test output streamed live into your CI log, as the tests run.
- A way to investigate failures: when a run fails, you can keep its sandbox and look inside to see why.
The script
A single script does all of this. It packs up the project, sends it to a sandbox, runs the tests, streams their output into the log, and finally exits with the same code as the tests, so your CI marks the build as passed or failed. You can run it from GitHub Actions, GitLab, Jenkins, or your own terminal.1
A project to test
To keep the example self-contained, we create a tiny project with one module and its tests. In your pipeline, this
would be your own repository.
2
Send it and run the tests
3
Pass or fail the build
In GitHub Actions
.github/workflows/tests.yml
sandboxes.* scope and set to expire. That way it can only manage
sandboxes, and only for a limited time. See API keys.
Debug a failure
When a run fails, the script keeps its sandbox instead of deleting it. That lets you look inside the exact machine where the tests failed: its files, its installed packages and its logs. You can find it by its labels and run commands in it from your terminal:Terminal
Faster runs
Once the basic setup works, these changes make each run faster:Clean up
Related
Run commands
How streaming output and exit codes work.
Docker Compose
Run integration tests against real databases and services.