Skip to content

Commit b9b4e9f

Browse files
committed
Expand CI precompiled guardrail to full release-blocking matrix
1 parent 4aa82f8 commit b9b4e9f

4 files changed

Lines changed: 113 additions & 9 deletions

File tree

.github/workflows/ci.yml

Lines changed: 110 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -169,13 +169,33 @@ jobs:
169169
run: ./bin/test-packaged-gem-manifest
170170

171171
precompiled-gem-build:
172-
name: precompiled gem build / ${{ matrix.os }}
172+
name: precompiled gem build / ${{ matrix.label }}
173173
runs-on: ${{ matrix.os }}
174-
timeout-minutes: 60
174+
timeout-minutes: 90
175175
strategy:
176176
fail-fast: false
177177
matrix:
178-
os: [ubuntu-latest, macos-14]
178+
include:
179+
- os: ubuntu-latest
180+
platform: x86_64-linux
181+
label: linux-x86_64
182+
kind: linux
183+
- os: ubuntu-latest
184+
platform: x86_64-linux-musl
185+
label: linux-musl-x86_64
186+
kind: musl
187+
- os: macos-15-intel
188+
platform: x86_64-darwin
189+
label: macos-x86_64
190+
kind: macos
191+
- os: macos-14
192+
platform: arm64-darwin
193+
label: macos-arm64
194+
kind: macos
195+
- os: windows-latest
196+
platform: x64-mingw-ucrt
197+
label: windows-x64-mingw-ucrt
198+
kind: windows
179199

180200
steps:
181201
- uses: actions/checkout@v4
@@ -187,20 +207,104 @@ jobs:
187207
bundler-cache: true
188208

189209
- name: Set up Rust toolchain
210+
if: ${{ matrix.kind != 'musl' }}
190211
uses: dtolnay/rust-toolchain@stable
191212

213+
- name: Install Rust GNU toolchain for RubyInstaller ABI
214+
if: ${{ matrix.kind == 'windows' }}
215+
shell: pwsh
216+
run: |
217+
rustup toolchain install stable-x86_64-pc-windows-gnu
218+
"RUSTUP_TOOLCHAIN=stable-x86_64-pc-windows-gnu" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
219+
220+
- name: Resolve cargo path for bash steps
221+
if: ${{ matrix.kind == 'windows' }}
222+
shell: pwsh
223+
run: |
224+
$cargo = (Get-Command cargo -ErrorAction Stop).Source
225+
"CARGO=$cargo" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
226+
Write-Host "Resolved cargo executable: $cargo"
227+
192228
- name: Install Rust bindgen dependencies (Linux)
193-
if: ${{ runner.os == 'Linux' }}
229+
if: ${{ matrix.kind == 'linux' }}
194230
run: sudo apt-get update && sudo apt-get install -y clang libclang-dev pkg-config
195231

