-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
.github, config: cross-compile an arm64 asset
And install Zig via script, rather than snap. One benefit is that it allows us to pin a Zig version. The script is adapted from one I added to the Exercism Zig repo [1]. [1] exercism/zig@9dfb95f031b1
- Loading branch information
Showing
7 changed files
with
107 additions
and
26 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,18 @@ | ||
#!/usr/bin/env sh | ||
|
||
nimble --accept install --depsOnly | ||
|
||
artifacts_dir='artifacts' | ||
mkdir -p "${artifacts_dir}" | ||
|
||
target='aarch64-linux-musl' | ||
arch='arm64' | ||
os='linux' | ||
nimble --verbose build --cpu:"${arch}" --os:"${os}" -d:release -d:zig -d:target:"${target}" | ||
|
||
binary_name='configlet' | ||
build_tag="${GITHUB_REF_NAME}" | ||
artifact_file="${artifacts_dir}/${binary_name}_${build_tag}_${os}_${arch}.tar.gz" | ||
tar -cvzf "${artifact_file}" "${binary_name}" | ||
|
||
gh release upload "${build_tag}" "${artifacts_dir}/${artifact_file}" |
This file was deleted.
Oops, something went wrong.
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,2 @@ | ||
#!/usr/bin/env sh | ||
sudo apt-get install musl-dev musl-tools |
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,45 @@ | ||
#!/usr/bin/env bash | ||
set -eo pipefail | ||
|
||
version='0.11.0' # 2023-08-04 | ||
release_name="zig-linux-x86_64-${version}" | ||
archive="${release_name}.tar.xz" | ||
url="https://ziglang.org/download/${version}/${archive}" | ||
|
||
curlopts=( | ||
--silent | ||
--show-error | ||
--fail | ||
--location | ||
--retry 3 | ||
) | ||
|
||
# Download the release archive. | ||
echo "Downloading Zig release archive..." >&2 | ||
curl "${curlopts[@]}" --output "${archive}" "${url}" | ||
|
||
# Check that the archive has the expected hash. | ||
echo "Verifying archive..." >&2 | ||
archive_sha256='2d00e789fec4f71790a6e7bf83ff91d564943c5ee843c5fd966efc474b423047' | ||
echo "${archive_sha256} ${archive}" | sha256sum -c - | ||
|
||
# Extract the archive, then remove it. | ||
echo "Extracting archive..." >&2 | ||
tar xJf "${archive}" | ||
rm "${archive}" | ||
|
||
# Add zig directory to `GITHUB_PATH`. | ||
zig_dir="$(pwd)/${release_name}" | ||
echo "${zig_dir}" >> "${GITHUB_PATH}" | ||
|
||
# Install `zigcc`, which is just a wrapper for `zig cc`. We need this because | ||
# the value of e.g. `--clang.exe` cannot contain a space (Nim requires the value | ||
# to be an executable, not a command). | ||
zigcc_path="${zig_dir}/zigcc" | ||
printf '#!/usr/bin/env sh\nzig cc $@\n' > "${zigcc_path}" | ||
chmod +x "${zigcc_path}" | ||
|
||
# Print the versions of Zig and Clang. | ||
"${zig_dir}"/zig version | ||
"${zig_dir}"/zig cc --version | ||
echo "Successfully installed Zig ${version}." |
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
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
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