Skip to content

Commit 2a47e96

Browse files
mpiannucciclaude
andcommitted
Add icechunk-js package with Node.js and WASM browser support
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent f1cad25 commit 2a47e96

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+12186
-29
lines changed

.codespellrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[codespell]
22
# Ref: https://github.com/codespell-project/codespell#using-a-config-file
3-
skip = .git*,*.svg,*.lock,*.css,.codespellrc
3+
skip = .git*,*.svg,*.lock,*lock.json,*.css,.codespellrc,icechunk-js/.yarn/releases/*
44
check-hidden = true
55
ignore-regex = ^\s*"image/\S+": ".*|\bND\b
66
ignore-words-list = crate,firs,anc

.gitattributes

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,9 @@
11
*.ipynb linguist-detectable=false
2+
3+
# Generated NAPI-RS codes
4+
icechunk-js/index.js linguist-detectable=false
5+
icechunk-js/index.d.ts linguist-detectable=false
6+
icechunk-js/icechunk.wasi-browser.js linguist-detectable=false
7+
icechunk-js/icechunk.wasi.cjs linguist-detectable=false
8+
icechunk-js/wasi-worker-browser.mjs linguist-detectable=false
9+
icechunk-js/wasi-worker.mjs linguist-detectable=false

.github/workflows/js-ci.yaml

Lines changed: 281 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,281 @@
1+
name: JS CI
2+
3+
env:
4+
DEBUG: napi:*
5+
APP_NAME: icechunk
6+
MACOSX_DEPLOYMENT_TARGET: "10.13"
7+
CARGO_INCREMENTAL: "1"
8+
9+
on:
10+
push:
11+
branches:
12+
- main
13+
- "support/**"
14+
paths:
15+
- "icechunk/**"
16+
- "icechunk-js/**"
17+
pull_request:
18+
types: [opened, synchronize, reopened, labeled]
19+
paths:
20+
- "icechunk/**"
21+
- "icechunk-js/**"
22+
workflow_dispatch:
23+
24+
concurrency:
25+
group: ${{ github.workflow }}-${{ github.ref }}
26+
cancel-in-progress: true
27+
28+
jobs:
29+
build:
30+
defaults:
31+
run:
32+
working-directory: ./icechunk-js
33+
strategy:
34+
fail-fast: false
35+
matrix:
36+
settings:
37+
- host: windows-latest
38+
build: yarn build --target x86_64-pc-windows-msvc
39+
target: x86_64-pc-windows-msvc
40+
- host: ubuntu-latest
41+
target: x86_64-unknown-linux-gnu
42+
build: yarn build --target x86_64-unknown-linux-gnu --use-napi-cross
43+
- host: macos-latest
44+
target: aarch64-apple-darwin
45+
build: yarn build --target aarch64-apple-darwin
46+
- host: ubuntu-latest
47+
target: wasm32-wasip1-threads
48+
build: yarn build --target wasm32-wasip1-threads
49+
setup: |
50+
sudo apt-get update
51+
sudo apt-get install -y --no-install-recommends clang llvm wasi-libc libc++-dev
52+
echo "CC_wasm32_wasip1_threads=clang" >> $GITHUB_ENV
53+
echo "CXX_wasm32_wasip1_threads=clang++" >> $GITHUB_ENV
54+
echo "AR_wasm32_wasip1_threads=llvm-ar" >> $GITHUB_ENV
55+
echo "CC_wasm32_wasi=clang" >> $GITHUB_ENV
56+
echo "CXX_wasm32_wasi=clang++" >> $GITHUB_ENV
57+
echo "AR_wasm32_wasi=llvm-ar" >> $GITHUB_ENV
58+
echo "WASI_SYSROOT=/usr" >> $GITHUB_ENV
59+
echo "CFLAGS_wasm32_wasip1_threads=--sysroot=/usr -isystem /usr/include/wasm32-wasi" >> $GITHUB_ENV
60+
echo "CXXFLAGS_wasm32_wasip1_threads=--sysroot=/usr -isystem /usr/include/wasm32-wasi" >> $GITHUB_ENV
61+
echo "CFLAGS_wasm32_wasi=--sysroot=/usr -isystem /usr/include/wasm32-wasi" >> $GITHUB_ENV
62+
echo "CXXFLAGS_wasm32_wasi=--sysroot=/usr -isystem /usr/include/wasm32-wasi" >> $GITHUB_ENV
63+
name: stable - ${{ matrix.settings.target }} - node@22
64+
runs-on: ${{ matrix.settings.host }}
65+
steps:
66+
- uses: actions/checkout@v6
67+
- name: Setup node
68+
uses: actions/setup-node@v6
69+
with:
70+
node-version: 24
71+
cache: yarn
72+
cache-dependency-path: icechunk-js/yarn.lock
73+
- name: Install
74+
uses: dtolnay/rust-toolchain@stable
75+
with:
76+
toolchain: stable
77+
targets: ${{ matrix.settings.target }}
78+
- name: Cache cargo
79+
uses: actions/cache@v5
80+
with:
81+
path: |
82+
~/.cargo/registry/index/
83+
~/.cargo/registry/cache/
84+
~/.cargo/git/db/
85+
~/.napi-rs
86+
.cargo-cache
87+
target/
88+
key: ${{ matrix.settings.target }}-cargo-${{ matrix.settings.host }}
89+
- uses: mlugg/setup-zig@v2
90+
if: ${{ contains(matrix.settings.target, 'musl') }}
91+
with:
92+
version: 0.14.1
93+
- name: Install cargo-zigbuild
94+
uses: taiki-e/install-action@v2
95+
if: ${{ contains(matrix.settings.target, 'musl') }}
96+
env:
97+
GITHUB_TOKEN: ${{ github.token }}
98+
with:
99+
tool: cargo-zigbuild
100+
- name: Setup toolchain
101+
run: ${{ matrix.settings.setup }}
102+
if: ${{ matrix.settings.setup }}
103+
shell: bash
104+
- name: Install dependencies
105+
run: yarn install
106+
- name: Build
107+
run: ${{ matrix.settings.build }}
108+
shell: bash
109+
- name: Upload artifact
110+
uses: actions/upload-artifact@v6
111+
with:
112+
name: bindings-${{ matrix.settings.target }}
113+
path: |
114+
icechunk-js/${{ env.APP_NAME }}.*.node
115+
icechunk-js/${{ env.APP_NAME }}.*.wasm
116+
if-no-files-found: error
117+
118+
test-macOS-windows-binding:
119+
name: Test bindings on ${{ matrix.settings.target }} - node@${{ matrix.node }}
120+
needs:
121+
- build
122+
defaults:
123+
run:
124+
working-directory: ./icechunk-js
125+
strategy:
126+
fail-fast: false
127+
matrix:
128+
settings:
129+
- host: windows-latest
130+
target: x86_64-pc-windows-msvc
131+
architecture: x64
132+
- host: macos-latest
133+
target: aarch64-apple-darwin
134+
architecture: arm64
135+
node:
136+
- "20"
137+
- "22"
138+
runs-on: ${{ matrix.settings.host }}
139+
steps:
140+
- uses: actions/checkout@v6
141+
- name: Setup node
142+
uses: actions/setup-node@v6
143+
with:
144+
node-version: ${{ matrix.node }}
145+
cache: yarn
146+
cache-dependency-path: icechunk-js/yarn.lock
147+
architecture: ${{ matrix.settings.architecture }}
148+
- name: Install dependencies
149+
run: yarn install
150+
- name: Download artifacts
151+
uses: actions/download-artifact@v7
152+
with:
153+
name: bindings-${{ matrix.settings.target }}
154+
path: ./icechunk-js
155+
- name: List packages
156+
run: ls -R .
157+
shell: bash
158+
- name: Test bindings
159+
run: yarn test
160+
161+
test-linux-binding:
162+
name: Test bindings on ${{ matrix.target }} - node@${{ matrix.node }}
163+
needs:
164+
- build
165+
defaults:
166+
run:
167+
working-directory: ./icechunk-js
168+
strategy:
169+
fail-fast: false
170+
matrix:
171+
target:
172+
- x86_64-unknown-linux-gnu
173+
node:
174+
- "20"
175+
- "22"
176+
runs-on: ubuntu-latest
177+
steps:
178+
- uses: actions/checkout@v6
179+
- name: Setup node
180+
uses: actions/setup-node@v6
181+
with:
182+
node-version: ${{ matrix.node }}
183+
cache: yarn
184+
cache-dependency-path: icechunk-js/yarn.lock
185+
- name: Install dependencies
186+
run: yarn install
187+
- name: Download artifacts
188+
uses: actions/download-artifact@v7
189+
with:
190+
name: bindings-${{ matrix.target }}
191+
path: ./icechunk-js
192+
- name: List packages
193+
run: ls -R .
194+
shell: bash
195+
- name: Test bindings
196+
run: yarn test
197+
198+
test-wasi:
199+
name: Test WASI target
200+
needs:
201+
- build
202+
runs-on: ubuntu-latest
203+
defaults:
204+
run:
205+
working-directory: ./icechunk-js
206+
steps:
207+
- uses: actions/checkout@v6
208+
- name: Setup node
209+
uses: actions/setup-node@v6
210+
with:
211+
node-version: 24
212+
cache: yarn
213+
cache-dependency-path: icechunk-js/yarn.lock
214+
- name: Install dependencies
215+
run: |
216+
yarn config set supportedArchitectures.cpu "wasm32"
217+
yarn install
218+
- name: Download artifacts
219+
uses: actions/download-artifact@v7
220+
with:
221+
name: bindings-wasm32-wasip1-threads
222+
path: ./icechunk-js
223+
- name: List packages
224+
run: ls -R .
225+
shell: bash
226+
- name: Test bindings
227+
run: yarn test
228+
env:
229+
NAPI_RS_FORCE_WASI: 1
230+
231+
publish:
232+
name: Publish
233+
if: >-
234+
github.event_name == 'workflow_dispatch' ||
235+
(github.event.action == 'labeled' && github.event.label.name == 'publish-npm')
236+
runs-on: ubuntu-latest
237+
defaults:
238+
run:
239+
working-directory: ./icechunk-js
240+
permissions:
241+
contents: write
242+
id-token: write
243+
needs:
244+
- test-macOS-windows-binding
245+
- test-linux-binding
246+
- test-wasi
247+
steps:
248+
- uses: actions/checkout@v6
249+
- name: Setup node
250+
uses: actions/setup-node@v6
251+
with:
252+
node-version: 24
253+
cache: yarn
254+
cache-dependency-path: icechunk-js/yarn.lock
255+
- name: Install dependencies
256+
run: yarn install
257+
- name: Create npm dirs
258+
run: yarn napi create-npm-dirs
259+
- name: Download all artifacts
260+
uses: actions/download-artifact@v7
261+
with:
262+
path: ./icechunk-js/artifacts
263+
- name: Move artifacts
264+
run: yarn artifacts
265+
- name: List packages
266+
run: ls -R ./npm
267+
shell: bash
268+
- name: Publish
269+
run: |
270+
npm config set provenance true
271+
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
272+
VERSION=$(node -p "require('./package.json').version")
273+
if echo "$VERSION" | grep -q "-"; then
274+
TAG=${VERSION%%-*}; TAG=${VERSION#"$TAG"-}; TAG=${TAG%%.*}
275+
npm publish --access public --tag "$TAG"
276+
else
277+
npm publish --access public
278+
fi
279+
env:
280+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
281+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

.pre-commit-config.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ repos:
33
rev: v5.0.0
44
hooks:
55
- id: trailing-whitespace
6+
exclude: 'icechunk-js/\.yarn/releases/.*'
67
- id: end-of-file-fixer
8+
exclude: 'icechunk-js/\.yarn/releases/.*'
79
- id: check-yaml
810
exclude: docs/mkdocs.yml
911
- id: debug-statements

0 commit comments

Comments
 (0)