diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cf46ec1..9f443c9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 diff --git a/ci/download_zig.sh b/ci/download_zig.sh new file mode 100755 index 0000000..b7cff71 --- /dev/null +++ b/ci/download_zig.sh @@ -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" +} diff --git a/ci/linux_gnu_runner.sh b/ci/linux_gnu_runner.sh old mode 100644 new mode 100755 index 0c09542..8c0463b --- a/ci/linux_gnu_runner.sh +++ b/ci/linux_gnu_runner.sh @@ -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 diff --git a/ci/macos_runner.sh b/ci/macos_runner.sh old mode 100644 new mode 100755 index f988c01..99c345f --- a/ci/macos_runner.sh +++ b/ci/macos_runner.sh @@ -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