Skip to content

Commit

Permalink
Merge pull request #140 from verhovsky/github-actions
Browse files Browse the repository at this point in the history
Prebuild through GitHub Actions
  • Loading branch information
verhovsky authored Jun 15, 2023
2 parents d1d2864 + 6d959a2 commit 1328145
Show file tree
Hide file tree
Showing 3 changed files with 77 additions and 9 deletions.
61 changes: 59 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ on:
- master

env:
NODE_BUILD_CMD: npx --no-install prebuild -t 10.12.0 -t 12.13.0 --strip
ELECTRON_BUILD_CMD: npx --no-install prebuild -r electron -t 3.0.0 -t 4.0.0 -t 4.0.4 -t 5.0.0 --strip
NODE_PREBUILD_CMD: npx prebuild -t 10.0.0 -t 12.0.0 -t 14.0.0 -t 16.0.0 --strip
ELECTRON_PREBUILD_CMD: npx prebuild -r electron -t 3.0.0 -t 4.0.0 -t 4.0.4 -t 5.0.0 --strip

jobs:

Expand All @@ -19,8 +19,16 @@ jobs:
matrix:
os:
- windows-2019
- ubuntu-latest
- macos-latest
node:
- 10
- 12
- 14
- 16
# Not supported until superstring is removed or updated to support Node 18+
# - 18
# - 20
fail-fast: false
name: Testing Node ${{ matrix.node }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
Expand All @@ -35,3 +43,52 @@ jobs:

- run: npm install
- run: npm test

prebuild:
strategy:
matrix:
os:
- ubuntu-latest
- windows-2019
- macos-latest
node:
- 10
- 12
- 14
- 16
# Not supported until superstring is removed or updated to support Node 18+
# - 18
# - 20
exclude:
# macos-latest's Python version is too new to work with the node-gyp
# bundled by prebuild and the "overrides" in package.json for node-gyp
# doesn't work before npm 8.3 (Node 16)
- os: macos-latest
node: 10
- os: macos-latest
node: 12
- os: macos-latest
node: 14
fail-fast: false
name: Prebuild with Node ${{ matrix.node }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
# needs: test
steps:
- uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- run: npm install
- if: matrix.os == 'windows-latest'
run: |
${{ env.NODE_PREBUILD_CMD }} --arch ia32
${{ env.ELECTRON_PREBUILD_CMD }} --arch ia32
- if: matrix.os == 'macos-latest'
run: |
${{ env.NODE_PREBUILD_CMD }} --arch arm64
${{ env.ELECTRON_PREBUILD_CMD }} --arch arm64
- run: ${{ env.NODE_PREBUILD_CMD }}
- run: ${{ env.ELECTRON_PREBUILD_CMD }}
7 changes: 6 additions & 1 deletion binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,12 @@
]
}
],
'variables': { 'runtime%': 'node' },
'variables': {
'runtime%': 'node',
'openssl_fips': '',
'v8_enable_pointer_compression%': 0,
'v8_enable_31bit_smis_on_64bit_arch%': 0,
},
'conditions': [
['runtime=="electron"', { 'defines': ['NODE_RUNTIME_ELECTRON=1'] }],
]
Expand Down
18 changes: 12 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,23 @@
"main": "index.js",
"types": "tree-sitter.d.ts",
"dependencies": {
"nan": "^2.14.0",
"prebuild-install": "^6.0.1"
"nan": "^2.17.0",
"prebuild-install": "^7.1.1"
},
"devDependencies": {
"@types/node": "^14.14.31",
"chai": "^4.3.3",
"mocha": "^8.3.1",
"prebuild": "^10.0.1",
"@types/node": "^20.3.1",
"chai": "^4.3.7",
"mocha": "^8.4.0",
"node-gyp": "^9.4.0",
"prebuild": "^11.0.4",
"superstring": "^2.4.2",
"tree-sitter-javascript": "https://github.com/tree-sitter/tree-sitter-javascript.git#936d976a782e75395d9b1c8c7c7bf4ba6fe0d86b"
},
"overrides": {
"prebuild": {
"node-gyp": "$node-gyp"
}
},
"scripts": {
"install": "prebuild-install || node-gyp rebuild",
"build": "node-gyp build",
Expand Down

0 comments on commit 1328145

Please sign in to comment.