Skip to content

Rust adapter for Buildkite Test Analytics which implements a parser and sender for Rust's JSON test output

License

Notifications You must be signed in to change notification settings

buildkite/test-collector-rust

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

83 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

Alternatively you can install direct from the repo

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 operate 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.

About

Rust adapter for Buildkite Test Analytics which implements a parser and sender for Rust's JSON test output

Resources

License

Code of conduct

Stars

Watchers

Forks

Packages

No packages published