diff --git a/.github/workflows/build-artifacts-manual.yml b/.github/workflows/build-artifacts-manual.yml index 873f03a4..c880a852 100644 --- a/.github/workflows/build-artifacts-manual.yml +++ b/.github/workflows/build-artifacts-manual.yml @@ -30,7 +30,9 @@ env: FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true jobs: - build: + build-linux: + if: ${{ inputs.build_group == 'linux' || inputs.build_group == 'all' }} + runs-on: ${{ matrix.os }} strategy: fail-fast: false matrix: @@ -38,22 +40,9 @@ jobs: - 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 }} @@ -71,13 +60,8 @@ jobs: 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 @@ -108,3 +92,62 @@ jobs: ${{ matrix.name }} BUILD_INFO.txt retention-days: 7 + + build-macos: + if: ${{ inputs.build_group == 'macos' || inputs.build_group == 'all' }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + include: + - target: x86_64-apple-darwin + os: macos-latest + name: herdr-macos-x86_64 + - target: aarch64-apple-darwin + os: macos-latest + name: herdr-macos-aarch64 + 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 macOS build tools + run: brew install cmake ninja + + - 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