Skip to content

Commit 2eae81a

Browse files
committed
ci: fix ci procedure
1 parent f699130 commit 2eae81a

File tree

4 files changed

+53
-10
lines changed

4 files changed

+53
-10
lines changed

.github/workflows/CI.yml

Lines changed: 47 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,11 @@ jobs:
3131
strip -x *.node
3232
- host: ubuntu-latest
3333
target: x86_64-unknown-linux-gnu
34-
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-alpine-zig
34+
docker: ghcr.io/napi-rs/napi-rs/nodejs-rust:lts-debian
3535
build: |-
3636
set -e &&
37-
rustup target add x86_64-unknown-linux-gnu &&
3837
yarn build --target x86_64-unknown-linux-gnu &&
39-
llvm-strip -x *.node
38+
strip *.node
4039
- host: macos-latest
4140
target: aarch64-apple-darwin
4241
build: |
@@ -92,7 +91,7 @@ jobs:
9291
if: ${{ matrix.settings.setup }}
9392
shell: bash
9493
- name: Install dependencies
95-
run: yarn install --ignore-scripts --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
94+
run: yarn install
9695
- name: Build in docker
9796
uses: addnab/docker-run-action@v3
9897
if: ${{ matrix.settings.docker }}
@@ -136,7 +135,7 @@ jobs:
136135
path: node_modules
137136
key: npm-cache-test-linux-x64-gnu-${{ matrix.node }}-${{ hashFiles('yarn.lock') }}
138137
- name: Install dependencies
139-
run: yarn install --ignore-scripts --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
138+
run: yarn install
140139
- name: Download artifacts
141140
uses: actions/download-artifact@v3
142141
with:
@@ -146,12 +145,53 @@ jobs:
146145
run: ls -R .
147146
shell: bash
148147
- name: Test bindings
149-
run: docker run --rm -v $(pwd):/build -w /build node:${{ matrix.node }}-slim yarn test
148+
run: docker run --rm -v $(pwd):/build -w /build node:${{ matrix.node }}-slim
149+
test-macOS-binding:
150+
name: Test bindings on ${{ matrix.settings.target }} - node@${{ matrix.node }}
151+
needs:
152+
- build
153+
strategy:
154+
fail-fast: false
155+
matrix:
156+
settings:
157+
- host: macos-latest
158+
target: x86_64-apple-darwin
159+
node:
160+
- '14'
161+
- '16'
162+
- '18'
163+
runs-on: ${{ matrix.settings.host }}
164+
steps:
165+
- uses: actions/checkout@v3
166+
- name: Setup node
167+
uses: actions/setup-node@v3
168+
with:
169+
node-version: ${{ matrix.node }}
170+
check-latest: true
171+
cache: yarn
172+
- name: Cache NPM dependencies
173+
uses: actions/cache@v3
174+
with:
175+
path: .yarn/cache
176+
key: npm-cache-test-${{ matrix.settings.target }}-${{ matrix.node }}-${{ hashFiles('yarn.lock') }}
177+
- name: Install dependencies
178+
run: yarn install
179+
- name: Download artifacts
180+
uses: actions/download-artifact@v3
181+
with:
182+
name: bindings-${{ matrix.settings.target }}
183+
path: .
184+
- name: List packages
185+
run: ls -R .
186+
shell: bash
187+
- name: Test bindings
188+
run: yarn test
150189
publish:
151190
name: Publish
152191
runs-on: ubuntu-latest
153192
needs:
154193
- test-linux-x64-gnu-binding
194+
- test-macOS-binding
155195
steps:
156196
- uses: actions/checkout@v3
157197
- name: Setup node
@@ -168,7 +208,7 @@ jobs:
168208
restore-keys: |
169209
npm-cache-
170210
- name: Install dependencies
171-
run: yarn install --ignore-scripts --frozen-lockfile --registry https://registry.npmjs.org --network-timeout 300000
211+
run: yarn install
172212
- name: Download all artifacts
173213
uses: actions/download-artifact@v3
174214
with:

js/addon.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const { existsSync, readFileSync } = require('fs')
1+
const { existsSync, readFileSync, statSync } = require('fs')
22
const { join } = require('path')
33

44
const { platform, arch } = process
@@ -164,7 +164,7 @@ switch (platform) {
164164
loadError = e
165165
}
166166
} else {
167-
localFileExisted = existsSync(
167+
localFileExisted = statSync(
168168
join(__dirname, '../node-unix-socket.linux-x64-gnu.node')
169169
)
170170
try {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"check_mem": "node --max-old-space-size=128 scripts/dgram_memory.js",
1717
"doc": "typedoc --excludePrivate --excludeInternal --excludeExternals --plugin typedoc-plugin-markdown js/index.ts",
1818
"prepublishOnly": "napi pre`publish -t npm",
19-
"test": "jest --testRegex '__test__/(.+).spec.ts' --runInBand",
19+
"test": "ls && pwd && node test2.js && jest --testRegex '__test__/(.+).spec.ts' --runInBand --silent=false",
2020
"test:dumb": "TERM=dumb npm run test",
2121
"version": "napi version"
2222
},

test2.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
var mod = require('./js')
2+
3+
console.log(mod);

0 commit comments

Comments
 (0)