Skip to content

Commit 736e68b

Browse files
feat: support more platforms (Windows, Linux, Intel Mac)
1 parent f05429f commit 736e68b

File tree

3 files changed

+38
-107
lines changed

3 files changed

+38
-107
lines changed

.github/workflows/CI.yml

Lines changed: 29 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,26 @@ on:
1313
pull_request:
1414

1515
jobs:
16+
# Builds native Node.js bindings for each target platform using napi-rs.
17+
# The build artifacts are uploaded and used by the test job.
1618
build:
1719
name: Build - ${{ matrix.target }}
1820
if: "!contains(github.event.head_commit.message, 'skip ci')"
1921
strategy:
2022
fail-fast: false
2123
matrix:
22-
target: [aarch64-apple-darwin, x86_64-unknown-linux-gnu]
24+
target: [aarch64-apple-darwin, x86_64-apple-darwin, x86_64-unknown-linux-gnu, aarch64-unknown-linux-gnu, x86_64-pc-windows-msvc]
2325
include:
2426
- target: aarch64-apple-darwin
2527
os: macos-latest
28+
- target: x86_64-apple-darwin
29+
os: macos-latest
2630
- target: x86_64-unknown-linux-gnu
2731
os: ubuntu-latest
32+
- target: aarch64-unknown-linux-gnu
33+
os: ubuntu-latest
34+
- target: x86_64-pc-windows-msvc
35+
os: windows-latest
2836
runs-on: ${{ matrix.os }}
2937

3038
steps:
@@ -80,19 +88,27 @@ jobs:
8088
if-no-files-found: error
8189
retention-days: 1
8290

91+
# Downloads the built native modules and runs the test suite on each platform
92+
# to ensure the bindings work correctly across different architectures.
8393
test:
8494
name: Test - ${{ matrix.target }}
8595
needs:
8696
- build
8797
strategy:
8898
fail-fast: false
8999
matrix:
90-
target: [aarch64-apple-darwin, x86_64-unknown-linux-gnu]
100+
target: [aarch64-apple-darwin, x86_64-apple-darwin, x86_64-unknown-linux-gnu, aarch64-unknown-linux-gnu, x86_64-pc-windows-msvc]
91101
include:
92102
- target: aarch64-apple-darwin
93103
os: macos-latest
104+
- target: x86_64-apple-darwin
105+
os: macos-latest
94106
- target: x86_64-unknown-linux-gnu
95107
os: ubuntu-latest
108+
- target: aarch64-unknown-linux-gnu
109+
os: ubuntu-latest
110+
- target: x86_64-pc-windows-msvc
111+
os: windows-latest
96112
runs-on: ${{ matrix.os }}
97113

98114
steps:
@@ -118,70 +134,12 @@ jobs:
118134
- name: Test
119135
run: npm test
120136

121-
dry-run-publish:
122-
name: Dry Run Publish
123-
runs-on: ubuntu-latest
124-
if: github.event_name == 'pull_request'
125-
needs:
126-
- build
127-
- test
128-
steps:
129-
- uses: actions/checkout@v4
130-
with:
131-
submodules: recursive
132-
fetch-depth: 0
133-
134-
- name: Setup node
135-
uses: actions/setup-node@v4
136-
with:
137-
node-version: 18
138-
check-latest: true
139-
cache: npm
140-
141-
- name: Cache NPM dependencies
142-
uses: actions/cache@v4
143-
with:
144-
path: node_modules
145-
key: npm-cache-ubuntu-latest-${{ hashFiles('package-lock.json') }}
146-
147-
- name: Install dependencies
148-
run: npm ci
149-
150-
- name: Download artifact
151-
uses: actions/download-artifact@v4
152-
with:
153-
name: bindings-aarch64-apple-darwin
154-
155-
- name: Move artifacts
156-
run: |
157-
mkdir -p dist
158-
find . -type f -name 'cel-typescript.*.node' -exec mv {} . \;
159-
160-
- name: List files
161-
run: |
162-
echo "Root directory:"
163-
ls -la
164-
echo "\nNode files:"
165-
find . -maxdepth 1 -name '*.node'
166-
shell: bash
167-
168-
- name: Link local package
169-
run: npm link
170-
171-
- name: Build TypeScript
172-
run: npm run build:ts
173-
174-
- name: Verify package contents
175-
run: |
176-
echo "Package contents:"
177-
npm pack --dry-run
178-
137+
# Publishes the package to npm when a tag is pushed, or performs a dry-run during PRs.
179138
publish:
180139
name: ${{ github.event_name == 'pull_request' && '🔍 Publish (Dry Run)' || '📦 Publish' }}
181140
runs-on: ubuntu-latest
182141
permissions:
183142
contents: read
184-
id-token: write
185143
if: startsWith(github.ref, 'refs/tags/v') || github.event_name == 'pull_request'
186144
needs:
187145
- build
@@ -193,50 +151,21 @@ jobs:
193151
submodules: recursive
194152
fetch-depth: 0
195153

