-
Notifications
You must be signed in to change notification settings - Fork 728
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Roberto Scolaro <[email protected]>
- Loading branch information
1 parent
6d6058c
commit 3668f63
Showing
2 changed files
with
100 additions
and
198 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: 'install-zig' | ||
description: 'Install zig compiler and make it available in PATH.' | ||
inputs: | ||
arch: | ||
description: 'The arch of the build' | ||
required: true | ||
default: 'x86_64' | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Store zig version as local output | ||
shell: bash | ||
id: store | ||
env: | ||
ZIG_VERSION: '0.14.0-dev.1952+9f84f7f92' | ||
run: | | ||
echo "zig_version=${ZIG_VERSION}" >> "$GITHUB_OUTPUT" | ||
# TODO: this is only needed because we are using a development version of zig, | ||
# since we need https://github.com/ziglang/zig/pull/21253 to be included. | ||
# Development versions of zig are not kept alive forever, but get overridden. | ||
# We cache it to keep it alive. | ||
- name: Download zig (cached) | ||
id: cache-zig | ||
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 | ||
with: | ||
path: zig | ||
key: zig-${{ runner.os }}-${{ runner.arch }}-${{ steps.store.outputs.zig_version }} | ||
|
||
- name: Download zig | ||
if: steps.cache-zig.outputs.cache-hit != 'true' | ||
shell: bash | ||
run: | | ||
curl -L -o zig.tar.xz https://ziglang.org/builds/zig-linux-$(uname -m)-${{ steps.store.outputs.zig_version }}.tar.xz | ||
tar -xvf zig.tar.xz | ||
cat > zig-linux-$(uname -m)-${{ steps.store.outputs.zig_version }}/zig-cc <<EOF | ||
#!/bin/bash | ||
exec zig cc -target ${{ github.event.inputs.arch }}-linux-gnu.2.17 -mcpu=baseline "\$@" | ||
EOF | ||
chmod +x zig-linux-$(uname -m)-${{ steps.store.outputs.zig_version }}/zig-cc | ||
cat > zig-linux-$(uname -m)-${{ steps.store.outputs.zig_version }}/zig-c++ <<EOF | ||
#!/bin/bash | ||
exec zig c++ -target ${{ github.event.inputs.arch }}-linux-gnu.2.17 -mcpu=baseline "\$@" | ||
EOF | ||
chmod +x zig-linux-$(uname -m)-${{ steps.store.outputs.zig_version }}/zig-c++ | ||
mv zig-linux-$(uname -m)-${{ steps.store.outputs.zig_version }}/ zig | ||
- name: Setup zig | ||
shell: bash | ||
id: zig | ||
run: | | ||
echo "$(pwd)/zig" >> $GITHUB_PATH | ||
echo "CC=zig-cc" >> $GITHUB_ENV | ||
echo "CXX=zig-c++" >> $GITHUB_ENV | ||
echo "AR=zig ar" >> $GITHUB_ENV | ||
echo "RANLIB=zig ranlib" >> $GITHUB_ENV |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters