Merge pull request #171 from birth-software/change-zig-download-method
Change Zig download method
This commit is contained in:
commit
3c6aaf67d0
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
@ -16,7 +16,7 @@ jobs:
|
|||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
- name: Build and test
|
- name: Build and test
|
||||||
run: sh ci/linux_gnu_runner.sh
|
run: ./ci/linux_gnu_runner.sh
|
||||||
macos:
|
macos:
|
||||||
runs-on: macos-latest
|
runs-on: macos-latest
|
||||||
timeout-minutes: 15
|
timeout-minutes: 15
|
||||||
@ -24,4 +24,4 @@ jobs:
|
|||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
- name: Build and test
|
- name: Build and test
|
||||||
run: sh ci/macos_runner.sh
|
run: ./ci/macos_runner.sh
|
||||||
|
18
ci/download_zig.sh
Executable file
18
ci/download_zig.sh
Executable 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
10
ci/linux_gnu_runner.sh
Normal file → Executable file
@ -1,4 +1,4 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
set -ex
|
set -ex
|
||||||
|
|
||||||
# Install LLVM and system dependencies
|
# 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
|
sudo apt install liblld-17-dev libclang-17-dev liblld-17 ninja-build cmake -y
|
||||||
|
|
||||||
# Install Zig
|
# Install Zig
|
||||||
ZIG_VERSION=0.12.0
|
source ci/download_zig.sh
|
||||||
ZIG_PACKAGE_NAME=zig-linux-x86_64-$ZIG_VERSION
|
download_zig master x86_64-linux
|
||||||
wget https://ziglang.org/download/$ZIG_VERSION/$ZIG_PACKAGE_NAME.tar.xz
|
|
||||||
tar xf $ZIG_PACKAGE_NAME.tar.xz
|
|
||||||
|
|
||||||
# Build and test
|
# 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
10
ci/macos_runner.sh
Normal file → Executable file
@ -1,4 +1,4 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
set -ex
|
set -ex
|
||||||
|
|
||||||
# Install LLVM and system dependencies
|
# Install LLVM and system dependencies
|
||||||
@ -6,10 +6,8 @@ brew update
|
|||||||
brew install llvm@17 ninja
|
brew install llvm@17 ninja
|
||||||
|
|
||||||
# Install Zig
|
# Install Zig
|
||||||
ZIG_VERSION=0.12.0
|
source ci/download_zig.sh
|
||||||
ZIG_PACKAGE_NAME=zig-macos-aarch64-$ZIG_VERSION
|
download_zig master aarch64-macos
|
||||||
wget https://ziglang.org/download/$ZIG_VERSION/$ZIG_PACKAGE_NAME.tar.xz
|
|
||||||
tar xf $ZIG_PACKAGE_NAME.tar.xz
|
|
||||||
|
|
||||||
# Build and test
|
# Build and test
|
||||||
$ZIG_PACKAGE_NAME/zig build test -Dthird_party_ci=true
|
zig build test -Dthird_party_ci=true
|
||||||
|
Loading…
x
Reference in New Issue
Block a user