1 | name: ci
|
2 |
|
3 | on:
|
4 | push:
|
5 | branches:
|
6 | - master
|
7 | pull_request:
|
8 | branches:
|
9 | - master
|
10 |
|
11 | jobs:
|
12 | build:
|
13 | strategy:
|
14 | matrix:
|
15 | os: [ubuntu-20.04, macos-11.0, windows-2019]
|
16 | nodeVersion: [14, 16, 18, 20]
|
17 | runs-on: ${{ matrix.os }}
|
18 | steps:
|
19 | - uses: actions/checkout@v3
|
20 | - name: Use Node.js ${{ matrix.nodeVersion }}
|
21 | uses: actions/setup-node@v3
|
22 | with:
|
23 | node-version: ${{ matrix.nodeVersion }}
|
24 | - name: Test
|
25 | run: npm test
|
26 | - name: Package
|
27 | if: startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/heads/master')
|
28 | run: npx node-pre-gyp package
|
29 | - name: Upload
|
30 | uses: actions/upload-artifact@v3
|
31 | if: matrix.nodeVersion == '14' && (startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/heads/master'))
|
32 | with:
|
33 | name: bcrypt-lib-${{ matrix.os }}-${{ matrix.nodeVersion }}
|
34 | path: build/stage/**/bcrypt_lib*.tar.gz
|
35 |
|
36 | build-alpine:
|
37 | runs-on: ubuntu-latest
|
38 | strategy:
|
39 | matrix:
|
40 | nodeVersion: [14, 16, 18, 20]
|
41 | container:
|
42 | image: node:${{ matrix.nodeVersion }}-alpine
|
43 | steps:
|
44 | - uses: actions/checkout@v3
|
45 | - name: Install dependencies
|
46 | run: |
|
47 | apk add make g++ python3
|
48 | - name: Test
|
49 | run: |
|
50 | npm test --unsafe-perm
|
51 | - name: Package
|
52 | if: startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/heads/master')
|
53 | run: npx node-pre-gyp package --unsafe-perm
|
54 | - name: Upload
|
55 | if: matrix.nodeVersion == '14' && (startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/heads/master'))
|
56 | uses: actions/upload-artifact@v3
|
57 | with:
|
58 | name: bcrypt-lib-alpine-${{ matrix.nodeVersion }}
|
59 | path: build/stage/**/bcrypt_lib*.tar.gz
|