Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: release builds for many os and cpu arch targets #166

Merged
merged 13 commits into from
Dec 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 30 additions & 16 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@ name: Release

on:
push:
branches:
- main
tags:
- "v*.*.*"

env:
ZIG_VERSION: 0.13.0

Expand All @@ -17,10 +16,12 @@ permissions:
jobs:
build:
strategy:
# keep building others in case it's os-specific
fail-fast: false
matrix:
# FIXME: handle windows paths in attestation and upload steps
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
os: [linux, windows, macos]
arch: [aarch64, x86_64]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: mlugg/setup-zig@v1
Expand All @@ -29,30 +30,45 @@ jobs:

- name: Get binary name
id: binary_name
run: echo "binary_name=zlint-${{ runner.os }}-${{ runner.arch }}" >> "$GITHUB_OUTPUT"

run: |
binary_name=zlint-${{ matrix.os }}-${{ matrix.arch }}
if [[ "${{ matrix.os }}" == "windows" ]] ; then
binary_name="${binary_name}.exe"
fi
echo "binary_name=$binary_name" >> "$GITHUB_OUTPUT"

- name: zig build
env:
BINARY_NAME: ${{ steps.binary_name.outputs.binary_name }}
run: |
zig build --summary all --color on --release=safe -Dversion=${{ github.ref_name }}
mv zig-out/bin/zlint zig-out/bin/${{ env.BINARY_NAME }}
binary_name=zlint
if [[ "${{ matrix.os }}" == "windows" ]] ; then
binary_name="${binary_name}.exe"
fi
zig build --summary all --color on \
--release=safe \
-Dversion=${{ github.ref_name }} \
-Dtarget=${{ matrix.arch }}-${{ matrix.os }}
mv zig-out/bin/${binary_name} zig-out/bin/${{ env.BINARY_NAME }}

- name: Generate artifact attestation
uses: actions/attest-build-provenance@v1
env:
BINARY_NAME: ${{ steps.binary_name.outputs.binary_name }}
with:
subject-path: zig-out/bin/${{ steps.binary_name.outputs.binary_name }}
subject-path: zig-out/bin/${{ env.BINARY_NAME }}

- name: Upload zlint binary
uses: actions/upload-artifact@v4
env:
BINARY_NAME: ${{ steps.binary_name.outputs.binary_name }}
with:
path: zig-out/bin/zlint-${{ runner.os }}-${{ runner.arch }}
name: zlint-${{ runner.os }}-${{ runner.arch }}
path: zig-out/bin/${{ env.BINARY_NAME}}
name: ${{ env.BINARY_NAME }}
retention-days: 1


# TODO
release:
# Not used. Leaving here in case we want to create canary builds
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
needs:
Expand All @@ -66,8 +82,6 @@ jobs:
pattern: zlint-*
path: zig-out/dist
merge-multiple: true
# TODO
- run: ls -lA zig-out/dist
- name: Release
uses: softprops/action-gh-release@v2
with:
Expand Down
Loading