This is an automated email from the ASF dual-hosted git repository.

liurenjie1024 pushed a commit to branch v0.8.0-release-pybinding-fix
in repository https://gitbox.apache.org/repos/asf/iceberg-rust.git

commit 5a7f770a8fce8a2a4dac8b8d53c273d60f59fbc5
Author: Kevin Liu <[email protected]>
AuthorDate: Mon Jan 19 00:53:05 2026 -0500

    infra: dynamically set msrv in github workflows (#2040)
    
    ## Which issue does this PR close?
    
    
    - Closes #2038
    
    ## What changes are included in this PR?
    Get MSRV by parsing `rust-version` from `Cargo.toml`. This is to avoid
    forgetting to update MSRV version in the github workflow.
    
    ## Are these changes tested?
---
 .github/actions/get-msrv/action.yml          | 35 ++++++++++++++++++++++++++++
 .github/workflows/ci.yml                     |  8 +++----
 .github/workflows/publish.yml                |  9 +++----
 .github/workflows/release_python.yml         |  9 +++----
 .github/workflows/release_python_nightly.yml |  9 +++----
 5 files changed, 54 insertions(+), 16 deletions(-)

diff --git a/.github/actions/get-msrv/action.yml 
b/.github/actions/get-msrv/action.yml
new file mode 100644
index 000000000..f0b03e277
--- /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 f393309bc..af9b812c7 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 66c17a668..6b4b3da84 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 85663fc75..dba532a31 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 833b8ee6a..8bdd9d100 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:

Reply via email to