|
2 | 2 | OTEL_EXPORTER_OTLP_TRACES_ENDPOINT = "http://127.0.0.1:4317" |
3 | 3 | OTEL_EXPORTER_OTLP_TRACES_PROTOCOL = "grpc" |
4 | 4 | OTEL_TRACES_SAMPLER = "always_on" |
5 | | -# RUSTC_WRAPPER = "sccache" |
6 | | -# RUST_WITHOUT = "rust-docs" |
7 | | -ASDF_RUST_PROFILE = "minimal" |
8 | 5 | # RUST_LOG = "warn,otel::setup=debug" |
9 | 6 |
|
10 | 7 | [tools] |
11 | | -rust = '1.82.0' |
12 | | -just = '1' |
| 8 | +rust = { version = "1.82.0", profile = "minimal", components = "rustfmt,clippy" } # the rust tool stack (with cargo, fmt, clippy) to build source |
13 | 9 | grpcurl = '1.9' |
14 | 10 | protoc = '32.1' |
15 | 11 | # grpc-health-probe = "*" |
16 | 12 | # sccache = "0.5" |
17 | | -"aqua:cargo-bins/cargo-binstall" = "1" # do not use cargo-binstall (it's a special name used by mise) |
| 13 | +# cargo-binstall allow to download (insteal of build) "cargo:*" |
| 14 | +# - do not use cargo-binstall" (it's a special name used by mise) |
| 15 | +# - "aqua:cargo-bins/cargo-binstall" allow to download the binary |
| 16 | +"aqua:cargo-bins/cargo-binstall" = "1" |
| 17 | + |
| 18 | +[tasks.format] |
| 19 | +description = "Format the code and sort dependencies" |
| 20 | +run = [ |
| 21 | + "cargo fmt", |
| 22 | + # "cargo sort --workspace --grouped" |
| 23 | +] |
| 24 | + |
| 25 | +[tasks.deny] |
| 26 | +description = "Run cargo deny checks" |
| 27 | +depends = ["install:cargo-deny"] |
| 28 | +run = "cargo deny check" |
| 29 | + |
| 30 | +[tasks.check] |
| 31 | +description = "Check code with all feature combinations" |
| 32 | +depends = ["install:cargo-hack"] |
| 33 | +run = "cargo hack check --each-feature --no-dev-deps" |
| 34 | +wait_for = ["test", "lint"] |
| 35 | + |
| 36 | +[tasks.lint] |
| 37 | +description = "Lint the rust code" |
| 38 | +run = [ |
| 39 | + "cargo fmt --all -- --check", |
| 40 | + "cargo clippy --workspace --all-features --all-targets -- --deny warnings --allow deprecated --allow unknown-lints", |
| 41 | +] |
| 42 | +wait_for = ["deny"] |
| 43 | + |
| 44 | +[tasks.megalinter] |
| 45 | +description = "Run megalinter in container" |
| 46 | +run = ''' |
| 47 | +#!/usr/bin/env bash |
| 48 | +if command -v podman > /dev/null; then |
| 49 | + podman run --pull always --rm -it -v "$PWD:/tmp/lint:rw" "oxsecurity/megalinter-documentation:v8" |
| 50 | +elif command -v nerdctl > /dev/null; then |
| 51 | + nerdctl run --pull always --rm -it -v "$PWD:/tmp/lint:rw" "oxsecurity/megalinter-documentation:v8" |
| 52 | +elif command -v docker > /dev/null; then |
| 53 | + docker run --pull always --rm -it -v "$PWD:/tmp/lint:rw" "oxsecurity/megalinter-documentation:v8" |
| 54 | +else |
| 55 | + echo "Container runner not found: podman, nerdctl, or docker required" |
| 56 | + exit 1 |
| 57 | +fi |
| 58 | +''' |
| 59 | + |
| 60 | +[tasks.test] |
| 61 | +description = "Launch tests" |
| 62 | +depends = ["install:cargo-nextest", "install:cargo-insta"] |
| 63 | +run = [ |
| 64 | + "cargo nextest run", |
| 65 | + "cargo test --doc", |
| 66 | +] |
| 67 | +wait_for = ["lint"] |
| 68 | + |
| 69 | +[tasks.test-each-feature] |
| 70 | +description = "Test each feature separately" |
| 71 | +depends = ["install:cargo-hack"] |
| 72 | +run = "cargo hack test --each-feature -- --test-threads=1" |
| 73 | + |
| 74 | +[tasks.set-version] |
| 75 | +description = "Set version across all workspace crates" |
| 76 | +run = ''' |
| 77 | +#!/usr/bin/env bash |
| 78 | +
|
| 79 | +if [ $# -eq 0 ]; then |
| 80 | + echo "Usage: mise run set-version <version>" |
| 81 | + exit 1 |
| 82 | +fi |
| 83 | +version="$1" |
| 84 | +sed -i "s/^version = .*/version = \"$version\"/" Cargo.toml |
| 85 | +release-plz set-version axum-tracing-opentelemetry@"$version" |
| 86 | +release-plz set-version fake-opentelemetry-collector@"$version" |
| 87 | +release-plz set-version init-tracing-opentelemetry@"$version" |
| 88 | +# release-plz set-version testing-tracing-opentelemetry@"$version" |
| 89 | +release-plz set-version tonic-tracing-opentelemetry@"$version" |
| 90 | +release-plz set-version tracing-opentelemetry-instrumentation-sdk@"$version" |
| 91 | +''' |
| 92 | + |
| 93 | +# Tool installation tasks (on demand vs upfraont like with [tools] |
| 94 | +[tasks."install:cargo-deny"] |
| 95 | +hide = true |
| 96 | +description = "Install cargo-deny" |
| 97 | +run = 'cargo binstall -y cargo-deny || cargo install --locked cargo-deny' |
| 98 | + |
| 99 | +[tasks."install:cargo-nextest"] |
| 100 | +hide = true |
| 101 | +description = "Install cargo-nextest" |
| 102 | +run = 'cargo binstall -y cargo-nextest || cargo install --locked cargo-nextest' |
| 103 | + |
| 104 | +[tasks."install:cargo-insta"] |
| 105 | +hide = true |
| 106 | +description = "Install cargo-insta" |
| 107 | +run = 'cargo binstall -y cargo-insta || cargo install --locked cargo-insta' |
| 108 | + |
| 109 | +[tasks."install:cargo-release"] |
| 110 | +hide = true |
| 111 | +description = "Install cargo-release" |
| 112 | +run = 'cargo binstall -y cargo-release || cargo install --locked cargo-release' |
| 113 | + |
| 114 | +[tasks."install:git-cliff"] |
| 115 | +hide = true |
| 116 | +description = "Install git-cliff" |
| 117 | +run = 'cargo binstall -y git-cliff || cargo install --locked git-cliff' |
| 118 | + |
| 119 | +[tasks."install:cargo-hack"] |
| 120 | +hide = true |
| 121 | +description = "Install cargo-hack" |
| 122 | +run = 'cargo binstall -y cargo-hack || cargo install --locked cargo-hack' |
| 123 | + |
| 124 | +# Container and example tasks |
| 125 | +[tasks.run-jaeger] |
| 126 | +description = "Run Jaeger all-in-one container" |
| 127 | +run = ''' |
| 128 | +#!/usr/bin/env bash |
| 129 | +
|
| 130 | +container_cmd="" |
| 131 | +if command -v podman > /dev/null; then |
| 132 | + container_cmd="podman" |
| 133 | +elif command -v nerdctl > /dev/null; then |
| 134 | + container_cmd="nerdctl" |
| 135 | +elif command -v docker > /dev/null; then |
| 136 | + container_cmd="docker" |
| 137 | +else |
| 138 | + echo "Container runner not found: podman, nerdctl, or docker required" |
| 139 | + exit 1 |
| 140 | +fi |
| 141 | +
|
| 142 | +$container_cmd run --rm --name jaeger \ |
| 143 | + -e COLLECTOR_ZIPKIN_HOST_PORT=9411 \ |
| 144 | + -e COLLECTOR_OTLP_ENABLED=true \ |
| 145 | + -p 6831:6831/udp \ |
| 146 | + -p 6832:6832/udp \ |
| 147 | + -p 5778:5778 \ |
| 148 | + -p 16686:16686 \ |
| 149 | + -p 4317:4317 \ |
| 150 | + -p 4318:4318 \ |
| 151 | + -p 14250:14250 \ |
| 152 | + -p 14268:14268 \ |
| 153 | + -p 14269:14269 \ |
| 154 | + -p 9411:9411 \ |
| 155 | + docker.io/jaegertracing/all-in-one:latest |
| 156 | +''' |
| 157 | + |
| 158 | +[tasks.run-example-grpc-server] |
| 159 | +description = "Run gRPC server example" |
| 160 | +run = 'cd examples/grpc && OTEL_SERVICE_NAME=grpc-server cargo run --bin server' |
| 161 | + |
| 162 | +[tasks.run-example-grpc-client] |
| 163 | +description = "Run gRPC client example" |
| 164 | +run = ''' |
| 165 | +grpcurl -plaintext 127.0.0.1:50051 list |
| 166 | +cd examples/grpc && OTEL_SERVICE_NAME=grpc-client cargo run --bin client |
| 167 | +''' |
| 168 | + |
| 169 | +[tasks.run-example-axum-otlp-server] |
| 170 | +description = "Run axum-otlp server example" |
| 171 | +run = 'cd examples/axum-otlp && OTEL_SERVICE_NAME=axum-otlp-4317 cargo run' |
| 172 | + |
| 173 | +[tasks.run-example-axum-otlp-server-http] |
| 174 | +description = "Run axum-otlp server example over HTTP" |
| 175 | +run = 'cd examples/axum-otlp && OTEL_EXPORTER_OTLP_TRACES_ENDPOINT="http://localhost:4318/v1/traces" OTEL_SERVICE_NAME=axum-otlp-4318 cargo run --features otlp-over-http' |
| 176 | + |
| 177 | +[tasks.run-example-http-server] |
| 178 | +description = "Run HTTP server example (alias for axum-otlp)" |
| 179 | +depends = ["run-example-axum-otlp-server"] |
| 180 | + |
| 181 | +[tasks.run-example-http-client] |
| 182 | +description = "Run HTTP client example" |
| 183 | +run = ''' |
| 184 | +# curl -i http://127.0.0.1:3003/health |
| 185 | +curl -i http://127.0.0.1:3003/ |
| 186 | +''' |
| 187 | + |
| 188 | +[tasks.run-example-load] |
| 189 | +description = "Run load test example" |
| 190 | +run = 'cd examples/load && cargo run --release 2>/dev/null' |
| 191 | + |
| 192 | +[tasks.ci] |
| 193 | +depends = ["check", "lint", "test", "deny"] |
0 commit comments