The official Rust adapter for Buildkite Test Analytics which implements a parser and sender for Rust's JSON test output.
📦 Supported CI systems: Buildkite, GitHub Actions, CircleCI, and others via the BUILDKITE_ANALYTICS_*
environment variables.
-
Create a test suite, and copy the API token that it gives you.
-
Install the
buildkite-test-collector
crate
cargo install buildkite-test-collector
Alternatively you can install direct from the repo
cargo install --git https://github.com/buildkite/test-collector-rust buildkite-test-collector
- Configure your environment
Set the BUILDKITE_ANALYTICS_TOKEN
environment 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" just set
the CI
environment 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 JSON
and
add --report-time
to 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 simply pipe it
through the buildkite-test-collector
binary - 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
See the GitHub 'enhancement' issues for planned features. Pull requests are always welcome, and we’ll give you feedback and guidance if you choose to contribute 💚
After cloning the repository, run the tests:
cargo test
Useful resources for developing collectors include the Buildkite Test Analytics docs and the RSpec and Minitest collectors.
Bug reports and pull requests are welcome on GitHub at https://github.com/buildkite/test-collector-rust
Version bump the code, tag and push
cargo install cargo-bump
cargo bump --git-tag
git push && git push --tags
Publish to the Cargo registry
cargo publish
Create a new GitHub release
open "https://github.com/buildkite/test-collector-rust/releases"
The package is available as open source under the terms of the MIT License.
Thanks to the folks at Alembic for building and maintaining this package.