Skip to content

v0.1.3 — verify release.yml end-to-end with nullglob fix #4

v0.1.3 — verify release.yml end-to-end with nullglob fix

v0.1.3 — verify release.yml end-to-end with nullglob fix #4

Workflow file for this run

name: Release
# Build prebuilt staticlibs for every supported target on tag, attach to the
# GitHub release. The npm package can either vendor these (simpler) or pull
# them via `postinstall` (smaller tarball).
on:
push:
tags:
- 'v*.*.*'
workflow_dispatch:
jobs:
build:
name: ${{ matrix.target }}
strategy:
# One target's failure shouldn't cancel the others — without this,
# a missing aarch64 cross-toolchain on ubuntu-latest cascades into
# cancellation of the macOS + Windows legs that would otherwise
# succeed.
fail-fast: false
matrix:
include:
- target: x86_64-apple-darwin
os: macos-latest
- target: aarch64-apple-darwin
os: macos-latest
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
- target: x86_64-pc-windows-msvc
os: windows-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
# mimalloc-sys (transitive via perry-runtime) compiles its C
# sources for the *target* arch through cc-rs, which means
# aarch64-linux needs a cross-compiling gcc on the runner. The
# ubuntu-latest image doesn't carry one by default.
- name: Install aarch64-linux cross-toolchain
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: sudo apt-get update && sudo apt-get install -y gcc-aarch64-linux-gnu
- name: Build
env:
CC_aarch64_unknown_linux_gnu: aarch64-linux-gnu-gcc
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
run: cargo build --release --target ${{ matrix.target }}
- name: Stage artifact
shell: bash
run: |
# nullglob: empty globs expand to nothing instead of leaving the
# literal pattern, so the `*.lib` pattern is harmless on macOS /
# Linux (and `*.a` on Windows). Without it, the loop would hit
# an `[ -f literal-pattern ]` that fails under `set -e`.
shopt -s nullglob
mkdir -p artifact/${{ matrix.target }}
# macOS / Linux pattern: lib<name>.a; Windows pattern: <name>.lib
for f in target/${{ matrix.target }}/release/*.a target/${{ matrix.target }}/release/*.lib; do
cp "$f" artifact/${{ matrix.target }}/
done
- uses: actions/upload-artifact@v4
with:
name: prebuilt-${{ matrix.target }}
path: artifact/${{ matrix.target }}/
publish:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: prebuilt/
- name: Attach to release
uses: softprops/action-gh-release@v2
with:
files: prebuilt/**