Skip to content

Commit efe4968

Browse files
committed
Prepare for v6
1 parent cf4269a commit efe4968

File tree

6 files changed

+529
-387
lines changed

6 files changed

+529
-387
lines changed

.github/workflows/build-pack-publish.yml

Lines changed: 68 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -10,61 +10,89 @@ on:
1010

1111
jobs:
1212

13-
build:
14-
runs-on: ubuntu-22.04
15-
strategy:
16-
matrix:
17-
os: [linux]
18-
arch: [amd64, arm64, arm]
13+
build-linux:
14+
runs-on: ubuntu-latest
1915
steps:
2016
- uses: actions/checkout@v4
21-
- uses: docker/setup-qemu-action@v3
17+
# This is unsafe, but we really don't use any other native dependencies
18+
- run: npm ci
19+
- run: docker run -u $(id -u):$(id -g) -v `pwd`:/input -w /input ghcr.io/prebuild/almalinux-devtoolset11 npx prebuildify --napi --tag-libc --strip
20+
- run: docker run -u $(id -u):$(id -g) -v `pwd`:/input -w /input ghcr.io/prebuild/alpine npx prebuildify --napi --tag-libc --strip
21+
- run: docker run -u $(id -u):$(id -g) -v `pwd`:/input -w /input ghcr.io/prebuild/linux-armv7 npx prebuildify --napi --tag-libc --strip
22+
- run: docker run -u $(id -u):$(id -g) -v `pwd`:/input -w /input ghcr.io/prebuild/linux-armv7l-musl npx prebuildify --napi --tag-libc --strip
23+
- run: docker run -u $(id -u):$(id -g) -v `pwd`:/input -w /input ghcr.io/prebuild/linux-arm64 npx prebuildify --napi --tag-libc --strip
24+
- run: docker run -u $(id -u):$(id -g) -v `pwd`:/input -w /input ghcr.io/prebuild/linux-arm64-musl npx prebuildify --napi --tag-libc --strip
25+
- run: find prebuilds
26+
- uses: actions/upload-artifact@v4
2227
with:
23-
image: tonistiigi/binfmt:latest
24-
platforms: arm,arm64
28+
name: prebuild-linux
29+
path: ./prebuilds/
2530

26-
- run: >
27-
docker build .
28-
--build-arg TEST_TIMEOUT_SECONDS=30
29-
--tag node-bcrypt-builder
30-
--platform ${{ matrix.os }}/${{ matrix.arch }}
31-
- run: >
32-
docker create
33-
--name node-bcryptjs-builder
34-
--platform ${{ matrix.os }}/${{ matrix.arch }}
35-
node-bcrypt-builder
36-
- run: docker cp "node-bcryptjs-builder:/usr/local/opt/bcrypt-js/prebuilds" .
31+
build-windows:
32+
runs-on: windows-latest
33+
steps:
34+
- uses: actions/checkout@v4
35+
- uses: actions/setup-node@v4
36+
with:
37+
node-version: 18
38+
registry-url: 'https://registry.npmjs.org'
39+
- run: npm ci
40+
- run: npx prebuildify --napi --strip --arch=ia32
41+
- run: npx prebuildify --napi --strip --arch=x64
42+
- run: dir prebuilds
43+
- uses: actions/upload-artifact@v4
44+
with:
45+
name: prebuild-windows
46+
path: ./prebuilds/
3747

38-
# build for Alpine:
39-
- run: >
40-
docker build -f Dockerfile-alpine .
41-
--build-arg TEST_TIMEOUT_SECONDS=30
42-
--tag node-bcrypt-builder-alpine
43-
--platform ${{ matrix.os }}/${{ matrix.arch }}
44-
- run: >
45-
docker create
46-
--name node-bcryptjs-builder-alpine
47-
--platform ${{ matrix.os }}/${{ matrix.arch }}
48-
node-bcrypt-builder-alpine
49-
- run: docker cp "node-bcryptjs-builder-alpine:/usr/local/opt/bcrypt-js/prebuilds" .
48+
build-windows-arm:
49+
runs-on: windows-latest
50+
steps:
51+
- uses: actions/checkout@v4
52+
- uses: actions/setup-node@v4
53+
with:
54+
node-version: 20
55+
registry-url: 'https://registry.npmjs.org'
56+
- run: npm ci
57+
- run: npx prebuildify --napi --strip --arch=arm64
58+
- run: dir prebuilds
59+
- uses: actions/upload-artifact@v4
60+
with:
61+
name: prebuild-windows-arm
62+
path: ./prebuilds/
5063

