Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Msrv check v1.70.0 #21

Open
wants to merge 14 commits into
base: main
Choose a base branch
from
22 changes: 13 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions opentelemetry-proto/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion opentelemetry-proto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
3 changes: 3 additions & 0 deletions opentelemetry-proto/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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+]
81 changes: 52 additions & 29 deletions scripts/msrv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 <rust-version>"
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
17 changes: 17 additions & 0 deletions scripts/msrv_config.json
Original file line number Diff line number Diff line change
@@ -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"
]
}

Loading