diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000000..18a3cb3183 --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,3 @@ +[resolver] +# https://doc.rust-lang.org/cargo/reference/config.html#resolverincompatible-rust-versions +incompatible-rust-versions = "fallback" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6ffa891ae1..5572a925ad 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -85,7 +85,7 @@ jobs: external-types: strategy: matrix: - example: [opentelemetry, opentelemetry-sdk, opentelemetry-otlp, opentelemetry-zipkin] + member: [opentelemetry, opentelemetry-sdk, opentelemetry-otlp, opentelemetry-zipkin] runs-on: ubuntu-latest # TODO: Check if this could be covered for Windows. The step used currently fails on Windows. steps: - name: Harden the runner (Audit all outbound calls) @@ -96,20 +96,20 @@ jobs: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - uses: dtolnay/rust-toolchain@b3b07ba8b418998c39fb20f53e8b695cdcc8de1b with: - toolchain: nightly-2024-06-30 + # Rust version should be kept in sync with the one the release was tested with + # https://github.com/awslabs/cargo-check-external-types/releases + toolchain: nightly-2025-05-04 components: rustfmt - - name: Patch dependencies versions - run: bash ./scripts/patch_dependencies.sh + - uses: taiki-e/install-action@33734a118689b0b418824fb78ea2bf18e970b43b # v2.50.4 + with: + tool: cargo-check-external-types@0.2.0 - name: external-type-check - run: | - cargo install cargo-check-external-types@0.1.13 - cd ${{ matrix.example }} - cargo check-external-types --all-features --config allowed-external-types.toml + working-directory: ${{ matrix.member }} + run: cargo check-external-types --all-features --config allowed-external-types.toml msrv: strategy: matrix: os: [windows-latest, ubuntu-latest] - rust: [1.75.0] runs-on: ${{ matrix.os }} continue-on-error: true steps: @@ -121,14 +121,17 @@ jobs: - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: submodules: true - - name: Set up Rust ${{ matrix.rust }} - uses: dtolnay/rust-toolchain@b3b07ba8b418998c39fb20f53e8b695cdcc8de1b + - uses: dtolnay/rust-toolchain@b3b07ba8b418998c39fb20f53e8b695cdcc8de1b + with: + toolchain: stable + - uses: taiki-e/install-action@33734a118689b0b418824fb78ea2bf18e970b43b # v2.50.4 with: - toolchain: ${{ matrix.rust }} - - name: Patch dependencies versions - run: bash ./scripts/patch_dependencies.sh + tool: cargo-msrv + - uses: arduino/setup-protoc@c65c819552d16ad3c9b72d9dfd5ba5237b9c906b # v3.0.0 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} - name: Check MSRV for all crates - run: bash ./scripts/msrv.sh ${{ matrix.rust }} + run: bash ./scripts/msrv.sh cargo-deny: runs-on: ubuntu-latest # This uses the step `EmbarkStudios/cargo-deny-action@v1` which is only supported on Linux continue-on-error: true # Prevent sudden announcement of a new advisory from failing ci diff --git a/examples/logs-basic/Cargo.toml b/examples/logs-basic/Cargo.toml index ed6a102754..4dd3e4bfd6 100644 --- a/examples/logs-basic/Cargo.toml +++ b/examples/logs-basic/Cargo.toml @@ -3,6 +3,7 @@ name = "logs-basic" version = "0.1.0" edition = "2021" license = "Apache-2.0" +rust-version = "1.75.0" publish = false autobenches = false diff --git a/examples/metrics-advanced/Cargo.toml b/examples/metrics-advanced/Cargo.toml index 40a4573d68..6adab8dfd3 100644 --- a/examples/metrics-advanced/Cargo.toml +++ b/examples/metrics-advanced/Cargo.toml @@ -3,6 +3,7 @@ name = "metrics-advanced" version = "0.1.0" edition = "2021" license = "Apache-2.0" +rust-version = "1.75.0" publish = false autobenches = false diff --git a/examples/metrics-basic/Cargo.toml b/examples/metrics-basic/Cargo.toml index 918d4189cf..648c4a546d 100644 --- a/examples/metrics-basic/Cargo.toml +++ b/examples/metrics-basic/Cargo.toml @@ -3,6 +3,7 @@ name = "metrics-basic" version = "0.1.0" edition = "2021" license = "Apache-2.0" +rust-version = "1.75.0" publish = false autobenches = false diff --git a/examples/tracing-grpc/Cargo.toml b/examples/tracing-grpc/Cargo.toml index 5936f03e34..ee60b02a69 100644 --- a/examples/tracing-grpc/Cargo.toml +++ b/examples/tracing-grpc/Cargo.toml @@ -3,6 +3,7 @@ name = "tracing-grpc" version = "0.1.0" edition = "2021" license = "Apache-2.0" +rust-version = "1.75.0" publish = false autobenches = false diff --git a/examples/tracing-http-propagator/Cargo.toml b/examples/tracing-http-propagator/Cargo.toml index 8ecf20eb43..a4fa13d371 100644 --- a/examples/tracing-http-propagator/Cargo.toml +++ b/examples/tracing-http-propagator/Cargo.toml @@ -3,6 +3,7 @@ name = "tracing-http-propagator" version = "0.1.0" edition = "2021" license = "Apache-2.0" +rust-version = "1.75.0" publish = false autobenches = false diff --git a/opentelemetry-otlp/examples/basic-otlp-http/Cargo.toml b/opentelemetry-otlp/examples/basic-otlp-http/Cargo.toml index d4c6296c1a..d3ad6709c1 100644 --- a/opentelemetry-otlp/examples/basic-otlp-http/Cargo.toml +++ b/opentelemetry-otlp/examples/basic-otlp-http/Cargo.toml @@ -3,6 +3,7 @@ name = "basic-otlp-http" version = "0.1.0" edition = "2021" license = "Apache-2.0" +rust-version = "1.75.0" publish = false autobenches = false diff --git a/opentelemetry-otlp/examples/basic-otlp/Cargo.toml b/opentelemetry-otlp/examples/basic-otlp/Cargo.toml index b05fc46024..ae4a4e7d85 100644 --- a/opentelemetry-otlp/examples/basic-otlp/Cargo.toml +++ b/opentelemetry-otlp/examples/basic-otlp/Cargo.toml @@ -3,6 +3,7 @@ name = "basic-otlp" version = "0.1.0" edition = "2021" license = "Apache-2.0" +rust-version = "1.75.0" publish = false autobenches = false diff --git a/opentelemetry-otlp/tests/integration_test/Cargo.toml b/opentelemetry-otlp/tests/integration_test/Cargo.toml index 756a55ead4..6b156d18fc 100644 --- a/opentelemetry-otlp/tests/integration_test/Cargo.toml +++ b/opentelemetry-otlp/tests/integration_test/Cargo.toml @@ -2,6 +2,8 @@ name = "integration_test_runner" version = "0.1.0" edition = "2021" +license = "Apache-2.0" +rust-version = "1.75.0" publish = false autobenches = false diff --git a/opentelemetry-proto/src/proto/opentelemetry-proto b/opentelemetry-proto/src/proto/opentelemetry-proto index be5d584704..f7676e8120 160000 --- a/opentelemetry-proto/src/proto/opentelemetry-proto +++ b/opentelemetry-proto/src/proto/opentelemetry-proto @@ -1 +1 @@ -Subproject commit be5d58470429d0255ffdd49491f0815a3a63d6ef +Subproject commit f7676e812035aa8a67478c6d740cb09f4c50f86a diff --git a/scripts/msrv.sh b/scripts/msrv.sh index 30c080a33b..e0c92b5999 100755 --- a/scripts/msrv.sh +++ b/scripts/msrv.sh @@ -2,55 +2,12 @@ set -eu -# Check if a version is specified as parameter -if [ $# -eq 0 ]; then - echo "No Rust version specified. Usage: $0 " - exit 1 -fi - -RUST_VERSION=$1 - -# Determine the directory containing the script -SCRIPT_DIR=$(dirname "$(readlink -f "$0")") - -# Path to the configuration file -CONFIG_FILE="$SCRIPT_DIR/msrv_config.json" - -# Change to the root directory of the repository -cd "$SCRIPT_DIR/.." - -echo "Current working directory: $(pwd)" - -# function to check if specified toolchain is installed -check_rust_toolchain_installed() { - local version=$1 - if ! rustup toolchain list | grep -q "$version"; then - echo "Rust toolchain $version is not installed. Please install it using 'rustup toolchain install $version'." - exit 1 - fi -} - -# check if specified toolchain is installed -check_rust_toolchain_installed "$RUST_VERSION" - -# Extract the exact installed rust version string -installed_version=$(rustup toolchain list | grep "$RUST_VERSION" | awk '{print $1}') - -# Read the configuration file and get the packages for the specified version -if [ -f "$CONFIG_FILE" ]; then - packages=$(jq -r --arg version "$RUST_VERSION" '.[$version] | .[]' "$CONFIG_FILE" | tr '\n' ' ') - if [ -z "$packages" ]; then - echo "No packages found for Rust version $RUST_VERSION in the configuration file." - exit 1 - fi -else - echo "Configuration file $CONFIG_FILE not found." - exit 1 -fi - -# Check MSRV for the packages -for package in $packages; do - package=$(echo "$package" | tr -d '\r\n') # Remove any newline and carriage return characters - echo "Command: rustup run \"$installed_version\" cargo check --manifest-path=\"$package\" --all-features" - rustup run "$installed_version" cargo check --manifest-path=$package --all-features +members=$(cargo metadata -q --no-deps --format-version 1 | jq -r '.packages[].manifest_path') + +for member in $members; do + # needed for windows CI run + clean_member=$(printf '%s' "$member" | tr -d '\r') + echo "Verifying MSRV version for $clean_member" + cargo msrv verify --manifest-path "$clean_member" --output-format json + echo "" # just for nicer separation between packages done diff --git a/scripts/msrv_config.json b/scripts/msrv_config.json deleted file mode 100644 index 05f9f5615c..0000000000 --- a/scripts/msrv_config.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "1.75.0": [ - "opentelemetry/Cargo.toml", - "opentelemetry-sdk/Cargo.toml", - "opentelemetry-stdout/Cargo.toml", - "opentelemetry-http/Cargo.toml", - "opentelemetry-jaeger-propagator/Cargo.toml", - "opentelemetry-zipkin/Cargo.toml", - "opentelemetry-appender-log/Cargo.toml", - "opentelemetry-appender-tracing/Cargo.toml", - "opentelemetry-otlp/Cargo.toml", - "opentelemetry-proto/Cargo.toml" - ] -} diff --git a/scripts/patch_dependencies.sh b/scripts/patch_dependencies.sh deleted file mode 100755 index 6a1e7de61b..0000000000 --- a/scripts/patch_dependencies.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -function patch_version() { - local latest_version=$(cargo search --limit 1 $1 | head -1 | cut -d'"' -f2) - echo "patching $1 from $latest_version to $2" - cargo update -p $1:$latest_version --precise $2 -} - -patch_version url 2.5.2 #https://github.com/servo/rust-url/issues/992 -patch_version native-tls 0.2.13 # 0.2.14 needs rustc v1.80 diff --git a/stress/Cargo.toml b/stress/Cargo.toml index 1fa9991407..9063b75d79 100644 --- a/stress/Cargo.toml +++ b/stress/Cargo.toml @@ -2,6 +2,8 @@ name = "stress" version = "0.1.0" edition = "2021" +license = "Apache-2.0" +rust-version = "1.75.0" publish = false autobenches = false