-
Notifications
You must be signed in to change notification settings - Fork 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
new(ci): add a zig build job plus a composite action to setup zig.
Signed-off-by: Federico Di Pierro <[email protected]>
- Loading branch information
Showing
2 changed files
with
56 additions
and
1 deletion.
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,41 @@ | ||
name: 'install-zig' | ||
description: 'Install zig compiler and make it available in PATH.' | ||
|
||
outputs: | ||
zig_path: | ||
description: "Path of installed zig, automatically added to GITHUB_PATH" | ||
value: ${{ steps.zig.outputs.zig-path }} | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Install zig | ||
shell: bash | ||
id: zig | ||
env: | ||
ZIG_VERSION: '0.14.0-dev.1588+2111f4c38' | ||
run: | | ||
curl -L -o zig.tar.xz https://ziglang.org/builds/zig-linux-$(uname -m)-${ZIG_VERSION}.tar.xz | ||
tar -xvf zig.tar.xz | ||
cat > zig-linux-$(uname -m)-${ZIG_VERSION}/zig-cc <<EOF | ||
#!/bin/bash | ||
exec zig cc -target $(uname -m)-linux-gnu.2.17 -mcpu=baseline "\$@" | ||
EOF | ||
chmod +x zig-linux-$(uname -m)-${ZIG_VERSION}/zig-cc | ||
cat > zig-linux-$(uname -m)-${ZIG_VERSION}/zig-c++ <<EOF | ||
#!/bin/bash | ||
exec zig c++ -target $(uname -m)-linux-gnu.2.17 -mcpu=baseline "\$@" | ||
EOF | ||
chmod +x zig-linux-$(uname -m)-${ZIG_VERSION}/zig-c++ | ||
sudo mkdir -p /usr/local/zig/ | ||
sudo cp -R zig-linux-$(uname -m)-${ZIG_VERSION}/* /usr/local/zig/ | ||
echo "/usr/local/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 | ||
echo "zig-path=/usr/local/zig/zig-linux-$(uname -m)-${ZIG_VERSION}" >> $GITHUB_OUTPUT |
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