Before you start, make sure Rust runs with access to CI environment variables.
Create a test suite and copy the API token that it gives you.
$ cargo install buildkite-test-collector # or $ cargo install --git https://github.com/buildkite/test-collector-rust buildkite-test-collector
Configure your environment:
BUILDKITE_ANALYTICS_TOKENenvironment variable to contain the token provided by the analytics project settings.
We try and detect several common CI environments based in the environment variables which are present. If this detection fails then the application will crash with an error. To force the use of a "generic CI environment" set the
CIenvironment variable to any non-empty value.
Change your test output to JSON format:
In your CI environment you will need to change your output format to
--report-timeto include execution times in the output. Unfortunately, these are currently unstable options for Rust, so some extra command line options are needed. Once you have the JSON output you can pipe it through the
buildkite-test-collectorbinary - the input JSON is echoed back to STDOUT so that you can still operate upon it if needed.
$ cargo test -- -Z unstable-options --format json --report-time | buildkite-test-collector
Confirm correct operation. Verify that the run is visible in the Buildkite analytics dashboard