From c55a1274da5aba6664a7cf041d9ba4e9f7d01e34 Mon Sep 17 00:00:00 2001 From: Leigh McCulloch <351529+leighmcculloch@users.noreply.github.com> Date: Tue, 9 Jan 2024 16:38:39 +1000 Subject: [PATCH] Run CI for the msrv and latest rust version --- .github/workflows/rust-version.yml | 11 ----------- .github/workflows/rust.yml | 17 ++++++++++++++--- Cargo.toml | 1 + cmd/crates/soroban-spec-json/Cargo.toml | 2 +- cmd/crates/soroban-spec-tools/Cargo.toml | 2 +- cmd/crates/soroban-spec-typescript/Cargo.toml | 2 +- cmd/crates/soroban-test/Cargo.toml | 2 +- .../fixtures/test-wasms/custom_type/Cargo.toml | 2 +- .../fixtures/test-wasms/hello_world/Cargo.toml | 2 +- .../tests/fixtures/test-wasms/swap/Cargo.toml | 2 +- .../tests/fixtures/test-wasms/token/Cargo.toml | 2 +- 11 files changed, 23 insertions(+), 22 deletions(-) delete mode 100644 .github/workflows/rust-version.yml diff --git a/.github/workflows/rust-version.yml b/.github/workflows/rust-version.yml deleted file mode 100644 index 4fc93c421..000000000 --- a/.github/workflows/rust-version.yml +++ /dev/null @@ -1,11 +0,0 @@ -name: Rust Version - -on: - workflow_dispatch: - schedule: - - cron: '0 13 * * *' - -jobs: - - set-rust-version: - uses: stellar/actions/.github/workflows/rust-set-rust-version.yml@main diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 0bc4e7e65..9028df78e 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -5,9 +5,6 @@ on: branches: [main, release/**] pull_request: -env: - RUSTFLAGS: -Dwarnings -Dclippy::all -Dclippy::pedantic - defaults: run: shell: bash @@ -42,6 +39,7 @@ jobs: strategy: fail-fast: false matrix: + rust: [msrv, latest] include: - os: ubuntu-latest target: x86_64-unknown-linux-gnu @@ -57,7 +55,19 @@ jobs: steps: - uses: actions/checkout@v3 - uses: stellar/actions/rust-cache@main + - name: Use the minimum supported Rust version + if: matrix.rust == 'msrv' + run: | + msrv="$(cargo metadata --format-version 1 --no-deps | jq -r '.packages | map(.rust_version) | map(values) | min')" + rustup override set $msrv + rustup component add clippy --toolchain $msrv + - name: Error on warnings and clippy checks + # Only error on warnings and checks for the msrv, because new versions of + # Rust will frequently add new warnings and checks. + if: matrix.rust == 'msrv' + run: echo RUSTFLAGS='-Dwarnings -Dclippy::all -Dclippy::pedantic' >> $GITHUB_ENV - run: rustup update + - run: cargo version - run: rustup target add ${{ matrix.target }} - run: rustup target add wasm32-unknown-unknown - if: matrix.target == 'aarch64-unknown-linux-gnu' @@ -70,6 +80,7 @@ jobs: for I in cmd/soroban-cli cmd/crates/* cmd/crates/soroban-test/tests/fixtures/test-wasms/hello_world ; do cargo test --target ${{ matrix.target }} --manifest-path $I/Cargo.toml done + publish-dry-run: if: github.event_name == 'push' || startsWith(github.head_ref, 'release/') strategy: diff --git a/Cargo.toml b/Cargo.toml index e0a4ee2a2..aad301d65 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,6 +12,7 @@ exclude = ["cmd/crates/soroban-test/tests/fixtures/hello"] [workspace.package] version = "20.1.1" +rust-version = "1.70.0" [workspace.dependencies.soroban-env-host] version = "=20.0.2" diff --git a/cmd/crates/soroban-spec-json/Cargo.toml b/cmd/crates/soroban-spec-json/Cargo.toml index 164f6d779..04051ea6b 100644 --- a/cmd/crates/soroban-spec-json/Cargo.toml +++ b/cmd/crates/soroban-spec-json/Cargo.toml @@ -8,7 +8,7 @@ readme = "README.md" license = "Apache-2.0" version.workspace = true edition = "2021" -rust-version = "1.70" +rust-version.workspace = true [dependencies] soroban-spec = { workspace = true } diff --git a/cmd/crates/soroban-spec-tools/Cargo.toml b/cmd/crates/soroban-spec-tools/Cargo.toml index bed9d8e6b..61a32c137 100644 --- a/cmd/crates/soroban-spec-tools/Cargo.toml +++ b/cmd/crates/soroban-spec-tools/Cargo.toml @@ -8,7 +8,7 @@ license = "Apache-2.0" readme = "README.md" version.workspace = true edition = "2021" -rust-version = "1.70" +rust-version.workspace = true autobins = false diff --git a/cmd/crates/soroban-spec-typescript/Cargo.toml b/cmd/crates/soroban-spec-typescript/Cargo.toml index 87471e665..cc17073fb 100644 --- a/cmd/crates/soroban-spec-typescript/Cargo.toml +++ b/cmd/crates/soroban-spec-typescript/Cargo.toml @@ -8,7 +8,7 @@ readme = "README.md" license = "Apache-2.0" version.workspace = true edition = "2021" -rust-version = "1.70" +rust-version.workspace = true [dependencies] soroban-spec = { workspace = true } diff --git a/cmd/crates/soroban-test/Cargo.toml b/cmd/crates/soroban-test/Cargo.toml index 7780409ec..b4cde0508 100644 --- a/cmd/crates/soroban-test/Cargo.toml +++ b/cmd/crates/soroban-test/Cargo.toml @@ -8,7 +8,7 @@ license = "Apache-2.0" readme = "README.md" version = "20.1.1" edition = "2021" -rust-version = "1.70" +rust-version.workspace = true autobins = false diff --git a/cmd/crates/soroban-test/tests/fixtures/test-wasms/custom_type/Cargo.toml b/cmd/crates/soroban-test/tests/fixtures/test-wasms/custom_type/Cargo.toml index baa76473b..fd0cedf59 100644 --- a/cmd/crates/soroban-test/tests/fixtures/test-wasms/custom_type/Cargo.toml +++ b/cmd/crates/soroban-test/tests/fixtures/test-wasms/custom_type/Cargo.toml @@ -5,7 +5,7 @@ authors = ["Stellar Development Foundation "] license = "Apache-2.0" edition = "2021" publish = false -rust-version = "1.70" +rust-version.workspace = true [lib] crate-type = ["cdylib", "rlib"] diff --git a/cmd/crates/soroban-test/tests/fixtures/test-wasms/hello_world/Cargo.toml b/cmd/crates/soroban-test/tests/fixtures/test-wasms/hello_world/Cargo.toml index 64780d47a..8f79f9767 100644 --- a/cmd/crates/soroban-test/tests/fixtures/test-wasms/hello_world/Cargo.toml +++ b/cmd/crates/soroban-test/tests/fixtures/test-wasms/hello_world/Cargo.toml @@ -5,7 +5,7 @@ authors = ["Stellar Development Foundation "] license = "Apache-2.0" edition = "2021" publish = false -rust-version = "1.70" +rust-version.workspace = true [lib] crate-type = ["cdylib", "rlib"] diff --git a/cmd/crates/soroban-test/tests/fixtures/test-wasms/swap/Cargo.toml b/cmd/crates/soroban-test/tests/fixtures/test-wasms/swap/Cargo.toml index 27aede50d..f2465e22b 100644 --- a/cmd/crates/soroban-test/tests/fixtures/test-wasms/swap/Cargo.toml +++ b/cmd/crates/soroban-test/tests/fixtures/test-wasms/swap/Cargo.toml @@ -5,7 +5,7 @@ authors = ["Stellar Development Foundation "] license = "Apache-2.0" edition = "2021" publish = false -rust-version = "1.70" +rust-version.workspace = true [lib] crate-type = ["cdylib"] diff --git a/cmd/crates/soroban-test/tests/fixtures/test-wasms/token/Cargo.toml b/cmd/crates/soroban-test/tests/fixtures/test-wasms/token/Cargo.toml index 7a81bee77..3f32f139a 100644 --- a/cmd/crates/soroban-test/tests/fixtures/test-wasms/token/Cargo.toml +++ b/cmd/crates/soroban-test/tests/fixtures/test-wasms/token/Cargo.toml @@ -6,7 +6,7 @@ authors = ["Stellar Development Foundation "] license = "Apache-2.0" edition = "2021" publish = false -rust-version = "1.70" +rust-version.workspace = true [lib] crate-type = ["cdylib"]