Skip to content

Commit 7e93b78

Browse files
committed
Test package
1 parent 8fc0cea commit 7e93b78

File tree

3 files changed

+29
-5
lines changed

3 files changed

+29
-5
lines changed

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

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ jobs:
6767
- build-windows
6868
- build-macos
6969
runs-on: ubuntu-latest
70+
outputs:
71+
PACK_FILE: ${{ steps.pack.outputs.PACK_FILE }}
7072
steps:
7173
- uses: actions/checkout@v4
7274
- uses: actions/download-artifact@v4
@@ -79,8 +81,30 @@ jobs:
7981
cp -Rav $d/* prebuilds/
8082
done
8183
- run: chmod a+x prebuilds/*/*.node && find prebuilds -executable -type f
82-
- run: echo "PACK_FILE=$(npm pack)" >> $GITHUB_ENV
84+
- id: pack
85+
name: Prepare NPM package
86+
run: |
87+
echo "PACK_FILE=$(npm pack)" >> "$GITHUB_OUTPUT"
8388
- uses: actions/upload-artifact@v4
8489
with:
8590
name: package-tgz
86-
path: ${{ env.PACK_FILE }}
91+
path: ${{ steps.pack.outputs.PACK_FILE }}
92+
if-no-files-found: 'error'
93+
94+
test-package:
95+
needs: pack
96+
strategy:
97+
matrix:
98+
node-version: [ 18, 20, 22, 23 ]
99+
os: [ ubuntu-latest, windows-latest, macos-latest ]
100+
runs-on: ${{ matrix.os }}
101+
steps:
102+
- uses: actions/setup-node@v4
103+
with:
104+
node-version: ${{ matrix.node-version }}
105+
registry-url: 'https://registry.npmjs.org'
106+
- uses: actions/download-artifact@v4
107+
with:
108+
name: package-tgz
109+
- run: npm install ${{ needs.pack.outputs.PACK_FILE }}
110+
- run: node -e "const b = require('bcrypt'); const h = b.hashSync('hello', 10); console.log(h, b.compareSync('hello', h))"

examples/async_compare.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var bcrypt = require('../bcrypt');
1+
const bcrypt = require('../bcrypt');
22

33
(async () => {
44
const start = Date.now();

examples/forever_gen_salt.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
var bcrypt = require('../bcrypt');
1+
const bcrypt = require('../bcrypt');
22

33
(function printSalt() {
4-
bcrypt.genSalt(10, function(err, salt) {
4+
bcrypt.genSalt(10, (err, salt) => {
55
console.log('salt: ' + salt);
66
printSalt();
77
});

0 commit comments

Comments
 (0)