Skip to content

Commit

Permalink
unify management of MSRV (#1335)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
demoray authored Aug 17, 2023
1 parent 128825c commit f6d2565
Show file tree
Hide file tree
Showing 13 changed files with 61 additions and 20 deletions.
57 changes: 46 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,39 @@ env:
CARGO_INCREMENTAL: 0

jobs:
msrv:
name: Get minimum supported rust version
runs-on: ubuntu-20.04
outputs:
msrv: ${{ steps.get_msrv.outputs.msrv }}
steps:
- uses: actions/checkout@v3
- id: get_msrv
run: |
MSRV=$(cargo metadata --format-version=1 --no-deps | jq '.packages[] | select(.name == "azure_core").rust_version' -r)
echo setting msrv to ${MSRV}
echo msrv=${MSRV} >> "$GITHUB_OUTPUT"
code-style:
name: Code Style
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
- run: eng/scripts/code_style.sh
# for code style, we only care about `stable`
- run: eng/scripts/code_style.sh stable

test-sdk:
name: SDK Tests
runs-on: ubuntu-20.04
needs:
- msrv
strategy:
matrix:
build:
- stable
- nightly
- ${{ needs.msrv.outputs.msrv }}
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
Expand All @@ -33,41 +50,58 @@ jobs:
test-services:
name: Services Tests
runs-on: ubuntu-20.04
needs:
- msrv
strategy:
matrix:
build:
- stable
- nightly
- ${{ needs.msrv.outputs.msrv }}
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
with:
workspaces: services
- run: eng/scripts/services_tests.sh
- run: eng/scripts/services_tests.sh ${{ matrix.build }}
- name: display free disk space
run: df -h /
if: ${{ always() }}

test-integration:
name: Integration Tests
runs-on: ubuntu-20.04
needs:
- msrv
strategy:
matrix:
build:
- stable
- nightly
- ${{ needs.msrv.outputs.msrv }}
steps:
- uses: actions/checkout@v3
- run: rustup update --no-self-update stable
- uses: Swatinem/rust-cache@v2

- name: emulator integration tests
run: |
npm install [email protected]
npx azurite &
cargo test --features test_integration
- run: eng/scripts/emulator_tests.sh ${{ matrix.build }}
- name: display free disk space
run: df -h /
if: ${{ always() }}

test-e2e:
name: E2E Tests
runs-on: ubuntu-20.04
needs:
- msrv
strategy:
matrix:
build:
- stable
- nightly
- ${{ needs.msrv.outputs.msrv }}
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v2
- run: eng/scripts/e2e_tests.sh
- run: eng/scripts/e2e_tests.sh ${{ matrix.build }}
- name: display free disk space
run: df -h /
if: ${{ always() }}
Expand All @@ -90,4 +124,5 @@ jobs:
with:
repository: OAI/OpenAPI-Specification
path: OpenAPI-Specification
# for code style, we only care about `stable`
- run: azure-sdk-for-rust/eng/scripts/autorust_tests.sh
1 change: 1 addition & 0 deletions eng/scripts/code_style.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export RUSTDOCFLAGS="-D warnings"
export RUSTFLAGS="-Dwarnings"

rustup update --no-self-update ${BUILD}
rustup component add rustfmt --toolchain ${BUILD}
cargo +${BUILD} install cargo-readme
cargo +${BUILD} fmt --all -- --check
cargo +${BUILD} clippy --all
Expand Down
12 changes: 12 additions & 0 deletions eng/scripts/emulator_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

set -eux -o pipefail
cd $(dirname ${BASH_SOURCE[0]})/../../

BUILD=${1:-stable}

npm install [email protected]
npx azurite &

rustup update --no-self-update ${BUILD}
cargo +${BUILD} test --features test_integration
1 change: 1 addition & 0 deletions eng/scripts/services_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ cd $(dirname ${BASH_SOURCE[0]})/../../
BUILD=${1:-stable}

rustup update --no-self-update ${BUILD}
rustup component add rustfmt clippy --toolchain ${BUILD}
export RUSTFLAGS="-Dwarnings -Aunreachable-code -Aunused-assignments -Adead-code -Aclippy::new-without-default -Aclippy::unnecessary_to_owned"
cargo +${BUILD} check --manifest-path services/Cargo.toml --all
cargo +${BUILD} check --manifest-path services/Cargo.toml --examples
Expand Down
2 changes: 1 addition & 1 deletion sdk/core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ documentation = "https://docs.rs/azure_core"
keywords = ["sdk", "azure", "rest", "iot", "cloud"]
categories = ["api-bindings"]
edition = "2021"
rust-version = "1.64.0"
rust-version = "1.67.0"

[dependencies]
async-trait = "0.1"
Expand Down
1 change: 0 additions & 1 deletion sdk/data_cosmos/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ documentation = "https://docs.rs/azure_data_cosmos"
keywords = ["sdk", "azure", "rest", "iot", "cloud"]
categories = ["api-bindings"]
edition = "2021"
rust-version = "1.64.0"

[dependencies]
async-trait = "0.1"
Expand Down
1 change: 0 additions & 1 deletion sdk/data_tables/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ documentation = "https://docs.rs/azure_data_tables"
keywords = ["sdk", "azure", "storage", "data-tables"]
categories = ["api-bindings"]
edition = "2021"
rust-version = "1.64.0"

[dependencies]
azure_core = { path = "../core", version = "0.13" }
Expand Down
1 change: 0 additions & 1 deletion sdk/iot_hub/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ license = "MIT"
repository = "https://github.com/azure/azure-sdk-for-rust"
homepage = "https://github.com/azure/azure-sdk-for-rust"
documentation = "https://docs.rs/azure_iot_hub"
rust-version = "1.64.0"

[dependencies]
async-trait = "0.1"
Expand Down
1 change: 0 additions & 1 deletion sdk/security_keyvault/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ categories = ["api-bindings"]
readme = "README.md"
license = "MIT"
edition = "2021"
rust-version = "1.64.0"

[dependencies]
async-trait = "0.1"
Expand Down
1 change: 0 additions & 1 deletion sdk/storage/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ documentation = "https://docs.rs/azure_storage"
keywords = ["sdk", "azure", "storage"]
categories = ["api-bindings"]
edition = "2021"
rust-version = "1.64.0"

[dependencies]
async-trait = "0.1"
Expand Down
1 change: 0 additions & 1 deletion sdk/storage_blobs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ documentation = "https://docs.rs/azure_storage_blobs"
keywords = ["sdk", "azure", "storage", "blobs"]
categories = ["api-bindings"]
edition = "2021"
rust-version = "1.64.0"

[dependencies]
azure_core = { path = "../core", version = "0.13", features = ["xml"] }
Expand Down
1 change: 0 additions & 1 deletion sdk/storage_datalake/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ documentation = "https://docs.rs/azure_storage_datalake"
keywords = ["sdk", "azure", "storage", "datalake"]
categories = ["api-bindings"]
edition = "2021"
rust-version = "1.64.0"

[dependencies]
async-trait = "0.1"
Expand Down
1 change: 0 additions & 1 deletion sdk/storage_queues/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ documentation = "https://docs.rs/azure_storage_queues"
keywords = ["sdk", "azure", "storage", "queues"]
categories = ["api-bindings"]
edition = "2021"
rust-version = "1.64.0"

[dependencies]
azure_core = { path = "../core", version = "0.13", default-features=false, features = ["xml"] }
Expand Down

0 comments on commit f6d2565

Please sign in to comment.