#cargo #test #buildkite #analytics

app buildkite-test-collector

Official Buildkite Test Analytics Collector for Rust

1 unstable release

Uses new Rust 2021

0.1.0 Jun 3, 2022

#109 in Testing

MIT license

683 lines

Buildkite Test Collector for Rust (Beta)

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.

👉 Installing

  1. Create a test suite, and copy the API token that it gives you.

  2. Install the buildkite-test-collector crate

$ cargo install buildkite-test-collector
# or
$ cargo install --git https://github.com/buildkite/test-collector-rust buildkite-test-collector
  1. 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.

  1. 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 operrate upon it if needed.

$ cargo test -- -Z unstable-options --format json --report-time | buildkite-test-collector
  1. Confirm correct operation

Verify that the run is visible in the Buildkite analytics dashboard

🔜 Roadmap

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 💚

⚒ Developing

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.

👩‍💻 Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/buildkite/test-collector-rust

🚀 Releasing

# 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"

📜 License

The package is available as open source under the terms of the MIT License.

🤙 Thanks

Thanks to the folks at Alembic for building and maintaining this package.


~105K SLoC