Buildkite
Lightspeed has built-in support for running on Buildkite agents.
The environment is automatically detected and all you need to do is configure the desired level of parallelism
for your tests.
For example, to run your tests over 3 nodes and cut your test time by 67% is:
yaml
steps:
- label: ':php: Run tests'
commands:
- composer install --no-interaction --no-progress
- php vendor/bin/lightspeed
parallelism: 3
plugins:
- docker#v5.8.0:
image: composer:2
propagate-environment: true
steps:
- label: ':php: Run tests'
commands:
- composer install --no-interaction --no-progress
- php vendor/bin/lightspeed
parallelism: 3
plugins:
- docker#v5.8.0:
image: composer:2
propagate-environment: true
or with docker-compose:
yaml
steps:
- label: ':php: Run tests'
commands:
- composer install --no-interaction --no-progress
- php vendor/bin/lightspeed
parallelism: 3
plugins:
- docker-compose#v4.14.0:
run: tests
propagate-environment: true
steps:
- label: ':php: Run tests'
commands:
- composer install --no-interaction --no-progress
- php vendor/bin/lightspeed
parallelism: 3
plugins:
- docker-compose#v4.14.0:
run: tests
propagate-environment: true
Using with docker/docker-compose
When using the docker or docker-compose plugins, you need to ensure the Buildkite environment variables are propagated to the container so Lightspeed can properly detect it is running on Buildkite.
The following environment variables are required for use:
BUILDKITE_BRANCH
BUILDKITE_BUILD_NUMBER
BUILDKITE_COMMIT
BUILDKITE_MESSAGE
BUILDKITE_PARALLEL_JOB_COUNT
BUILDKITE_PARALLEL_JOB
BUILDKITE
Ensuring uniqueness
If you require a unique value across all tests, you can make use of the BUILDKITE_JOB_ID
environment variable. This will be unique for each instance of Lightspeed that is running.