4 releases

0.1.3 Mar 13, 2024
0.1.2 Oct 8, 2023
0.1.1 Jan 13, 2023
0.1.0 Jun 3, 2022

#26 in Testing

Download history 1012/week @ 2023-12-23 1082/week @ 2023-12-30 2403/week @ 2024-01-06 1849/week @ 2024-01-13 2310/week @ 2024-01-20 1771/week @ 2024-01-27 2098/week @ 2024-02-03 2540/week @ 2024-02-10 2397/week @ 2024-02-17 2409/week @ 2024-02-24 1707/week @ 2024-03-02 1522/week @ 2024-03-09 1303/week @ 2024-03-16 1154/week @ 2024-03-23 1022/week @ 2024-03-30 1304/week @ 2024-04-06

4,950 downloads per month

MIT license

36KB
735 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

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.

Dependencies

~2.8–4MB
~108K SLoC