196-
- name: Debug - List submodules
197-
run: |
198-
git submodule status
199-
ls -la
200-
ls -la cel-rust/
201-
ls -la cel-rust/interpreter/
202-
shell: bash
203-
204154
- name: Setup node
205155
uses: actions/setup-node@v4
206156
with:
207157
node-version: 18
208-
check-latest: true
209158
cache: npm
210-
211-
- name: Cache NPM dependencies
212-
uses: actions/cache@v4
213-
with:
214-
path: node_modules
215-
key: npm-cache-ubuntu-latest-${{ hashFiles('package-lock.json') }}
159+
registry-url: 'https://registry.npmjs.org'
216160

217161
- name: Install dependencies
218-
run: npm ci
162+
run: npm install
219163

220-
- name: Download artifact
164+
- name: Download all artifacts
221165
uses: actions/download-artifact@v4
222166
with:
223-
name: bindings-aarch64-apple-darwin
224-
225-
- name: Move artifacts
226-
run: |
227-
mkdir -p dist
228-
find . -type f -name 'cel-typescript.*.node' -exec mv {} . \;
229-
230-
- name: List files
231-
run: |
232-
echo "Root directory:"
233-
ls -la
234-
echo "\nNode files:"
235-
find . -maxdepth 1 -name '*.node'
236-
shell: bash
237-
238-
- name: Link local package
239-
run: npm link
167+
pattern: bindings-*
168+
merge-multiple: true
240169

241170
- name: Build TypeScript
242171
run: npm run build:ts
@@ -246,17 +175,12 @@ jobs:
246175
echo "Package contents:"
247176
npm pack --dry-run
248177
249-
- name: ⚙️ Configure npm
250-
if: github.event_name != 'pull_request'
251-
run: |
252-
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
253-
254-
- name: 🚀 Publish
255-
if: github.event_name != 'pull_request' && env.NPM_TOKEN != ''
178+
- name: Publish
179+
if: startsWith(github.ref, 'refs/tags/v')
180+
run: npm publish --provenance --access public
256181
env:
257-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
258-
run: npm publish --access public --provenance
182+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
259183

260-
- name: 🔍 Dry Run Publish
184+
- name: Publish (Dry Run)
261185
if: github.event_name == 'pull_request'
262186
run: npm publish --dry-run

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ npm install @kevinmichaelchen/cel-typescript
2424

2525
- Node.js 18 or later
2626

27-
This package currently only includes pre-compiled native binaries for Apple Silicon (M1/M2/M3) Macs. Support for other platforms (Intel Macs, Linux, Windows) is planned for future releases and will be available behind a feature flag.
27+
This package includes pre-compiled native binaries for the following platforms:
28+
- macOS (Apple Silicon and Intel)
29+
- Linux (x86_64 and ARM64)
30+
- Windows (x86_64)
2831

2932
The appropriate binary for your platform will be automatically loaded at
3033
runtime.

package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,11 @@
4646
"triples": {
4747
"defaults": false,
4848
"additional": [
49-
"aarch64-apple-darwin"
49+
"aarch64-apple-darwin",
50+
"x86_64-apple-darwin",
51+
"x86_64-unknown-linux-gnu",
52+
"aarch64-unknown-linux-gnu",
53+
"x86_64-pc-windows-msvc"
5054
]
5155
}
5256
},

0 commit comments

Comments
 (0)