These are instructions for building, running, and testing the Rust CLI locally. Note that any changes are tightly coupled with Trunk Flaky Test services.
- Install a nightly version of Cargo using rustup
- Install CMake
- Install protoc
- Run
trunk tools install
These are necessary for building particular targets.
cargo build
The CLI will be built to target/debug/trunk-analytics-cli
pip install maturin
trunk run generate-pyi
maturin build --release --out dist --find-interpreter --manifest-path ./context-py/Cargo.toml
The 2 wheels will be available in dist/
pnpm install --dir ./context-js
pnpm run --dir ./context-js build
The package will be available in context-js/pkg/
cd context-ruby
bundle install
bundle exec rake compile
The output will be available in context-ruby/tmp
cargo build
./target/debug/trunk-analytics-cli upload --org-url-slug=trunk-io --token=${API_TOKEN} --junit-paths=junit.xml
You can generate sample junit files by running
cargo run --bin junit-mock .
You can change the API endpoint by setting TRUNK_PUBLIC_API_ADDRESS=https://api.trunk.io
. To use localhost, you should use TRUNK_PUBLIC_API_ADDRESS=http://localhost:9010 DEBUG_STRIP_VERSION_PREFIX=true
# Rust tests
cargo test
# Javascript tests
pnpm install --dir ./context-js
pnpm run --dir ./context-js build_and_test
# Python test
pip install maturin uv
trunk run generate-pyi
maturin build --release --out dist --find-interpreter --manifest-path ./context-py/Cargo.toml
cd ./context-py
uv venv
source .venv/bin/activate
uv pip install -r requirements-dev.txt
uv pip install context-py --find-links ../dist --force-reinstall
pytest
# Ruby test
cd ./context-ruby
bundle install
bundle exec rake test