Skip to content

Commit

Permalink
Better Prebuild
Browse files Browse the repository at this point in the history
  • Loading branch information
stoprocent committed Oct 20, 2023
1 parent ebde847 commit 2cccff9
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 33 deletions.
59 changes: 32 additions & 27 deletions .github/workflows/prebuild.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
name: prebuild

name: Build
on:
push:
branches:
- master
tags:
- '*'
pull_request:
branches:
- master
workflow_dispatch:

- main
- beta
concurrency:
group: build-${{ github.ref }}
cancel-in-progress: false
jobs:
prebuild:
strategy:
Expand All @@ -19,38 +15,47 @@ jobs:
- name: darwin
os: macos-11
node: x64
- name: linux
os: ubuntu-latest
- name: win32
command: prebuildify
args: --arch x64+arm64
- name: win32-x86
os: windows-2019
node: x86
command: prebuildify
- name: win32-x64
os: windows-2019
node: x64
command: prebuildify
- name: linux-x64
os: ubuntu-latest
command: prebuildify-cross
args: -i centos7-devtoolset7 -i alpine
- name: linux-arm
os: ubuntu-latest
command: prebuildify-cross
args: -i linux-arm64-lts -i linux-armv7 -i linux-armv6
- name: android-arm
os: ubuntu-latest
command: prebuildify-cross
args: -i android-arm64 -i android-armv7
name: Build ${{ matrix.name }}
runs-on: ${{ matrix.os }}
steps:
- if: matrix.node
uses: actions/setup-node@v3
with:
node-version: 14.x
node-version: 18.x
architecture: ${{ matrix.node }}
- uses: actions/checkout@v3
- name: Install dependencies (ubuntu-latest)
# Use g++-9 only on versions after 'ubuntu-18.04'
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt -qq update
sudo apt install -y g++-9
export CC="g++-9"
- run: npm install --ignore-scripts
- run: npm run prebuild-${{ matrix.name }}
- run: tar -zcvf ${{ matrix.name }}.tar.gz -C prebuilds .
- run: npm ci
- run: npm run ${{ matrix.command }} -- ${{ matrix.args }}
- uses: actions/upload-artifact@v3
with:
name: build-artifacts
path: prebuilds/
if-no-files-found: error
- if: failure()
run: npx shx ls -lA
release:
release:
needs: prebuild
name: Release
runs-on: ubuntu-latest
Expand All @@ -67,5 +72,5 @@ release:
- run: npm run build
- run: npm run semantic-release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
9 changes: 3 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"node-gyp": "^9.3.1",
"nyc": "^15.1.0",
"prebuildify": "^5.0.1",
"prebuildify-ci": "^1.0.5",
"prebuildify-cross": "5.0.0",
"prettier": "^2.8.1",
"proxyquire": "^2.1.3",
"should": "~13.2.3",
Expand All @@ -67,11 +67,8 @@
"install": "node-gyp-build",
"lint": "eslint \"**/*.js\"",
"lint-fix": "eslint \"**/*.js\" --fix",
"prebuild": "prebuildify --napi --strip",
"prebuild-darwin": "prebuildify --napi --strip --arch x64+arm64",
"prebuild-win32": "prebuildify --napi --strip",
"prebuild-linux": "prebuildify --napi --strip",
"prebuild-download": "prebuildify-ci download",
"prebuildify": "prebuildify --napi --target 14.0.0 --force --strip --verbose",
"prebuildify-cross": "prebuildify-cross --napi --target 14.0.0 --force --strip --verbose",
"pretest": "npm run rebuild",
"rebuild": "node-gyp rebuild",
"coverage": "nyc npm test && nyc report --reporter=text-lcov > .nyc_output/lcov.info",
Expand Down

0 comments on commit 2cccff9

Please sign in to comment.