Skip to content

Commit

Permalink
Update GitHub workflows
Browse files Browse the repository at this point in the history
Some of these had hardcoded versions (e.g. v18)

Also reworks prebuild action to not require a 3x3 matrix.
  • Loading branch information
laverdet committed Jun 6, 2024
1 parent b1d9a29 commit aab1a90
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 21 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,19 @@ on: [push, pull_request]

jobs:
build-and-test:
name: ${{ matrix.os }} / Node ${{ matrix.node }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [ 18.x, 20.x, 22.x ]
os: [ ubuntu-latest, macos-latest, windows-latest ]
node: [ 18, 20, 22 ]
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
node-version: ${{ matrix.node }}
- name: Add msbuild to PATH
if: matrix.os == 'windows-latest'
uses: microsoft/[email protected]
Expand All @@ -39,8 +40,9 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [ 18, 20, 22 ]
container: node:${{ matrix.node-version }}-alpine
node: [ 18, 20, 22 ]
fail-fast: false
container: node:${{ matrix.node }}-alpine
steps:
- uses: actions/checkout@v4
- name: install build deps
Expand Down
36 changes: 22 additions & 14 deletions .github/workflows/prebuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,53 +7,61 @@ on:

jobs:
prebuild:
name: ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
node-version: [ 18.x, 20.x, 22.x ]
os: [ ubuntu-latest, macos-latest, windows-latest ]
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Use Node.js 18.x
- name: Use nodejs
uses: actions/setup-node@v4
with:
node-version: 18.x
node-version: latest
- name: Add msbuild to PATH
if: matrix.os == 'windows-latest'
uses: microsoft/[email protected]
- name: Install node-gyp
if: matrix.os == 'windows-latest'
run: |
npm install --global node-gyp@latest
- name: Build
- name: Dependencies
run: |
npm install --ignore-scripts
- name: Prebuild
- name: Build
run: |
npm run prebuild
npx prebuild --target 18.0.0
npx prebuild --target 20.0.0
npx prebuild --target 22.0.0
- name: Upload
run: |
npx prebuild --upload ${{ secrets.UPLOAD_TOKEN }}
npx prebuild --upload-all ${{ secrets.UPLOAD_TOKEN }}
env:
MAKEFLAGS: -j4

prebuild-alpine:
name: alpine
runs-on: ubuntu-latest
container: node:18-alpine3.19
container: node:alpine
steps:
- uses: actions/checkout@v4
- name: install build deps
- name: Use nodejs
uses: actions/setup-node@v4
with:
node-version: latest
- name: Install build deps
run: |
apk add g++ make python3
- name: Build
- name: Dependencies
run: |
npm install --ignore-scripts
- name: Prebuild
- name: Build
run: |
npm run prebuild
npx prebuild --target 18.0.0
npx prebuild --target 20.0.0
npx prebuild --target 22.0.0
- name: Upload
run: |
npx prebuild --upload ${{ secrets.UPLOAD_TOKEN }}
npx prebuild --upload-all ${{ secrets.UPLOAD_TOKEN }}
env:
MAKEFLAGS: -j4
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
"scripts": {
"install": "prebuild-install || (node-gyp rebuild --release -j max && node-gyp clean)",
"rebuild": "node-gyp rebuild --release -j max",
"prebuild": "prebuild",
"upload": "prebuild --upload ${GITHUB_TOKEN}",
"lint": "find src -name '*.cc' | xargs -n1 clang-tidy",
"test": "node test.js"
},
Expand Down

0 comments on commit aab1a90

Please sign in to comment.