diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index afc6a86..dc3f12f 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -10,34 +10,50 @@ on: jobs: build: - runs-on: ubuntu-22.04 strategy: matrix: - node-version: [14.x, 16.x, 18.x] + os: [ubuntu-20.04, macos-11.0, windows-2019] + nodeVersion: [14, 16, 18, 20] + runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v2 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 + - uses: actions/checkout@v3 + - name: Use Node.js ${{ matrix.nodeVersion }} + uses: actions/setup-node@v3 with: - node-version: ${{ matrix.node-version }} - - name: Install dependencies - run: | - sudo apt-get install -y python3 make g++ + node-version: ${{ matrix.nodeVersion }} - name: Test run: npm test + - name: Package + if: startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/heads/master') + run: npx node-pre-gyp package + - name: Upload + uses: actions/upload-artifact@v3 + if: matrix.nodeVersion == '14' && (startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/heads/master')) + with: + name: bcrypt-lib-${{ matrix.os }}-${{ matrix.nodeVersion }} + path: build/stage/**/bcrypt_lib*.tar.gz build-alpine: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest strategy: matrix: - node-version: [14, 16, 18] + nodeVersion: [14, 16, 18, 20] container: - image: node:${{ matrix.node-version }}-alpine + image: node:${{ matrix.nodeVersion }}-alpine steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Install dependencies run: | apk add make g++ python3 - name: Test run: | npm test --unsafe-perm + - name: Package + if: startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/heads/master') + run: npx node-pre-gyp package --unsafe-perm + - name: Upload + if: matrix.nodeVersion == '14' && (startsWith(github.ref, 'refs/tags/') || startsWith(github.ref, 'refs/heads/master')) + uses: actions/upload-artifact@v3 + with: + name: bcrypt-lib-alpine-${{ matrix.nodeVersion }} + path: build/stage/**/bcrypt_lib*.tar.gz