Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/actions/setup-protoc/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: setup-protoc
description: >-
Install a pinned protoc, resilient to the GitHub release-asset 504s that flake
arduino/setup-protoc. The intermittent timeout is on the release-CDN *download*
(objects.githubusercontent.com), not the GitHub API lookup, so repo-token does
not help. Drop-in replacement that keeps the same pinned version and retries
the download hard before failing the job.
inputs:
version:
description: protoc version to install (without the leading "v").
default: "23.4"
runs:
using: composite
steps:
- name: install protoc ${{ inputs.version }}
shell: bash
run: |
set -euo pipefail
url="https://github.com/protocolbuffers/protobuf/releases/download/v${{ inputs.version }}/protoc-${{ inputs.version }}-linux-x86_64.zip"
# curl's own --retry plus an outer loop: the release CDN 504s are
# intermittent, so retry hard (up to 5 outer x 5 inner) before failing.
for attempt in 1 2 3 4 5; do
echo "::group::protoc download attempt ${attempt}/5"
if curl -fsSL --retry 5 --retry-all-errors --retry-delay 5 --connect-timeout 30 -o /tmp/protoc.zip "${url}"; then
echo "::endgroup::"
break
fi
echo "::endgroup::"
if [ "${attempt}" = 5 ]; then
echo "::error::protoc ${{ inputs.version }} download failed after 5 attempts (GitHub release CDN)"
exit 1
fi
sleep 15
done
# Install under $HOME (no sudo) and expose it to later steps via
# $GITHUB_PATH; pin $PROTOC for prost/tonic build scripts.
dest="${HOME}/.local/protoc-${{ inputs.version }}"
mkdir -p "${dest}"
unzip -o -q /tmp/protoc.zip -d "${dest}" 'bin/protoc' 'include/*'
echo "${dest}/bin" >> "${GITHUB_PATH}"
echo "PROTOC=${dest}/bin/protoc" >> "${GITHUB_ENV}"
# $GITHUB_PATH only affects *subsequent* steps, so verify by full path.
"${dest}/bin/protoc" --version
16 changes: 4 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ jobs:
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: arduino/setup-protoc@v3.0.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: ./.github/actions/setup-protoc
- uses: Swatinem/rust-cache@v2
- name: cargo fmt --check
run: cargo fmt --all -- --check
Expand All @@ -34,9 +32,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: arduino/setup-protoc@v3.0.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: ./.github/actions/setup-protoc
- uses: Swatinem/rust-cache@v2
- name: regenerate schemas
run: cargo run -p aisix-core --bin dump-schema
Expand Down Expand Up @@ -93,9 +89,7 @@ jobs:
- uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview
- uses: arduino/setup-protoc@v3.0.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: ./.github/actions/setup-protoc
- uses: Swatinem/rust-cache@v2
- name: install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
Expand All @@ -118,9 +112,7 @@ jobs:
- uses: dtolnay/rust-toolchain@stable
with:
components: llvm-tools-preview
- uses: arduino/setup-protoc@v3.0.0
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- uses: ./.github/actions/setup-protoc
- uses: Swatinem/rust-cache@v2
- name: build
run: cargo build -p aisix-server --bin aisix
Expand Down
Loading