196232
- name: Install Rust bindgen dependencies (macOS)
197-
if: ${{ runner.os == 'macOS' }}
233+
if: ${{ matrix.kind == 'macos' }}
198234
run: |
199235
brew install llvm
200236
echo "LIBCLANG_PATH=$(brew --prefix llvm)/lib" >> "${GITHUB_ENV}"
201237
238+
- name: Install LLVM (bindgen dependency)
239+
if: ${{ matrix.kind == 'windows' }}
240+
uses: KyleMayes/install-llvm-action@v2
241+
with:
242+
version: "18.1.8"
243+
244+
- name: Configure bindgen include paths for Windows Ruby headers
245+
if: ${{ matrix.kind == 'windows' }}
246+
shell: pwsh
247+
run: |
248+
$shimInclude = (Resolve-Path "ext/lda-ruby-rust/include").Path.Replace('\', '/')
249+
$includeDirs = @($shimInclude)
250+
$devkitRoot = $null
251+
252+
if ($env:RI_DEVKIT) {
253+
$devkitRoot = $env:RI_DEVKIT.Replace('\', '/')
254+
$candidateDirs = @(
255+
"$devkitRoot/ucrt64/include",
256+
"$devkitRoot/mingw64/include",
257+
"$devkitRoot/usr/include"
258+
)
259+
$withStrings = $candidateDirs | Where-Object { Test-Path "$_/strings.h" } | Select-Object -Unique
260+
if ($withStrings) {
261+
$includeDirs += $withStrings
262+
}
263+
}
264+
265+
$bindgenArgList = @("--target=x86_64-w64-windows-gnu")
266+
if ($devkitRoot) {
267+
$bindgenArgList += "--sysroot=$devkitRoot/ucrt64"
268+
}
269+
$bindgenArgList += ($includeDirs | Select-Object -Unique | ForEach-Object { "-I$_" })
270+
$bindgenArgList += @("-msse2", "-mavx")
271+
$bindgenArgs = $bindgenArgList -join " "
272+
273+
"BINDGEN_EXTRA_CLANG_ARGS_x86_64-pc-windows-gnu=$bindgenArgs" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
274+
"BINDGEN_EXTRA_CLANG_ARGS_x86_64_pc_windows_gnu=$bindgenArgs" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
275+
"BINDGEN_EXTRA_CLANG_ARGS=$bindgenArgs" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
276+
277+
$existingCppFlags = ruby -rrbconfig -e 'print RbConfig::CONFIG.fetch("CPPFLAGS", "")'
278+
$mergedCppFlags = "$existingCppFlags $bindgenArgs".Trim()
279+
"RBCONFIG_CPPFLAGS=$mergedCppFlags" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
280+
281+
Write-Host "Configured bindgen extra clang args: $bindgenArgs"
282+
Write-Host "Configured RBCONFIG_CPPFLAGS: $mergedCppFlags"
283+
202284
- name: Build and verify precompiled gem
203-
run: ./bin/release-precompiled-artifacts --skip-preflight
285+
if: ${{ matrix.kind != 'musl' }}
286+
shell: bash
287+
run: ./bin/release-precompiled-artifacts --platform "${{ matrix.platform }}" --skip-preflight
288+
289+
- name: Build and verify musl precompiled gem (Alpine container)
290+
if: ${{ matrix.kind == 'musl' }}
291+
env:
292+
PLATFORM: ${{ matrix.platform }}
293+
run: |
294+
docker run --rm \
295+
-e PLATFORM="${PLATFORM}" \
296+
-v "${PWD}:/workspace" \
297+
-w /workspace \
298+
alpine:3.20 \
299+
sh -lc '
300+
set -euo pipefail
301+
apk add --no-cache bash build-base git ruby ruby-dev ruby-bundler rust cargo clang llvm-dev clang17-libclang pkgconf
302+
mkdir -p /workspace/pkg
303+
libclang_path="$(dirname "$(find /usr/lib -name libclang.so | head -n1)")"
304+
export LIBCLANG_PATH="${libclang_path}"
305+
bundle install
306+
./bin/release-precompiled-artifacts --platform "${PLATFORM}" --skip-preflight
307+
'
204308
205309
rust-scaffold:
206310
name: rust scaffold / ubuntu-latest

docs/modernization-handoff.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ Delivered:
137137
- Rust bindgen header/sysroot compatibility wiring for Windows runners
138138
- dual Rust DLL artifact-name staging support (`lda_ruby_rust.dll` and `liblda_ruby_rust.dll`)
139139
- CI jobs for packaged-gem fallback, rust-enabled checks, and manifest checks
140-
- CI precompiled gem build guardrail job (`precompiled-gem-build`)
140+
- CI precompiled gem build guardrail job (`precompiled-gem-build`) aligned to the full release-blocking precompiled matrix
141141
- release workflow matrix for precompiled gems:
142142
- `x86_64-linux`
143143
- `x86_64-linux-musl`

docs/porting-strategy.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ Completed in `codex/experiment-ruby3-modernization`:
8383
- Tag-driven release workflow added (`.github/workflows/release.yml`) with dry-run support and environment-gated publish jobs.
8484
- RubyGems credential preflight helper added (`bin/verify-rubygems-api-key`) for CI-safe publish key validation.
8585
- Post-publish verification helper added (`bin/verify-release-publish`) to validate RubyGems + GitHub release artifacts by tag.
86-
- CI precompiled guardrail job added (`precompiled-gem-build`) for Linux/macOS packaging checks.
86+
- CI precompiled guardrail job added (`precompiled-gem-build`) for full release-blocking platform packaging checks (Linux, Linux musl, macOS Intel, macOS Apple Silicon, Windows).
8787
- Release workflow post-publish verification job added (`verify_published_artifacts`).
8888
- Release failure alert workflow added (`.github/workflows/release-failure-alert.yml`) to open issue alerts for failed tag-triggered `release.yml` runs.
8989
- Maintainer release runbook added (`docs/release-runbook.md`) with publish and rollback/yank procedures.

docs/precompiled-platform-policy.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ Release automation requirements:
5555

5656
Continuous integration guardrail:
5757

58-
- `.github/workflows/ci.yml` runs `release-precompiled-artifacts` for representative Linux/macOS targets on every branch/PR.
58+
- `.github/workflows/ci.yml` runs `release-precompiled-artifacts` for the full release-blocking precompiled matrix (Linux, Linux musl, macOS Intel, macOS Apple Silicon, Windows) on every branch/PR.
5959
- `.github/workflows/precompiled-candidate-evaluation.yml` is used for additional platform candidate checks.
6060
- `.github/workflows/release.yml` dry-run validates the full release-blocking matrix before publish.
6161

0 commit comments

Comments
 (0)