Change Zig download method

This commit is contained in:
David Gonzalez Martin 2024-04-26 21:38:00 -06:00
parent eeeb326353
commit 5bc46c8b93
4 changed files with 28 additions and 14 deletions

View File

@ -16,7 +16,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Build and test
run: sh ci/linux_gnu_runner.sh
run: ./ci/linux_gnu_runner.sh
macos:
runs-on: macos-latest
timeout-minutes: 15
@ -24,4 +24,4 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
- name: Build and test
run: sh ci/macos_runner.sh
run: ./ci/macos_runner.sh

18
ci/download_zig.sh Executable file
View File

@ -0,0 +1,18 @@
#!/bin/bash
set -ex
download_zig()
{
package_version=$1
package_system=$2
package_json=$(curl -s https://ziglang.org/download/index.json)
package_info=$(jq ".$package_version[\"$package_system\"]" <<< $package_json)
package_tarball=$(jq -n "$package_info" | jq --raw-output ".tarball")
package_shasum=$(jq -n "$package_info" | jq --raw-output ".shasum")
package_size=$(jq -n "$package_info" | jq --raw-output ".size")
package_full_version=$(basename ${package_tarball} .tar.xz)
destination_dir=$PWD/zig_download
mkdir -p $destination_dir
curl ${package_tarball} | tar -xJC $destination_dir
export PATH="$destination_dir/$package_full_version:$PATH"
}

10
ci/linux_gnu_runner.sh Normal file → Executable file
View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
set -ex
# Install LLVM and system dependencies
@ -8,10 +8,8 @@ sudo ./llvm.sh 17 all
sudo apt install liblld-17-dev libclang-17-dev liblld-17 ninja-build cmake -y
# Install Zig
ZIG_VERSION=0.12.0
ZIG_PACKAGE_NAME=zig-linux-x86_64-$ZIG_VERSION
wget https://ziglang.org/download/$ZIG_VERSION/$ZIG_PACKAGE_NAME.tar.xz
tar xf $ZIG_PACKAGE_NAME.tar.xz
source ci/download_zig.sh
download_zig master x86_64-linux
# Build and test
$ZIG_PACKAGE_NAME/zig build test -Dthird_party_ci=true
zig build test -Dthird_party_ci=true

10
ci/macos_runner.sh Normal file → Executable file
View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
set -ex
# Install LLVM and system dependencies
@ -6,10 +6,8 @@ brew update
brew install llvm@17 ninja
# Install Zig
ZIG_VERSION=0.12.0
ZIG_PACKAGE_NAME=zig-macos-aarch64-$ZIG_VERSION
wget https://ziglang.org/download/$ZIG_VERSION/$ZIG_PACKAGE_NAME.tar.xz
tar xf $ZIG_PACKAGE_NAME.tar.xz
source ci/download_zig.sh
download_zig master aarch64-macos
# Build and test
$ZIG_PACKAGE_NAME/zig build test -Dthird_party_ci=true
zig build test -Dthird_party_ci=true