64+
build-macos:
65+
runs-on: macos-latest
66+
steps:
67+
- uses: actions/checkout@v4
68+
- uses: actions/setup-node@v4
69+
with:
70+
node-version: 18
71+
registry-url: 'https://registry.npmjs.org'
72+
- run: npm ci
73+
- run: npx prebuildify --napi --strip --arch=arm64
74+
- run: npx prebuildify --napi --strip --arch=x64
5175
- run: find prebuilds
52-
- uses: actions/upload-artifact@v3
76+
- uses: actions/upload-artifact@v4
5377
with:
54-
name: prebuild-${{ matrix.os }}-${{ matrix.arch }}
55-
path: ./prebuilds
78+
name: prebuild-macos
79+
path: ./prebuilds/
5680

5781
pack:
58-
needs: build
59-
runs-on: ubuntu-22.04
82+
needs:
83+
- build-linux
84+
- build-windows
85+
- build-windows-arm
86+
- build-macos
87+
runs-on: ubuntu-latest
6088
steps:
6189
- uses: actions/checkout@v4
62-
- uses: actions/setup-node@v3
90+
- uses: actions/setup-node@v4
6391
with:
6492
node-version: 20
6593
registry-url: 'https://registry.npmjs.org'
6694
- run: npm ci
67-
- uses: actions/download-artifact@v2
95+
- uses: actions/download-artifact@v4
6896
with:
6997
path: /tmp/prebuilds/
7098
- name: Coalesce prebuilds from build matrix
@@ -75,50 +103,7 @@ jobs:
75103
done
76104
- run: chmod a+x prebuilds/*/*.node && find prebuilds -executable -type f
77105
- run: echo "PACK_FILE=$(npm pack)" >> $GITHUB_ENV
78-
- uses: actions/upload-artifact@v3
106+
- uses: actions/upload-artifact@v4
79107
with:
80108
name: package-tgz
81109
path: ${{ env.PACK_FILE }}
82-
83-
publish-npm:
84-
needs: pack
85-
if: github.event_name == 'release'
86-
runs-on: ubuntu-22.04
87-
steps:
88-
- uses: actions/checkout@v4
89-
- uses: actions/setup-node@v3
90-
with:
91-
node-version: 20
92-
registry-url: 'https://registry.npmjs.org'
93-
- uses: actions/download-artifact@v2
94-
with:
95-
name: package-tgz
96-
path: /tmp/package/
97-
- run: npm publish /tmp/package/bcrypt*.tgz
98-
env:
99-
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
100-
101-
publish-gpr:
102-
needs: pack
103-
if: github.event_name == 'release'
104-
runs-on: ubuntu-22.04
105-
permissions:
106-
contents: read
107-
packages: write
108-
steps:
109-
- uses: actions/checkout@v4
110-
- uses: actions/setup-node@v3
111-
with:
112-
node-version: 20
113-
registry-url: https://npm.pkg.github.com/
114-
- uses: actions/download-artifact@v2
115-
with:
116-
name: package-tgz
117-
path: /tmp/package/
118-
- run: npm publish /tmp/package/bcrypt*.tgz
119-
env:
120-
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
121-
122-
123-
124-

.github/workflows/ci.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,25 @@ on:
1010

1111
jobs:
1212
build:
13-
runs-on: ubuntu-22.04
13+
runs-on: ubuntu-latest
1414
strategy:
1515
matrix:
16-
node-version: [18, 20]
16+
node-version: [18, 20, 22]
1717
steps:
1818
- uses: actions/checkout@v4
1919
- name: Use Node.js ${{ matrix.node-version }}
20-
uses: actions/setup-node@v3
20+
uses: actions/setup-node@v4
2121
with:
2222
node-version: ${{ matrix.node-version }}
2323
- run: npm ci
2424
- name: Test
2525
run: npm test
2626

2727
build-alpine:
28-
runs-on: ubuntu-22.04
28+
runs-on: ubuntu-latest
2929
strategy:
3030
matrix:
31-
node-version: [18, 20]
31+
node-version: [18, 20, 22]
3232
container:
3333
image: node:${{ matrix.node-version }}-alpine
3434
steps:

binding.gyp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,9 @@
1515
],
1616
'cflags!': [ '-fno-exceptions' ],
1717
'cflags_cc!': [ '-fno-exceptions' ],
18-
'include_dirs' : [
19-
"<!@(node -p \"require('node-addon-api').include\")"
18+
'dependencies': [
19+
"<!(node -p \"require('node-addon-api').targets\"):node_addon_api_except",
2020
],
21-
'dependencies': ["<!(node -p \"require('node-addon-api').gyp\")"],
2221
'conditions': [
2322
['OS=="win"', {
2423
"msvs_settings": {

examples/async_compare.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ var bcrypt = require('../bcrypt');
99
console.log('salt cb end: ' + (Date.now() - start) + 'ms');
1010

1111
// hash
12-
const crypted = await bcrypt.hash('test', salt)
12+
const crypted = await bcrypt.hash('test', salt)
1313
console.log('crypted: ' + crypted);
1414
console.log('crypted cb end: ' + (Date.now() - start) + 'ms');
1515
console.log('rounds used from hash:', bcrypt.getRounds(crypted));

0 commit comments

Comments
 (0)