ci: add manual artifact build workflow
This commit is contained in:
parent
a379741fbb
commit
985b7f74e6
|
|
@ -0,0 +1,110 @@
|
|||
name: Build artifacts (manual)
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
build_group:
|
||||
description: which artifacts to build
|
||||
required: true
|
||||
default: linux
|
||||
type: choice
|
||||
options:
|
||||
- linux
|
||||
- macos
|
||||
- all
|
||||
libghostty_optimize:
|
||||
description: libghostty-vt optimize mode for this build
|
||||
required: true
|
||||
default: ReleaseSafe
|
||||
type: choice
|
||||
options:
|
||||
- ReleaseSafe
|
||||
- ReleaseFast
|
||||
- ReleaseSmall
|
||||
- Debug
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
env:
|
||||
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
|
||||
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- target: x86_64-unknown-linux-musl
|
||||
os: ubuntu-latest
|
||||
name: herdr-linux-x86_64
|
||||
group: linux
|
||||
- target: aarch64-unknown-linux-musl
|
||||
os: ubuntu-latest
|
||||
name: herdr-linux-aarch64
|
||||
group: linux
|
||||
- target: x86_64-apple-darwin
|
||||
os: macos-latest
|
||||
name: herdr-macos-x86_64
|
||||
group: macos
|
||||
- target: aarch64-apple-darwin
|
||||
os: macos-latest
|
||||
name: herdr-macos-aarch64
|
||||
group: macos
|
||||
|
||||
if: ${{ inputs.build_group == 'all' || inputs.build_group == matrix.group }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
env:
|
||||
LIBGHOSTTY_VT_OPTIMIZE: ${{ inputs.libghostty_optimize }}
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install Rust
|
||||
uses: dtolnay/rust-toolchain@stable
|
||||
with:
|
||||
targets: ${{ matrix.target }}
|
||||
|
||||
- name: Install Zig
|
||||
uses: mlugg/setup-zig@v2
|
||||
with:
|
||||
version: 0.15.2
|
||||
|
||||
- name: Install Linux build tools
|
||||
if: runner.os == 'Linux'
|
||||
run: sudo apt-get update && sudo apt-get install -y cmake ninja-build musl-tools gcc-aarch64-linux-gnu crossbuild-essential-arm64
|
||||
|
||||
- name: Install macOS build tools
|
||||
if: runner.os == 'macOS'
|
||||
run: brew install cmake ninja
|
||||
|
||||
- name: Set Linux aarch64 linker
|
||||
if: matrix.target == 'aarch64-unknown-linux-musl'
|
||||
run: echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=aarch64-linux-gnu-gcc" >> $GITHUB_ENV
|
||||
|
||||
- name: Remove Zig caches
|
||||
run: rm -rf .zig-cache vendor/libghostty-vt/.zig-cache vendor/libghostty-vt/zig-out
|
||||
|
||||
- name: Build
|
||||
run: cargo build --release --locked --target ${{ matrix.target }}
|
||||
|
||||
- name: Package artifact
|
||||
run: |
|
||||
cp target/${{ matrix.target }}/release/herdr ${{ matrix.name }}
|
||||
./${{ matrix.name }} --version
|
||||
file ${{ matrix.name }} > BUILD_INFO.txt
|
||||
{
|
||||
echo "commit=$GITHUB_SHA"
|
||||
echo "target=${{ matrix.target }}"
|
||||
echo "libghostty_vt_optimize=$LIBGHOSTTY_VT_OPTIMIZE"
|
||||
} >> BUILD_INFO.txt
|
||||
python3 -c "import hashlib, pathlib; artifact = pathlib.Path('${{ matrix.name }}'); print(f'sha256={hashlib.sha256(artifact.read_bytes()).hexdigest()} {artifact.name}')" >> BUILD_INFO.txt
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ matrix.name }}-${{ inputs.libghostty_optimize }}
|
||||
path: |
|
||||
${{ matrix.name }}
|
||||
BUILD_INFO.txt
|
||||
retention-days: 7
|
||||
Loading…
Reference in New Issue