From 3029d497c6c112fc2183c820d0e044b8450fd067 Mon Sep 17 00:00:00 2001 From: Kallal Mukherjee Date: Thu, 2 Oct 2025 02:11:57 +0000 Subject: [PATCH] fix: replace arduino/setup-protoc@v1 with cross-platform protoc installation The arduino/setup-protoc@v1 action contained x86_64-specific binaries that failed on ARM64 systems (Apple M1/M2, ARM64 Linux) when using the 'act' tool for local CI testing. Changes: - Replace arduino/setup-protoc@v1 with cross-platform shell script in all workflows - Auto-detect architecture (x86_64, aarch64, arm64) - Download appropriate protoc binary from official GitHub releases - Install to /usr/local/bin/protoc with proper includes - Upgrade to protoc v25.1 (latest stable) - Add comprehensive error handling and validation Files updated: - .github/workflows/ci-go-cover.yml - .github/workflows/ci.yml - .github/workflows/linters.yml - .github/workflows/time-package.yml This enables local CI testing on ARM64 systems while maintaining full backward compatibility with existing x86_64 runners. Fixes #60 Signed-off-by: Kallal Mukherjee --- .github/workflows/ci-go-cover.yml | 25 +++++++++++++++++++++---- .github/workflows/ci.yml | 25 +++++++++++++++++++++---- .github/workflows/linters.yml | 25 +++++++++++++++++++++---- .github/workflows/time-package.yml | 25 +++++++++++++++++++++---- 4 files changed, 84 insertions(+), 16 deletions(-) diff --git a/.github/workflows/ci-go-cover.yml b/.github/workflows/ci-go-cover.yml index 6c527509..e132f371 100644 --- a/.github/workflows/ci-go-cover.yml +++ b/.github/workflows/ci-go-cover.yml @@ -39,10 +39,27 @@ jobs: run: | go install golang.org/x/tools/cmd/guru@latest - name: Install Protoc - uses: arduino/setup-protoc@v1 - with: - version: '3.x' - repo-token: ${{ secrets.GITHUB_TOKEN }} + run: | + # Install protoc with ARM64 support + PROTOC_VERSION="25.1" + ARCH=$(uname -m) + if [[ "$ARCH" == "x86_64" ]]; then + PROTOC_ARCH="x86_64" + elif [[ "$ARCH" == "aarch64" || "$ARCH" == "arm64" ]]; then + PROTOC_ARCH="aarch_64" + else + echo "Unsupported architecture: $ARCH" + exit 1 + fi + + PROTOC_ZIP="protoc-${PROTOC_VERSION}-linux-${PROTOC_ARCH}.zip" + curl -OL "https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/${PROTOC_ZIP}" + sudo unzip -o "$PROTOC_ZIP" -d /usr/local bin/protoc + sudo unzip -o "$PROTOC_ZIP" -d /usr/local 'include/*' + rm -f "$PROTOC_ZIP" + + # Verify installation + protoc --version - name: protoc-gen deps run: | go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.26 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6673b562..eea0b870 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,10 +25,27 @@ jobs: run: | go install golang.org/x/tools/cmd/guru@latest - name: Install Protoc - uses: arduino/setup-protoc@v1 - with: - version: '3.x' - repo-token: ${{ secrets.GITHUB_TOKEN }} + run: | + # Install protoc with ARM64 support + PROTOC_VERSION="25.1" + ARCH=$(uname -m) + if [[ "$ARCH" == "x86_64" ]]; then + PROTOC_ARCH="x86_64" + elif [[ "$ARCH" == "aarch64" || "$ARCH" == "arm64" ]]; then + PROTOC_ARCH="aarch_64" + else + echo "Unsupported architecture: $ARCH" + exit 1 + fi + + PROTOC_ZIP="protoc-${PROTOC_VERSION}-linux-${PROTOC_ARCH}.zip" + curl -OL "https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/${PROTOC_ZIP}" + sudo unzip -o "$PROTOC_ZIP" -d /usr/local bin/protoc + sudo unzip -o "$PROTOC_ZIP" -d /usr/local 'include/*' + rm -f "$PROTOC_ZIP" + + # Verify installation + protoc --version - name: protoc-gen deps run: | go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.26 diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml index dab21e3b..2827ae2d 100644 --- a/.github/workflows/linters.yml +++ b/.github/workflows/linters.yml @@ -26,10 +26,27 @@ jobs: run: | go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest - name: Install Protoc - uses: arduino/setup-protoc@v1 - with: - version: '3.x' - repo-token: ${{ secrets.GITHUB_TOKEN }} + run: | + # Install protoc with ARM64 support + PROTOC_VERSION="25.1" + ARCH=$(uname -m) + if [[ "$ARCH" == "x86_64" ]]; then + PROTOC_ARCH="x86_64" + elif [[ "$ARCH" == "aarch64" || "$ARCH" == "arm64" ]]; then + PROTOC_ARCH="aarch_64" + else + echo "Unsupported architecture: $ARCH" + exit 1 + fi + + PROTOC_ZIP="protoc-${PROTOC_VERSION}-linux-${PROTOC_ARCH}.zip" + curl -OL "https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/${PROTOC_ZIP}" + sudo unzip -o "$PROTOC_ZIP" -d /usr/local bin/protoc + sudo unzip -o "$PROTOC_ZIP" -d /usr/local 'include/*' + rm -f "$PROTOC_ZIP" + + # Verify installation + protoc --version - name: protoc-gen deps run: | go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.26 diff --git a/.github/workflows/time-package.yml b/.github/workflows/time-package.yml index 9e2c8143..e74ade5e 100644 --- a/.github/workflows/time-package.yml +++ b/.github/workflows/time-package.yml @@ -35,10 +35,27 @@ jobs: run: | go install golang.org/x/tools/cmd/guru@latest - name: Install Protoc - uses: arduino/setup-protoc@v1 - with: - version: '3.x' - repo-token: ${{ secrets.GITHUB_TOKEN }} + run: | + # Install protoc with ARM64 support + PROTOC_VERSION="25.1" + ARCH=$(uname -m) + if [[ "$ARCH" == "x86_64" ]]; then + PROTOC_ARCH="x86_64" + elif [[ "$ARCH" == "aarch64" || "$ARCH" == "arm64" ]]; then + PROTOC_ARCH="aarch_64" + else + echo "Unsupported architecture: $ARCH" + exit 1 + fi + + PROTOC_ZIP="protoc-${PROTOC_VERSION}-linux-${PROTOC_ARCH}.zip" + curl -OL "https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/${PROTOC_ZIP}" + sudo unzip -o "$PROTOC_ZIP" -d /usr/local bin/protoc + sudo unzip -o "$PROTOC_ZIP" -d /usr/local 'include/*' + rm -f "$PROTOC_ZIP" + + # Verify installation + protoc --version - name: protoc-gen deps run: | go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.26