diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4332693776..bcfdd71a0b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -101,17 +101,21 @@ jobs: msrv: strategy: matrix: - os: [ windows-latest, ubuntu-latest ] + os: [windows-latest, ubuntu-latest] + rust: [1.65.0, 1.70.0] runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v4 - with: - submodules: true - - uses: dtolnay/rust-toolchain@1.65.0 - - name: Patch dependencies versions # some dependencies bump MSRV without major version bump - run: bash ./scripts/patch_dependencies.sh - - name: Check MSRV for all crates - run: bash ./scripts/msrv.sh + - uses: actions/checkout@v4 + with: + submodules: true + - name: Set up Rust ${{ matrix.rust }} + uses: dtolnay/rust-toolchain@master + with: + toolchain: ${{ matrix.rust }} + - name: Patch dependencies versions + run: bash ./scripts/patch_dependencies.sh + - name: Check MSRV for all crates + run: bash ./scripts/msrv.sh ${{ matrix.rust }} 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/opentelemetry-proto/CHANGELOG.md b/opentelemetry-proto/CHANGELOG.md index eee7294902..afcccc6ea4 100644 --- a/opentelemetry-proto/CHANGELOG.md +++ b/opentelemetry-proto/CHANGELOG.md @@ -2,6 +2,8 @@ ## vNext +- Bump MSRV to 1.70 [1864](https://github.com/open-telemetry/opentelemetry-rust/pull/1874) + ## v0.6.0 - Update protobuf definitions to v1.3.1 [#1721](https://github.com/open-telemetry/opentelemetry-rust/pull/1721) diff --git a/opentelemetry-proto/Cargo.toml b/opentelemetry-proto/Cargo.toml index 1ff235ba6a..65836b58e7 100644 --- a/opentelemetry-proto/Cargo.toml +++ b/opentelemetry-proto/Cargo.toml @@ -13,7 +13,7 @@ categories = [ keywords = ["opentelemetry", "otlp", "logging", "tracing", "metrics"] license = "Apache-2.0" edition = "2021" -rust-version = "1.65" +rust-version = "1.70" autotests = false [lib] diff --git a/opentelemetry-proto/README.md b/opentelemetry-proto/README.md index b540bc4403..e655fbeacd 100644 --- a/opentelemetry-proto/README.md +++ b/opentelemetry-proto/README.md @@ -5,3 +5,6 @@ # OpenTelemetry Proto This crate contains generated files from [opentelemetry-proto](https://github.com/open-telemetry/opentelemetry-proto) repository and transformation between types from generated files and types defined in [opentelemetry](https://github.com/open-telemetry/opentelemetry-rust/tree/main/opentelemetry). + + +*Compiler support: [requires `rustc` 1.70+] \ No newline at end of file diff --git a/scripts/msrv.sh b/scripts/msrv.sh index eb9386cfa3..30c080a33b 100755 --- a/scripts/msrv.sh +++ b/scripts/msrv.sh @@ -2,32 +2,55 @@ set -eu -echo "Running msrv check for opentelemetry package" -cargo check --manifest-path=opentelemetry/Cargo.toml --all-features - -echo "Running msrv check for opentelemetry-sdk package" -cargo check --manifest-path=opentelemetry-sdk/Cargo.toml --all-features - -echo "Running msrv check for opentelemetry-stdout package" -cargo check --manifest-path=opentelemetry-stdout/Cargo.toml --all-features - -# TODO: Ignoring as this is failing with the following error: -# error: package `prost-derive v0.12.6` cannot be built because it requires rustc 1.70 or newer, while the currently active rustc version is 1.65.0 -#echo "Running msrv check for opentelemetry-otlp package" -# cargo check --manifest-path=opentelemetry-otlp/Cargo.toml --all-features - -echo "Running msrv check for opentelemetry-http package" -cargo check --manifest-path=opentelemetry-http/Cargo.toml --all-features - -echo "Running msrv check for opentelemetry-jaeger-propagator package" -cargo check --manifest-path=opentelemetry-jaeger-propagator/Cargo.toml --all-features - -echo "Running msrv check for opentelemetry-zipkin package" -cargo check --manifest-path=opentelemetry-zipkin/Cargo.toml --all-features - -echo "Running msrv check for opentelemetry-appender-log package" -cargo check --manifest-path=opentelemetry-appender-log/Cargo.toml --all-features - -echo "Running msrv check for opentelemetry-appender-tracing package" -cargo check --manifest-path=opentelemetry-appender-tracing/Cargo.toml --all-features - +# 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 +done diff --git a/scripts/msrv_config.json b/scripts/msrv_config.json new file mode 100644 index 0000000000..321c2afda3 --- /dev/null +++ b/scripts/msrv_config.json @@ -0,0 +1,17 @@ +{ + "1.65.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" + ], + "1.70.0": [ + "opentelemetry-otlp/Cargo.toml", + "opentelemetry-proto/Cargo.toml" + ] + } + \ No newline at end of file