Skip to content

Commit ce697f9

Browse files
authored
Merge pull request #275 from RayforceDB/fix/portable-tarballs
ci(release): portable Linux tarball (x86-64-v3), one build for tarball + .deb
2 parents 71fc719 + 554fd3f commit ce697f9

2 files changed

Lines changed: 24 additions & 21 deletions

File tree

.github/workflows/release.yml

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,17 @@ jobs:
101101
strategy:
102102
fail-fast: false
103103
matrix:
104+
# Distributables must be PORTABLE, not -march=native: a native binary
105+
# built on a runner can SIGILL on a different/older CPU. x86-64-v3 =
106+
# AVX2 baseline (~2013+), which keeps the engine's vectorized reductions
107+
# fast. The macOS runner is the oldest Apple-Silicon class, so native
108+
# there is effectively a safe floor (arm64 has no x86-style optional-ISA
109+
# traps, and baselining to armv8-a would only lose M1 tuning).
104110
include:
105111
- os: ubuntu-latest
112+
march: x86-64-v3
106113
- os: macos-latest
114+
march: native
107115
# Windows is not build-ready yet (IOCP stub, unguarded POSIX in
108116
# main.c/heap.c, no Makefile path). Add once the port lands:
109117
# - os: windows-latest
@@ -114,8 +122,8 @@ jobs:
114122
with:
115123
ref: ${{ needs.prepare.outputs.sha }}
116124

117-
- name: Build release artifact
118-
run: make dist RAY_VERSION=${{ needs.prepare.outputs.version }}
125+
- name: Build release artifact (portable)
126+
run: make dist RAY_VERSION=${{ needs.prepare.outputs.version }} RAY_MARCH=${{ matrix.march }}
119127

120128
- name: Upload artifacts to release
121129
env:
@@ -126,18 +134,14 @@ jobs:
126134
gh release upload "v${{ needs.prepare.outputs.version }}" \
127135
dist/*.tar.gz dist/*.sha256 --clobber
128136
129-
# The tarball above is -march=native (built for THIS runner's CPU). For a
130-
# redistributable .deb we rebuild a PORTABLE binary (x86-64-v3 = AVX2,
131-
# ~2013+) so it can't SIGILL on a different/older CPU; `make clean` first
132-
# so the native .o files aren't reused.
133-
- name: Build portable .deb (Linux)
137+
# Package the just-built (already-portable) Linux binary as a .deb —
138+
# `make dist` left ./rayforce in place, so no rebuild is needed.
139+
- name: Build .deb (Linux)
134140
if: matrix.os == 'ubuntu-latest'
135141
env:
136142
RAY_VERSION: ${{ needs.prepare.outputs.version }}
137143
run: |
138144
set -euo pipefail
139-
make clean
140-
make release RAY_VERSION="$RAY_VERSION" RAY_MARCH=x86-64-v3
141145
ver="$(curl -fsSL https://api.github.com/repos/goreleaser/nfpm/releases/latest | grep -oP '"tag_name":\s*"\K[^"]+')"
142146
curl -fsSL "https://github.com/goreleaser/nfpm/releases/download/${ver}/nfpm_${ver#v}_amd64.deb" -o /tmp/nfpm.deb
143147
sudo dpkg -i /tmp/nfpm.deb

RELEASE.md

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -108,23 +108,22 @@ make dist RAY_VERSION=2.1.3
108108
Each release publishes, in addition to the source:
109109

110110
- **Tarballs**`rayforce-X.Y.Z-linux-x86_64.tar.gz` and
111-
`…-darwin-arm64.tar.gz` (+ `.sha256`), built `-march=native` for *that*
112-
runner. Fast, but per-machine — fine to download and run on a similar box.
113-
- **`.deb`** (`rayforce_X.Y.Z_amd64.deb`) — built **portable** via the Makefile
114-
`RAY_MARCH=x86-64-v3` knob ([`packaging/nfpm.yaml`](packaging/nfpm.yaml)), so
115-
it runs on any AVX2-era (~2013+) x86-64 CPU instead of SIGILL'ing on a
116-
mismatch. No setup needed (uses `GITHUB_TOKEN`).
111+
`…-darwin-arm64.tar.gz` (+ `.sha256`). The Linux one is **portable**
112+
(`RAY_MARCH=x86-64-v3`, AVX2/~2013+) so it can't SIGILL on a different/older
113+
CPU. macOS stays `-march=native`: the runner is the oldest Apple-Silicon
114+
class, so it's already a safe floor (arm64 has no x86-style optional-ISA
115+
traps, and baselining to `armv8-a` would only cost M1 tuning).
116+
- **`.deb`** (`rayforce_X.Y.Z_amd64.deb`) — the same portable Linux binary,
117+
packaged with nfpm ([`packaging/nfpm.yaml`](packaging/nfpm.yaml)). No setup
118+
(uses `GITHUB_TOKEN`).
117119
- **Homebrew** (`rayforcedb/tap`) — a **build-from-source** formula
118120
([`packaging/homebrew-formula.rb.tmpl`](packaging/homebrew-formula.rb.tmpl)),
119121
auto-bumped by the `homebrew` job. Compiling on the user's machine means all
120122
Mac arches work and there's no redistribution-portability footgun.
121123

122-
> **Note — the tarballs are still `-march=native`.** That's a latent
123-
> SIGILL-on-a-different-CPU risk if someone downloads one for a machine unlike
124-
> the runner. If you'd rather they were portable too, build them with
125-
> `RAY_MARCH=x86-64-v3` in the `build` job (like the `.deb`); the trade-off is
126-
> losing `-march=native`'s last bit of per-CPU tuning. Source builds (`make`,
127-
> Homebrew) always get native.
124+
> Want maximum per-CPU performance instead of a portable binary? Build from
125+
> source — `make` and Homebrew both default to `-march=native`. Only the
126+
> *distributed* x86-64 artifacts use the `x86-64-v3` baseline.
128127
129128
## Platform support
130129

0 commit comments

Comments
 (0)