Skip to content

Commit

Permalink
Fix protoc installation at CI (#485)
Browse files Browse the repository at this point in the history
  • Loading branch information
MOZGIII authored Oct 1, 2022
1 parent e7f164c commit 76dfb96
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 8 deletions.
2 changes: 2 additions & 0 deletions .github/scripts/build_env/macos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,5 @@ EOF

cat ./.cargo/config.toml
fi

.github/scripts/protoc.sh
2 changes: 2 additions & 0 deletions .github/scripts/build_env/ubuntu.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,5 @@ rustflags = ["-C", "link-arg=-fuse-ld=${MOLD_PATH}"]
EOF

cat ./.cargo/config.toml

.github/scripts/protoc.sh
4 changes: 4 additions & 0 deletions .github/scripts/build_env/windows.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash
set -euo pipefail

.github/scripts/protoc.sh
30 changes: 30 additions & 0 deletions .github/scripts/protoc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash
set -euo pipefail

PROTOBUF_VERSION="21.7"
PROTOBUF_RELEASES_URL="https://github.com/protocolbuffers/protobuf/releases"

# Aw, how cure, they use python instead of uname...
PROTOBUF_PLATFORM="$(python3 -c 'import sysconfig; print(sysconfig.get_platform())')"
case "$PROTOBUF_PLATFORM" in
"macosx-"*"-arm64")
PROTOBUF_PLATFORM="osx-aarch_64"
;;
"macosx-"*"-x86_64")
PROTOBUF_PLATFORM="osx-x86_64"
;;
"linux-aarch64")
PROTOBUF_PLATFORM="linux-aarch_64"
;;
esac

URL="$PROTOBUF_RELEASES_URL/download/v$PROTOBUF_VERSION/protoc-$PROTOBUF_VERSION-$PROTOBUF_PLATFORM.zip"

printf "Downloading protobuf from %s\n" "$URL"
curl -sSL "$URL" -o protoc.zip

INSTALL_PATH="/usr/local"
sudo unzip -o -d "$INSTALL_PATH" protoc.zip
rm protoc.zip

protoc --version
3 changes: 0 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,6 @@ jobs:
run: rustup show
timeout-minutes: 10

- name: Install Protoc
uses: arduino/setup-protoc@v1

- name: Prepare the build environment
run: ${{ matrix.plan.platform.buildEnvScript }}

Expand Down
7 changes: 2 additions & 5 deletions .github/workflows/code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,6 @@ jobs:
run: rustup show
timeout-minutes: 10

- name: Install Protoc
uses: arduino/setup-protoc@v1

- name: Prepare the build environment
run: ${{ matrix.plan.platform.buildEnvScript }}

Expand Down Expand Up @@ -115,8 +112,8 @@ jobs:
run: rustup show
timeout-minutes: 10

- name: Install Protoc
uses: arduino/setup-protoc@v1
- name: Prepare the build environment
run: .github/scripts/build_env/ubuntu.sh

- name: Cache
uses: Swatinem/rust-cache@v2
Expand Down

0 comments on commit 76dfb96

Please sign in to comment.