Rust
Prerequisites
Eligible images
|
Currently, Automation does not provide any API for working with Rust. So, the only way to build, test, and publish Rust projects is to use the cargo
command-line tool in shell scripts.
The content of .space.kts
might look like follows:
job("Build, run tests, and publish") {
container(displayName = "Run script", image = "rustlang/rust:nightly") {
shellScript {
content = """
set -e
# Build the Rust project
cargo build --verbose
# Run tests
cargo test --verbose
# Publish to sparse Cargo registry
cargo login --registry=space-registry "Bearer ${'$'}JB_SPACE_CLIENT_TOKEN"
cargo publish --verbose --registry=space-registry
"""
}
}
}
Here JB_SPACE_CLIENT_TOKEN
is the environment variable that stores an authorization token. The token lets the Space Automation service to authorize in Space Packages.
Thanks for your feedback!