Skip to content
Closed
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
150 changes: 49 additions & 101 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,130 +11,78 @@ permissions:
contents: write

jobs:
build-linux-x86_64:
build:
strategy:
matrix:
include:
- os: linux
arch: x86_64
runner: ubuntu-22.04
- os: linux
arch: aarch64
runner: ubuntu-latest # Use a runner that supports ARM64, like ubuntu-latest or a self-hosted one
- os: macos
arch: aarch64
runner: macos-latest # macos-latest is typically ARM64
- os: macos
arch: x86_64
runner: macos-13 # Specify an x86_64 runner if needed

runs-on: ${{ matrix.runner }}
env:
ARCH: x86_64
OS: linux

runs-on: ubuntu-22.04
ARCH: ${{ matrix.arch }}
OS: ${{ matrix.os }}
ARTIFACT_NAME: lightpanda-${{ matrix.arch }}-${{ matrix.os }}

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
# fetch submodules recusively, to get zig-js-runtime submodules also.
# fetch submodules recursively, to get zig-js-runtime submodules also.
submodules: recursive

- uses: ./.github/actions/install
with:
os: ${{env.OS}}
arch: ${{env.ARCH}}

- name: zig build
run: zig build --release=safe -Doptimize=ReleaseSafe -Dcpu=x86_64 -Dgit_commit=$(git rev-parse --short ${{ github.sha }})
os: ${{ env.OS }}
arch: ${{ env.ARCH }}

- name: Rename binary
run: mv zig-out/bin/lightpanda lightpanda-${{ env.ARCH }}-${{ env.OS }}

- name: Upload the build
uses: ncipollo/release-action@v1
with:
allowUpdates: true
artifacts: lightpanda-${{ env.ARCH }}-${{ env.OS }}
tag: nightly

build-linux-aarch64:
env:
ARCH: aarch64
OS: linux

runs-on: ubuntu-24.04-arm

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
# fetch submodules recusively, to get zig-js-runtime submodules also.
submodules: recursive

- uses: ./.github/actions/install
with:
os: ${{env.OS}}
arch: ${{env.ARCH}}
- name: Set Git SHA Short Env Var
id: vars
run: echo "GIT_SHA_SHORT=$(git rev-parse --short ${{ github.sha }})" >> $GITHUB_ENV

- name: zig build
run: zig build --release=safe -Doptimize=ReleaseSafe -Dgit_commit=$(git rev-parse --short ${{ github.sha }})
run: zig build --release=safe -Doptimize=ReleaseSafe -Dgit_commit=${{ env.GIT_SHA_SHORT }}

- name: Rename binary
run: mv zig-out/bin/lightpanda lightpanda-${{ env.ARCH }}-${{ env.OS }}
run: mv zig-out/bin/lightpanda ${{ env.ARTIFACT_NAME }}

- name: Upload the build
uses: ncipollo/release-action@v1
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
allowUpdates: true
artifacts: lightpanda-${{ env.ARCH }}-${{ env.OS }}
tag: nightly

build-macos-aarch64:
env:
ARCH: aarch64
OS: macos

runs-on: macos-latest
name: ${{ env.ARTIFACT_NAME }}
path: ${{ env.ARTIFACT_NAME }}

release:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
fetch-depth: 0
# fetch submodules recusively, to get zig-js-runtime submodules also.
submodules: recursive

- uses: ./.github/actions/install
with:
os: ${{env.OS}}
arch: ${{env.ARCH}}

- name: zig build
run: zig build --release=safe -Doptimize=ReleaseSafe -Dgit_commit=$(git rev-parse --short ${{ github.sha }})

- name: Rename binary
run: mv zig-out/bin/lightpanda lightpanda-${{ env.ARCH }}-${{ env.OS }}

- name: Upload the build
uses: ncipollo/release-action@v1
with:
allowUpdates: true
artifacts: lightpanda-${{ env.ARCH }}-${{ env.OS }}
tag: nightly

build-macos-x86_64:
env:
ARCH: x86_64
OS: macos

runs-on: macos-13

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
# fetch submodules recusively, to get zig-js-runtime submodules also.
submodules: recursive

- uses: ./.github/actions/install
with:
os: ${{env.OS}}
arch: ${{env.ARCH}}
path: artifacts # Downloads all artifacts into the 'artifacts' directory

- name: zig build
run: zig build --release=safe -Doptimize=ReleaseSafe -Dgit_commit=$(git rev-parse --short ${{ github.sha }})

- name: Rename binary
run: mv zig-out/bin/lightpanda lightpanda-${{ env.ARCH }}-${{ env.OS }}
- name: Generate checksums
working-directory: artifacts
# Find all artifact directories (one per build job) and checksum the file inside each
run: find . -mindepth 2 -type f -exec sha256sum {} + | tee checksums.txt

- name: Upload the build
- name: Upload binaries and checksums to release
uses: ncipollo/release-action@v1
with:
allowUpdates: true
artifacts: lightpanda-${{ env.ARCH }}-${{ env.OS }}
# List all expected artifact files plus the checksum file
artifacts: artifacts/*/lightpanda-*, artifacts/checksums.txt
# If download-artifact@v4 downloads directly without subfolders:
# artifacts: artifacts/lightpanda-*, artifacts/checksums.txt
tag: nightly
token: ${{ secrets.GITHUB_TOKEN }} # Explicitly pass token
Loading