This is an automated email from the ASF dual-hosted git repository. xuanwo pushed a commit to branch xuanwo/replace-setup-protoc in repository https://gitbox.apache.org/repos/asf/opendal.git
commit 4cca7e516ff7a4236bab99dc56ea856ad0a6d839 Author: Xuanwo <[email protected]> AuthorDate: Fri Dec 12 20:01:37 2025 +0800 ci: Remove setup-protoc entirely Signed-off-by: Xuanwo <[email protected]> --- .github/actions/setup/action.yaml | 81 +++++++++++++++++++++++++++++++++++--- .github/workflows/release_java.yml | 8 ++-- 2 files changed, 80 insertions(+), 9 deletions(-) diff --git a/.github/actions/setup/action.yaml b/.github/actions/setup/action.yaml index 2ee2c2d16..0f64ef29e 100644 --- a/.github/actions/setup/action.yaml +++ b/.github/actions/setup/action.yaml @@ -16,7 +16,7 @@ # under the License. name: Setup Rust Builder -description: 'Prepare Rust Build Environment' +description: "Prepare Rust Build Environment" inputs: need-rocksdb: description: "This setup needs rocksdb or not" @@ -59,10 +59,82 @@ runs: - name: Setup Protoc if: inputs.need-protoc == 'true' - uses: arduino/setup-protoc@v3 + shell: bash + run: | + set -euo pipefail + + PROTOC_VERSION="23.4" + PROTOC_ROOT="${RUNNER_TEMP}/protoc/${PROTOC_VERSION}" + + case "${RUNNER_OS}-${RUNNER_ARCH}" in + Linux-X64) + PROTOC_PLATFORM="linux-x86_64" + ;; + Linux-ARM64) + PROTOC_PLATFORM="linux-aarch_64" + ;; + macOS-X64) + PROTOC_PLATFORM="osx-x86_64" + ;; + macOS-ARM64) + PROTOC_PLATFORM="osx-aarch_64" + ;; + Windows-X64) + PROTOC_PLATFORM="win64" + ;; + *) + echo "Unsupported runner: ${RUNNER_OS}-${RUNNER_ARCH}" >&2 + exit 1 + ;; + esac + + echo "PROTOC_VERSION=${PROTOC_VERSION}" >> "${GITHUB_ENV}" + echo "PROTOC_ROOT=${PROTOC_ROOT}" >> "${GITHUB_ENV}" + echo "PROTOC_PLATFORM=${PROTOC_PLATFORM}" >> "${GITHUB_ENV}" + + - name: Cache Protoc + if: inputs.need-protoc == 'true' + id: cache-protoc + uses: actions/cache@v4 with: - version: "23.4" - repo-token: ${{ inputs.github-token }} + path: ${{ runner.temp }}/protoc/${{ env.PROTOC_VERSION }} + key: protoc-${{ env.PROTOC_VERSION }}-${{ runner.os }}-${{ runner.arch }} + + - name: Install Protoc (Unix) + if: inputs.need-protoc == 'true' && runner.os != 'Windows' && steps.cache-protoc.outputs.cache-hit != 'true' + shell: bash + run: | + set -euo pipefail + + PROTOC_ZIP="protoc-${PROTOC_VERSION}-${PROTOC_PLATFORM}.zip" + PROTOC_URL="https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/${PROTOC_ZIP}" + + mkdir -p "${PROTOC_ROOT}" + curl -fsSL -o "${RUNNER_TEMP}/${PROTOC_ZIP}" "${PROTOC_URL}" + unzip -q "${RUNNER_TEMP}/${PROTOC_ZIP}" -d "${PROTOC_ROOT}" + + - name: Install Protoc (Windows) + if: inputs.need-protoc == 'true' && runner.os == 'Windows' && steps.cache-protoc.outputs.cache-hit != 'true' + shell: pwsh + run: | + $ErrorActionPreference = 'Stop' + + $protocZip = "protoc-$env:PROTOC_VERSION-$env:PROTOC_PLATFORM.zip" + $protocUrl = "https://github.com/protocolbuffers/protobuf/releases/download/v$env:PROTOC_VERSION/$protocZip" + $zipPath = Join-Path $env:RUNNER_TEMP $protocZip + $dest = $env:PROTOC_ROOT + + New-Item -ItemType Directory -Force -Path $dest | Out-Null + Invoke-WebRequest -Uri $protocUrl -OutFile $zipPath + Expand-Archive -Path $zipPath -DestinationPath $dest -Force + + - name: Add Protoc to PATH + if: inputs.need-protoc == 'true' + shell: bash + run: | + set -euo pipefail + echo "${PROTOC_ROOT}/bin" >> "${GITHUB_PATH}" + protoc --version - name: Install cargo-nextest if: inputs.need-nextest == 'true' @@ -133,4 +205,3 @@ runs: rm foundationdb-clients_7.1.17-1_amd64.deb rm foundationdb-server_7.1.17-1_amd64.deb - diff --git a/.github/workflows/release_java.yml b/.github/workflows/release_java.yml index e4662eccc..c530d0fcb 100644 --- a/.github/workflows/release_java.yml +++ b/.github/workflows/release_java.yml @@ -66,11 +66,11 @@ jobs: - uses: actions/setup-python@v6 with: python-version: "3.11" - - name: Install Protoc - uses: arduino/setup-protoc@v3 + - name: Setup Rust toolchain + uses: ./.github/actions/setup with: - version: "23.4" - repo-token: ${{ secrets.GITHUB_TOKEN }} + need-protoc: true + github-token: ${{ secrets.GITHUB_TOKEN }} - name: Setup linux for zigbuild if: ${{ contains(matrix.os, 'ubuntu') }}
