diff --git a/.github/actions/get-msrv/action.yml b/.github/actions/get-msrv/action.yml new file mode 100644 index 0000000000..f0b03e2777 --- /dev/null +++ b/.github/actions/get-msrv/action.yml @@ -0,0 +1,35 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +name: Get MSRV +description: Get the Minimum Supported Rust Version from Cargo.toml + +outputs: + msrv: + description: The MSRV extracted from Cargo.toml + value: ${{ steps.get-msrv.outputs.msrv }} + +runs: + using: composite + steps: + - name: Get MSRV + id: get-msrv + shell: bash + run: | + msrv=$(grep '^rust-version' Cargo.toml | sed 's/.*"\(.*\)".*/\1/') + echo "msrv=$msrv" >> $GITHUB_OUTPUT + echo "MSRV is $msrv" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f393309bcb..af9b812c77 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,9 +40,6 @@ concurrency: group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }} cancel-in-progress: true -env: - rust_msrv: "1.87" - jobs: check: runs-on: ${{ matrix.os }} @@ -184,10 +181,13 @@ jobs: uses: arduino/setup-protoc@v3 with: repo-token: ${{ secrets.GITHUB_TOKEN }} + - name: Get MSRV + id: get-msrv + uses: ./.github/actions/get-msrv - name: Setup MSRV Rust toolchain uses: ./.github/actions/setup-builder with: - rust-version: ${{ env.rust_msrv }} + rust-version: ${{ steps.get-msrv.outputs.msrv }} - name: Setup Nightly Rust toolchain uses: ./.github/actions/setup-builder - name: Check MSRV diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 66c17a668d..6b4b3da841 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -26,9 +26,6 @@ on: - "v[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+" workflow_dispatch: -env: - rust_msrv: "1.87" - jobs: publish: runs-on: ubuntu-latest @@ -48,10 +45,14 @@ jobs: steps: - uses: actions/checkout@v6 + - name: Get MSRV + id: get-msrv + uses: ./.github/actions/get-msrv + - name: Setup Rust toolchain uses: ./.github/actions/setup-builder with: - rust-version: ${{ env.rust_msrv }} + rust-version: ${{ steps.get-msrv.outputs.msrv }} - name: Publish ${{ matrix.package }} working-directory: ${{ matrix.package }} diff --git a/.github/workflows/release_python.yml b/.github/workflows/release_python.yml index 85663fc75f..dba532a31c 100644 --- a/.github/workflows/release_python.yml +++ b/.github/workflows/release_python.yml @@ -24,9 +24,6 @@ on: - completed workflow_dispatch: -env: - rust_msrv: "1.87" - concurrency: group: ${{ github.workflow }}-${{ github.event.workflow_run.head_branch }}-${{ github.event_name }} cancel-in-progress: true @@ -147,10 +144,14 @@ jobs: - uses: actions/setup-python@v6 with: python-version: 3.12 + - name: Get MSRV + id: get-msrv + uses: ./.github/actions/get-msrv + - name: Setup Rust toolchain uses: ./.github/actions/setup-builder with: - rust-version: ${{ env.rust_msrv }} + rust-version: ${{ steps.get-msrv.outputs.msrv }} - uses: PyO3/maturin-action@v1 with: target: ${{ matrix.target }} diff --git a/.github/workflows/release_python_nightly.yml b/.github/workflows/release_python_nightly.yml index 833b8ee6a6..8bdd9d1003 100644 --- a/.github/workflows/release_python_nightly.yml +++ b/.github/workflows/release_python_nightly.yml @@ -22,9 +22,6 @@ on: - cron: "0 0 * * *" # Runs at midnight UTC every day workflow_dispatch: # Allows manual triggering -env: - rust_msrv: "1.87" - permissions: contents: read @@ -88,10 +85,14 @@ jobs: with: python-version: 3.12 + - name: Get MSRV + id: get-msrv + uses: ./.github/actions/get-msrv + - name: Setup Rust toolchain uses: ./.github/actions/setup-builder with: - rust-version: ${{ env.rust_msrv }} + rust-version: ${{ steps.get-msrv.outputs.msrv }} - uses: PyO3/maturin-action@v1 with: