Skip to content

Commit

Permalink
chore(ci): fix install ziglang for debian (#13914)
Browse files Browse the repository at this point in the history
  • Loading branch information
everpcpc authored Dec 4, 2023
1 parent 3a78bd5 commit 88ea3d3
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/actions/build_macos/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ runs:
- name: Rust setup
shell: bash
run: |
brew unlink python || true
bash ./scripts/setup/dev_setup.sh -yb
rustup target add ${{ inputs.target }}
Expand Down
29 changes: 28 additions & 1 deletion scripts/setup/dev_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,33 @@ function install_build_essentials {
esac
}

function install_ziglang {
PACKAGE_MANAGER=$1

if zig version; then
echo "==> ziglang is already installed"
return
fi
echo "==> installing ziglang..."

case "$PACKAGE_MANAGER" in
apt-get)
curl -sSfLo /tmp/zig.tar.xz https://ziglang.org/download/0.11.0/zig-linux-x86_64-0.11.0.tar.xz
tar -xf /tmp/zig.tar.xz -C /tmp
"${PRE_COMMAND[@]}" cp /tmp/zig-linux-x86_64-0.11.0/zig /usr/local/bin/
"${PRE_COMMAND[@]}" chmod +x /usr/local/bin/zig
rm -rf /tmp/zig*
;;
yum | dnf | brew | pacman)
install_pkg zig "$PACKAGE_MANAGER"
;;
*)
echo "Unable to install ziglang with package manager: $PACKAGE_MANAGER"
exit 1
;;
esac
}

function install_python3 {
PACKAGE_MANAGER=$1

Expand Down Expand Up @@ -525,7 +552,7 @@ if [[ "$INSTALL_BUILD_TOOLS" == "true" ]]; then
install_pkg cmake "$PACKAGE_MANAGER"
install_pkg clang "$PACKAGE_MANAGER"
install_pkg llvm "$PACKAGE_MANAGER"
install_pkg zig "$PACKAGE_MANAGER"
install_ziglang "$PACKAGE_MANAGER"
install_python3 "$PACKAGE_MANAGER"

# Any call to cargo will make rustup install the correct toolchain
Expand Down

0 comments on commit 88ea3d3

Please sign in to comment.