Skip to content

Commit f6d2565

Browse files
authored
unify management of MSRV (#1335)
This PR standardizes where all crates set the MSRV (`azure_core`), as well as updates the actions to build on a matrix of 'stable', 'nightly', and the rust-version set in `azure_core`. This allows developers of the SDK to run each of the build tasks exactly as they are run in CICD with minimal configuration.
1 parent 128825c commit f6d2565

File tree

13 files changed

+61
-20
lines changed

13 files changed

+61
-20
lines changed

.github/workflows/build.yml

Lines changed: 46 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,39 @@ env:
99
CARGO_INCREMENTAL: 0
1010

1111
jobs:
12+
msrv:
13+
name: Get minimum supported rust version
14+
runs-on: ubuntu-20.04
15+
outputs:
16+
msrv: ${{ steps.get_msrv.outputs.msrv }}
17+
steps:
18+
- uses: actions/checkout@v3
19+
- id: get_msrv
20+
run: |
21+
MSRV=$(cargo metadata --format-version=1 --no-deps | jq '.packages[] | select(.name == "azure_core").rust_version' -r)
22+
echo setting msrv to ${MSRV}
23+
echo msrv=${MSRV} >> "$GITHUB_OUTPUT"
24+
1225
code-style:
1326
name: Code Style
1427
runs-on: ubuntu-20.04
1528
steps:
1629
- uses: actions/checkout@v3
1730
- uses: Swatinem/rust-cache@v2
18-
- run: eng/scripts/code_style.sh
31+
# for code style, we only care about `stable`
32+
- run: eng/scripts/code_style.sh stable
1933

2034
test-sdk:
2135
name: SDK Tests
2236
runs-on: ubuntu-20.04
37+
needs:
38+
- msrv
2339
strategy:
2440
matrix:
2541
build:
2642
- stable
2743
- nightly
44+
- ${{ needs.msrv.outputs.msrv }}
2845
steps:
2946
- uses: actions/checkout@v3
3047
- uses: Swatinem/rust-cache@v2
@@ -33,41 +50,58 @@ jobs:
3350
test-services:
3451
name: Services Tests
3552
runs-on: ubuntu-20.04
53+
needs:
54+
- msrv
55+
strategy:
56+
matrix:
57+
build:
58+
- stable
59+
- nightly
60+
- ${{ needs.msrv.outputs.msrv }}
3661
steps:
3762
- uses: actions/checkout@v3
3863
- uses: Swatinem/rust-cache@v2
3964
with:
4065
workspaces: services
41-
- run: eng/scripts/services_tests.sh
66+
- run: eng/scripts/services_tests.sh ${{ matrix.build }}
4267
- name: display free disk space
4368
run: df -h /
4469
if: ${{ always() }}
4570

4671
test-integration:
4772
name: Integration Tests
4873
runs-on: ubuntu-20.04
74+
needs:
75+
- msrv
76+
strategy:
77+
matrix:
78+
build:
79+
- stable
80+
- nightly
81+
- ${{ needs.msrv.outputs.msrv }}
4982
steps:
5083
- uses: actions/checkout@v3
51-
- run: rustup update --no-self-update stable
5284
- uses: Swatinem/rust-cache@v2
53-
54-
- name: emulator integration tests
55-
run: |
56-
npm install [email protected]
57-
npx azurite &
58-
cargo test --features test_integration
59-
85+
- run: eng/scripts/emulator_tests.sh ${{ matrix.build }}
6086
- name: display free disk space
6187
run: df -h /
6288
if: ${{ always() }}
6389

6490
test-e2e:
6591
name: E2E Tests
6692
runs-on: ubuntu-20.04
93+
needs:
94+
- msrv
95+
strategy:
96+
matrix:
97+
build:
98+
- stable
99+
- nightly
100+
- ${{ needs.msrv.outputs.msrv }}
67101
steps:
68102
- uses: actions/checkout@v3
69103
- uses: Swatinem/rust-cache@v2
70-
- run: eng/scripts/e2e_tests.sh
104+
- run: eng/scripts/e2e_tests.sh ${{ matrix.build }}
71105
- name: display free disk space
72106
run: df -h /
73107
if: ${{ always() }}
@@ -90,4 +124,5 @@ jobs:
90124
with:
91125
repository: OAI/OpenAPI-Specification
92126
path: OpenAPI-Specification
127+
# for code style, we only care about `stable`
93128
- run: azure-sdk-for-rust/eng/scripts/autorust_tests.sh

eng/scripts/code_style.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export RUSTDOCFLAGS="-D warnings"
99
export RUSTFLAGS="-Dwarnings"
1010

1111
rustup update --no-self-update ${BUILD}
12+
rustup component add rustfmt --toolchain ${BUILD}
1213
cargo +${BUILD} install cargo-readme
1314
cargo +${BUILD} fmt --all -- --check
1415
cargo +${BUILD} clippy --all

eng/scripts/emulator_tests.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
set -eux -o pipefail
4+
cd $(dirname ${BASH_SOURCE[0]})/../../
5+
6+
BUILD=${1:-stable}
7+
8+
npm install [email protected]
9+
npx azurite &
10+
11+
rustup update --no-self-update ${BUILD}
12+
cargo +${BUILD} test --features test_integration

eng/scripts/services_tests.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ cd $(dirname ${BASH_SOURCE[0]})/../../
66
BUILD=${1:-stable}
77

88
rustup update --no-self-update ${BUILD}
9+
rustup component add rustfmt clippy --toolchain ${BUILD}
910
export RUSTFLAGS="-Dwarnings -Aunreachable-code -Aunused-assignments -Adead-code -Aclippy::new-without-default -Aclippy::unnecessary_to_owned"
1011
cargo +${BUILD} check --manifest-path services/Cargo.toml --all
1112
cargo +${BUILD} check --manifest-path services/Cargo.toml --examples

sdk/core/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ documentation = "https://docs.rs/azure_core"
1111
keywords = ["sdk", "azure", "rest", "iot", "cloud"]
1212
categories = ["api-bindings"]
1313
edition = "2021"
14-
rust-version = "1.64.0"
14+
rust-version = "1.67.0"
1515

1616
[dependencies]
1717
async-trait = "0.1"

sdk/data_cosmos/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ documentation = "https://docs.rs/azure_data_cosmos"
1111
keywords = ["sdk", "azure", "rest", "iot", "cloud"]
1212
categories = ["api-bindings"]
1313
edition = "2021"
14-
rust-version = "1.64.0"
1514

1615
[dependencies]
1716
async-trait = "0.1"

sdk/data_tables/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ documentation = "https://docs.rs/azure_data_tables"
1111
keywords = ["sdk", "azure", "storage", "data-tables"]
1212
categories = ["api-bindings"]
1313
edition = "2021"
14-
rust-version = "1.64.0"
1514

1615
[dependencies]
1716
azure_core = { path = "../core", version = "0.13" }

sdk/iot_hub/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ license = "MIT"
88
repository = "https://github.com/azure/azure-sdk-for-rust"
99
homepage = "https://github.com/azure/azure-sdk-for-rust"
1010
documentation = "https://docs.rs/azure_iot_hub"
11-
rust-version = "1.64.0"
1211

1312
[dependencies]
1413
async-trait = "0.1"

sdk/security_keyvault/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ categories = ["api-bindings"]
1111
readme = "README.md"
1212
license = "MIT"
1313
edition = "2021"
14-
rust-version = "1.64.0"
1514

1615
[dependencies]
1716
async-trait = "0.1"

sdk/storage/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ documentation = "https://docs.rs/azure_storage"
1111
keywords = ["sdk", "azure", "storage"]
1212
categories = ["api-bindings"]
1313
edition = "2021"
14-
rust-version = "1.64.0"
1514

1615
[dependencies]
1716
async-trait = "0.1"

0 commit comments

Comments
 (0)