-
Notifications
You must be signed in to change notification settings - Fork 0
139 lines (128 loc) · 4.93 KB
/
Copy pathprebuild.yml
File metadata and controls
139 lines (128 loc) · 4.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# Formulon N-API addon prebuild matrix.
#
# Builds packages/npm-native's `formulon.node` for each supported
# platform-arch slot and uploads the artifact under the same naming
# convention the package's `index.mjs` looks for at require-time
# (`dist/prebuilds/<platform>-<arch>/formulon.node`).
#
# Coverage:
# - darwin-arm64 (macos-14)
# - linux-x64 (ubuntu-latest)
# - linux-arm64 (ubuntu-24.04-arm)
#
# darwin-x64 (Intel Mac) is intentionally NOT in the matrix. GitHub's
# `macos-13` (Ventura, Intel) runner pool is effectively exhausted on
# the free tier, so the slot routinely queues for over an hour. The
# release.yml CLI / Python-wheel matrices already ship only darwin-arm64
# for macOS; keeping the prebuild matrix consistent removes the stuck
# slot without losing real coverage (every supported macOS user is on
# Apple Silicon).
#
# Windows is intentionally NOT in the matrix yet. The engine compiles
# with `-fno-exceptions -fno-rtti -fvisibility=hidden` (GCC/Clang
# spelling). Adding MSVC support requires plumbing the equivalent
# `/EHs-c- /GR-` flags engine-wide, which is its own work item.
#
# Triggers:
# - PR to main : matrix verifies each platform still builds
# and `make node-test` smokes pass.
# - push to main : same, plus refreshed artifacts available
# via the actions UI for download.
# - push tag `v*` : matrix runs, then `release-bundle` aggregates
# all four `.node` files plus the JS shim and
# types into a single `formulon-native-bundle`
# artifact for npm publish staging.
#
# Per CLAUDE.md "CI vs. local development": this workflow produces
# *artifacts*, not gates. A failed prebuild does NOT block a merge;
# it's a signal that the platform regressed. The hard gate (build
# pass/fail, ctest pass/fail, .wasm ceiling, TSan races) lives in
# ci.yml.
name: prebuild
on:
push:
branches: [main]
tags: ['v*']
pull_request:
branches: [main]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
prebuild:
name: Prebuild ${{ matrix.platform-arch }}
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
- platform-arch: darwin-arm64
runner: macos-14
- platform-arch: linux-x64
runner: ubuntu-latest
- platform-arch: linux-arm64
runner: ubuntu-24.04-arm
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Set up Node.js
uses: actions/setup-node@v6
with:
# Node >=21 is required so `node --test 'test/*.test.mjs'`
# expands the glob; Node 20 looks for the literal path.
node-version: 22
- name: Install build deps (Linux)
if: startsWith(matrix.platform-arch, 'linux-')
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
build-essential cmake
- name: Build, stage, and smoke-test addon
# `make node-test` drives the full chain:
# node-native -> cmake configure + build formulon_node
# node-package -> stage into dist/prebuilds/<platform-arch>/
# node-test -> node:test smoke against the staged package.
run: make node-test
- name: Upload addon artifact
uses: actions/upload-artifact@v7
with:
name: formulon-${{ matrix.platform-arch }}
path: packages/npm-native/dist/prebuilds/${{ matrix.platform-arch }}/formulon.node
retention-days: 30
if-no-files-found: error
release-bundle:
name: Bundle prebuilds for release
needs: prebuild
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Download all prebuild artifacts
uses: actions/download-artifact@v8
with:
path: prebuilds-tmp
pattern: formulon-*
- name: Stage every prebuild slot into dist/
run: |
set -euo pipefail
for dir in prebuilds-tmp/*/; do
tag=$(basename "$dir" | sed 's/^formulon-//')
slot="packages/npm-native/dist/prebuilds/$tag"
mkdir -p "$slot"
cp "$dir/formulon.node" "$slot/formulon.node"
echo " staged $tag"
done
# JS shim + types are pure source; no build artefacts needed.
cp packages/npm-native/index.mjs packages/npm-native/dist/
cp packages/npm-native/index.d.ts packages/npm-native/dist/
ls -la packages/npm-native/dist/
find packages/npm-native/dist -type f
- name: Upload bundled npm tree
uses: actions/upload-artifact@v7
with:
name: formulon-native-bundle
path: packages/npm-native/dist/
retention-days: 30
if-no-files-found: error