Skip to content

Commit 601f2f2

Browse files
committed
fix(ci): run node workflow from crates/node directory
The node CI was failing because it expected a Yarn workspace at the repository root. Updated the workflow to use working-directory: crates/node for all yarn/npm commands and added cache-dependency-path for proper caching.
1 parent 2b87fc6 commit 601f2f2

1 file changed

Lines changed: 44 additions & 26 deletions

File tree

.github/workflows/node.yml

Lines changed: 44 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -51,40 +51,40 @@ jobs:
5151
settings:
5252
- host: macos-latest
5353
target: x86_64-apple-darwin
54-
build: yarn workspace @odict/node build:node --target x86_64-apple-darwin
54+
build: yarn build:node --target x86_64-apple-darwin
5555
- host: windows-latest
56-
build: yarn workspace @odict/node build:node --target x86_64-pc-windows-msvc
56+
build: yarn build:node --target x86_64-pc-windows-msvc
5757
target: x86_64-pc-windows-msvc
5858
- host: windows-latest
59-
build: yarn workspace @odict/node build:node --target i686-pc-windows-msvc
59+
build: yarn build:node --target i686-pc-windows-msvc
6060
target: i686-pc-windows-msvc
6161
- host: ubuntu-latest
6262
target: x86_64-unknown-linux-gnu
63-
build: yarn workspace @odict/node build:node --target x86_64-unknown-linux-gnu --use-napi-cross
63+
build: yarn build:node --target x86_64-unknown-linux-gnu --use-napi-cross
6464
- host: ubuntu-latest
6565
target: x86_64-unknown-linux-musl
66-
build: yarn workspace @odict/node build:node --target x86_64-unknown-linux-musl -x
66+
build: yarn build:node --target x86_64-unknown-linux-musl -x
6767
- host: macos-latest
6868
target: aarch64-apple-darwin
69-
build: yarn workspace @odict/node build:node --target aarch64-apple-darwin
69+
build: yarn build:node --target aarch64-apple-darwin
7070
- host: ubuntu-latest
7171
target: aarch64-unknown-linux-gnu
72-
build: yarn workspace @odict/node build:node --target aarch64-unknown-linux-gnu --use-napi-cross
72+
build: yarn build:node --target aarch64-unknown-linux-gnu --use-napi-cross
7373
- host: ubuntu-latest
7474
target: armv7-unknown-linux-gnueabihf
75-
build: yarn workspace @odict/node build:node --target armv7-unknown-linux-gnueabihf --use-napi-cross
75+
build: yarn build:node --target armv7-unknown-linux-gnueabihf --use-napi-cross
7676
- host: ubuntu-latest
7777
target: aarch64-linux-android
78-
build: yarn workspace @odict/node build:node --target aarch64-linux-android
78+
build: yarn build:node --target aarch64-linux-android
7979
- host: ubuntu-latest
8080
target: armv7-linux-androideabi
81-
build: yarn workspace @odict/node build:node --target armv7-linux-androideabi
81+
build: yarn build:node --target armv7-linux-androideabi
8282
- host: ubuntu-latest
8383
target: aarch64-unknown-linux-musl
84-
build: yarn workspace @odict/node build:node --target aarch64-unknown-linux-musl -x
84+
build: yarn build:node --target aarch64-unknown-linux-musl -x
8585
- host: windows-latest
8686
target: aarch64-pc-windows-msvc
87-
build: yarn workspace @odict/node build:node --target aarch64-pc-windows-msvc
87+
build: yarn build:node --target aarch64-pc-windows-msvc
8888
- host: macos-latest
8989
target: wasm32-wasip1-threads
9090
setup: |
@@ -93,7 +93,7 @@ jobs:
9393
build: |
9494
export WASI_SDK_PATH="$(pwd)/wasi-sdk-22.0"
9595
export CMAKE_BUILD_PARALLEL_LEVEL=2
96-
yarn workspace @odict/node build:wasm
96+
yarn build:wasm
9797
name: stable - ${{ matrix.settings.target }} - node@22
9898
runs-on: ${{ matrix.settings.host }}
9999
steps:
@@ -103,6 +103,7 @@ jobs:
103103
with:
104104
node-version: 22
105105
cache: yarn
106+
cache-dependency-path: crates/node/yarn.lock
106107
- name: Install
107108
uses: dtolnay/rust-toolchain@stable
108109
with:
@@ -135,10 +136,12 @@ jobs:
135136
if: ${{ matrix.settings.setup }}
136137
shell: bash
137138
- name: Install dependencies
139+
working-directory: crates/node
138140
run: yarn install
139141
- name: Build
140142
env:
141143
CFLAGS_aarch64_unknown_linux_gnu: ${{ matrix.settings.target == 'aarch64-unknown-linux-gnu' && '-D__ARM_ARCH=8' || '' }}
144+
working-directory: crates/node
142145
run: ${{ matrix.settings.build }}
143146
shell: bash
144147
- name: Upload artifact
@@ -185,8 +188,9 @@ jobs:
185188
env
186189
freebsd-version
187190
sudo corepack enable
191+
cd crates/node
188192
yarn install
189-
yarn workspace @odict/node build:node
193+
yarn build:node
190194
rm -rf node_modules
191195
rm -rf target
192196
rm -rf .yarn/cache
@@ -227,19 +231,22 @@ jobs:
227231
with:
228232
node-version: ${{ matrix.node }}
229233
cache: yarn
234+
cache-dependency-path: crates/node/yarn.lock
230235
architecture: ${{ matrix.settings.architecture }}
231236
- name: Install dependencies
237+
working-directory: crates/node
232238
run: yarn install
233239
- name: Download artifacts
234240
uses: actions/download-artifact@v5
235241
with:
236242
name: bindings-${{ matrix.settings.target }}
237-
path: ./node
243+
path: ./crates/node
238244
- name: List packages
239245
run: ls -R .
240246
shell: bash
241247
- name: Test bindings
242-
run: yarn workspace @odict/node test
248+
working-directory: crates/node
249+
run: yarn test
243250
test-linux-binding:
244251
name: Test ${{ matrix.target }} - node@${{ matrix.node }}
245252
needs:
@@ -264,6 +271,7 @@ jobs:
264271
with:
265272
node-version: ${{ matrix.node }}
266273
cache: yarn
274+
cache-dependency-path: crates/node/yarn.lock
267275
- name: Output docker params
268276
id: docker
269277
run: |
@@ -284,6 +292,7 @@ jobs:
284292
}
285293
" >> $GITHUB_OUTPUT
286294
- name: Install dependencies
295+
working-directory: crates/node
287296
run: |
288297
yarn config set --json supportedArchitectures.cpu '["current", "arm64", "x64", "arm"]'
289298
yarn config set --json supportedArchitectures.libc '["current", "musl", "gnu"]'
@@ -292,7 +301,7 @@ jobs:
292301
uses: actions/download-artifact@v5
293302
with:
294303
name: bindings-${{ matrix.target }}
295-
path: ./node
304+
path: ./crates/node
296305
- name: List packages
297306
run: ls -R .
298307
shell: bash
@@ -307,8 +316,8 @@ jobs:
307316
uses: addnab/docker-run-action@v3
308317
with:
309318
image: ${{ steps.docker.outputs.IMAGE }}
310-
options: "-v ${{ github.workspace }}:${{ github.workspace }} -w ${{ github.workspace }} --platform ${{ steps.docker.outputs.PLATFORM }}"
311-
run: yarn workspace @odict/node test
319+
options: "-v ${{ github.workspace }}:${{ github.workspace }} -w ${{ github.workspace }}/crates/node --platform ${{ steps.docker.outputs.PLATFORM }}"
320+
run: yarn test
312321
test-wasi:
313322
name: Test WASI target
314323
needs:
@@ -321,20 +330,23 @@ jobs:
321330
with:
322331
node-version: 22
323332
cache: yarn
333+
cache-dependency-path: crates/node/yarn.lock
324334
- name: Install dependencies
335+
working-directory: crates/node
325336
run: |
326337
yarn config set supportedArchitectures.cpu "wasm32"
327338
yarn install
328339
- name: Download artifacts
329340
uses: actions/download-artifact@v5
330341
with:
331342
name: bindings-wasm32-wasip1-threads
332-
path: ./node
343+
path: ./crates/node
333344
- name: List packages
334345
run: ls -R .
335346
shell: bash
336347
- name: Test bindings
337-
run: yarn workspace @odict/node test
348+
working-directory: crates/node
349+
run: yarn test
338350
env:
339351
NAPI_RS_FORCE_WASI: 1
340352
publish:
@@ -356,31 +368,36 @@ jobs:
356368
with:
357369
node-version: 22
358370
cache: yarn
371+
cache-dependency-path: crates/node/yarn.lock
359372
- name: Install dependencies
373+
working-directory: crates/node
360374
run: yarn install
361375
- name: create npm dirs
362-
run: yarn workspace @odict/node napi create-npm-dirs
376+
working-directory: crates/node
377+
run: yarn create-dirs
363378
- name: Download all artifacts
364379
uses: actions/download-artifact@v5
365380
with:
366381
path: ./crates/node/artifacts
367382
- name: Move artifacts
368-
run: yarn workspace @odict/node artifacts
383+
working-directory: crates/node
384+
run: yarn artifacts
369385
- name: List packages
370386
run: ls -R ./crates/node/npm
371387
shell: bash
372388
- name: Publish
373389
if: ${{ github.event_name != 'workflow_dispatch' }}
390+
working-directory: crates/node
374391
run: |
375392
npm config set provenance true
376393
if git log -1 --pretty=%B | grep "^[0-9]\+\.[0-9]\+\.[0-9]\+$";
377394
then
378395
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
379-
cd node && npm publish --access public
396+
npm publish --access public
380397
elif git log -1 --pretty=%B | grep "^[0-9]\+\.[0-9]\+\.[0-9]\+";
381398
then
382399
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
383-
cd node && npm publish --tag next --access public
400+
npm publish --tag next --access public
384401
else
385402
echo "Not a release, skipping publish"
386403
fi
@@ -390,10 +407,11 @@ jobs:
390407
- name: Publish
391408
shell: bash
392409
if: ${{ github.event_name == 'workflow_dispatch' }}
410+
working-directory: crates/node
393411
run: |
394412
npm config set provenance true
395413
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc
396-
cd node && npm publish --no-git-checks --access public
414+
npm publish --no-git-checks --access public
397415
env:
398416
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
399417
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)