Skip to content

Commit

Permalink
Prebuild with GitHub Actions (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
verhovsky committed May 5, 2023
1 parent c8b6453 commit 6aaf682
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 7 deletions.
78 changes: 73 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,47 @@
name: Build/test
name: build

on:
push:
branches:
- master
pull_request:
branches:
- master
release:
types:
- released

env:
NODE_BUILD_CMD: npx prebuild -r node -t 14.0.0 -t 16.0.0 -t 18.0.0 -t 20.0.0
ELECTRON_BUILD_CMD: npx prebuild -r electron -t 16.0.0 -t 17.0.0 -t 18.0.0 -t 19.0.0 -t 20.0.0 -t 21.0.0 -t 22.0.0 -t 23.0.0 -t 24.0.0

jobs:

test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: [macos-latest, ubuntu-latest]
os:
- ubuntu-latest
- macos-latest
node:
- 14
- 16
- 18
- 20
fail-fast: false
name: Testing Node ${{ matrix.node }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 16
node-version: ${{ matrix.node }}
- run: npm install
- run: npm test

test_windows:
runs-on: windows-latest
steps:
Expand All @@ -35,3 +54,52 @@ jobs:
node-version: 16
- run: npm install
- run: npm run-script test-windows

publish:
if: ${{ github.event_name == 'release' }}
name: Publishing to NPM
runs-on: ubuntu-latest
needs: [ test, test_windows ]
steps:
- uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 18
registry-url: https://registry.npmjs.org
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

prebuild:
strategy:
matrix:
os:
- ubuntu-latest
- macos-latest
- windows-latest
fail-fast: false
name: Prebuild on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
needs: publish
steps:
- uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: 18
- run: npm install --ignore-scripts
- run: ${{ env.NODE_BUILD_CMD }} -u ${{ secrets.GH_TOKEN }}
- run: ${{ env.ELECTRON_BUILD_CMD }} -u ${{ secrets.GH_TOKEN }}
- if: matrix.os == 'windows-latest'
run: |
${{ env.NODE_BUILD_CMD }} --arch ia32 -u ${{ secrets.GH_TOKEN }}
${{ env.ELECTRON_BUILD_CMD }} --arch ia32 -u ${{ secrets.GH_TOKEN }}
- if: matrix.os == 'macos-latest'
run: |
${{ env.NODE_BUILD_CMD }} --arch arm64 -u ${{ secrets.GH_TOKEN }}
${{ env.ELECTRON_BUILD_CMD }} --arch arm64 -u ${{ secrets.GH_TOKEN }}
20 changes: 18 additions & 2 deletions binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,23 @@
],
"cflags_c": [
"-std=c99",
]
],
"cflags_cc": ["-std=c++17"],
"xcode_settings": {
"OTHER_CPLUSPLUSFLAGS": ["-std=c++17", "-stdlib=libc++"],
},
"msvs_settings": {
"VCCLCompilerTool": {
"AdditionalOptions": [
"/std:c++17",
],
"RuntimeLibrary": 0,
},
},

}
]
],
'variables': {
'openssl_fips': '',
},
}

0 comments on commit 6aaf682

Please sign in to comment.