-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor Github Actions testing and prebuilding
This commit changes the current way of testing + prebuilding native addons on Githugb Actions by introducing the following changes: * Separate the test workflow (run on any push) from the prebuilding workflow (run only on new tags). * Use prebuildify-cross to compile native addons for two architectures (x64, arm64) and for two different libc implementations (glibc, musl) on Linux. * Upgrade to v3 of the checkout and setup-node actions. * Prebuild the native addon and test on x64 Windows too. * Use compiler defaults for C++ version on MacOS.
- Loading branch information
1 parent
47d3180
commit 80651c4
Showing
4 changed files
with
68 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,86 +1,58 @@ | ||
name: Test and Prebuild | ||
name: Prebuild binary addons | ||
on: [push] | ||
jobs: | ||
build-test-macos: | ||
build-macos: | ||
if: startsWith(github.ref, 'refs/tags/') | ||
runs-on: macos-11 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v3 | ||
- name: Setup node | ||
uses: actions/setup-node@v2 | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 12 | ||
- run: npm install | ||
- run: npm test | ||
node-version: 20 | ||
- run: npm install --ignore-scripts | ||
- run: npm run prebuild | ||
if: startsWith(github.ref, 'refs/tags/') | ||
- run: npm run prebuild-arm64 | ||
if: startsWith(github.ref, 'refs/tags/') | ||
env: | ||
PREBUILD_ARCH: x64 | ||
- run: npm run prebuild | ||
env: | ||
PREBUILD_ARCH: arm64 | ||
- run: tar --create --format ustar --verbose --file=prebuild-darwin.tar -C prebuilds . | ||
if: startsWith(github.ref, 'refs/tags/') | ||
- name: Prebuild | ||
uses: softprops/action-gh-release@v1 | ||
if: startsWith(github.ref, 'refs/tags/') | ||
with: | ||
files: prebuild-darwin.tar | ||
build-linux: | ||
if: startsWith(github.ref, 'refs/tags/') | ||
runs-on: ubuntu-18.04 | ||
container: quay.io/pypa/manylinux2014_x86_64 | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- run: ldd --version ldd | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v3 | ||
- name: Setup node | ||
uses: actions/setup-node@v2 | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 12 | ||
- run: npm install | ||
- run: npm run prebuild | ||
- run: npm test | ||
node-version: 20 | ||
- run: npm install --ignore-scripts | ||
- run: npm run prebuild-linux-x64 | ||
- run: npm run prebuild-linux-arm64-glibc | ||
- run: npm run prebuild-linux-arm64-musl | ||
- run: tar --create --verbose --file=prebuild-linux.tar -C prebuilds . | ||
- name: Prebuild | ||
if: startsWith(github.ref, 'refs/tags/') | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: prebuild-linux.tar | ||
build-alpine: | ||
runs-on: ubuntu-18.04 | ||
container: node:12.22-alpine | ||
steps: | ||
- run: apk add python3 py3-pip build-base | ||
- uses: actions/checkout@v2 | ||
- run: npm install | ||
- run: npm run prebuild-musl | ||
- run: npm test | ||
- run: tar --create --verbose --file=prebuild-alpine.tar -C prebuilds . | ||
- name: Prebuild | ||
if: startsWith(github.ref, 'refs/tags/') | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: prebuild-alpine.tar | ||
build-linux-arm64: | ||
build-windows: | ||
if: startsWith(github.ref, 'refs/tags/') | ||
runs-on: ubuntu-18.04 | ||
container: quay.io/pypa/manylinux_2_24_x86_64 | ||
runs-on: windows-2019 | ||
steps: | ||
- run: apt-get update | ||
- run: apt-get install -y gcc-aarch64-linux-gnu | ||
- run: apt-get install -y g++-aarch64-linux-gnu | ||
- run: ldd --version ldd | ||
- uses: actions/checkout@v2 | ||
- uses: actions/checkout@v3 | ||
- name: Setup node | ||
uses: actions/setup-node@v2 | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 12 | ||
- run: npm install | ||
- run: npm run prebuild-arm64 | ||
if: startsWith(github.ref, 'refs/tags/') | ||
env: | ||
CC: aarch64-linux-gnu-gcc | ||
CXX: aarch64-linux-gnu-g++ | ||
- run: tar --create --verbose --file=prebuild-linux-arm64.tar -C prebuilds . | ||
node-version: 20 | ||
- run: npm install --ignore-scripts | ||
- run: npm run prebuild | ||
- run: tar --create --verbose --file=prebuild-windows.tar -C prebuilds . | ||
- name: Prebuild | ||
if: startsWith(github.ref, 'refs/tags/') | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
files: prebuild-linux-arm64.tar | ||
files: prebuild-windows.tar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: Test | ||
on: [push] | ||
jobs: | ||
test-macos: | ||
runs-on: macos-11 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Setup node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20 | ||
- run: npm install | ||
- run: npm test | ||
test-linux: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Setup node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20 | ||
- run: npm install | ||
- run: npm test | ||
test-windows: | ||
runs-on: windows-2019 | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Setup node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 20 | ||
- run: npm install | ||
- run: npm test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,11 +33,12 @@ | |
"scripts": { | ||
"install": "node-gyp-build", | ||
"recompile": "node-gyp build", | ||
"before-publish": "prebuildify-ci download && prebuildify --target 20.0.0 && prebuildify --target 18.0.0 && prebuildify --target 17.1.0 && prebuildify --target 16.13.0 && prebuildify --target 15.5.0 && prebuildify --target 14.17.6 && prebuildify --target 12.22.7 && prebuildify --target [email protected]", | ||
"prebuild": "prebuildify --target 20.0.0 && prebuildify --target 18.0.0 && prebuildify --target 17.1.0 && prebuildify --target 16.13.0 && prebuildify --target 15.5.0 && prebuildify --target 14.17.6 && prebuildify --target 12.22.7 && prebuildify --target [email protected]", | ||
"prebuild-musl": "prebuildify --target 20.0.0 --libc musl --tag-libc && prebuildify --target 18.0.0 --libc musl --tag-libc && prebuildify --target 17.1.0 --libc musl --tag-libc && prebuildify --target 16.13.0 --libc musl --tag-libc && prebuildify --target 14.17.6 --libc musl --tag-libc && prebuildify --target 12.22.7 --libc musl --tag-libc", | ||
"prebuild-arm64": "prebuildify --arch=arm64 --target 20.0.0 --libc musl && prebuildify --arch=arm64 --target 18.0.0 --libc musl && prebuildify --arch=arm64 --target 17.1.0 --libc musl && prebuildify --arch=arm64 --target 16.13.0 && prebuildify --arch=arm64 --target 14.17.6 && prebuildify --arch=arm64 --target [email protected]", | ||
"test": "./node_modules/.bin/mocha test/**.test.js --recursive", | ||
"before-publish": "prebuildify-ci download && prebuildify -t 20.0.0 -t 18.0.0 -t 17.1.0 -t 16.13.0 -t 15.5.0 -t 14.17.6 -t 12.22.7 -t [email protected]", | ||
"prebuild": "prebuildify -t 20.0.0 -t 18.0.0 -t 17.1.0 -t 16.13.0 -t 15.5.0 -t 14.17.6 -t 12.22.7 -t [email protected]", | ||
"prebuild-linux-x64": "prebuildify-cross -i centos7-devtoolset7 -i alpine -t 20.0.0 -t 18.0.0 -t 17.1.0 -t 16.13.0 -t 15.5.0 -t 14.17.6 -t 12.22.7 -t [email protected]", | ||
"prebuild-linux-arm64-glibc": "prebuildify-cross --tag-libc -i linux-arm64-lts -t 20.0.0 -t 18.0.0 -t 17.1.0 -t 16.13.0 -t 15.5.0 -t 14.17.6 -t 12.22.7 -t [email protected]", | ||
"prebuild-linux-arm64-musl": "prebuildify-cross --libc musl --tag-libc -i linux-arm64-musl -t 20.0.0 -t 18.0.0 -t 17.1.0 -t 16.13.0 -t 15.5.0 -t 14.17.6 -t 12.22.7 -t [email protected]", | ||
"test": "mocha test/**.test.js --recursive", | ||
"benchmark": "node ./benchmark/index.js" | ||
}, | ||
"gypfile": true, | ||
|
@@ -53,6 +54,7 @@ | |
"node-gyp": "^9.4.0", | ||
"prebuildify": "^5.0.0", | ||
"prebuildify-ci": "^1.0.5", | ||
"prebuildify-cross": "^5.0.0", | ||
"rimraf": "^3.0.2", | ||
"jshint": "^2.12.0" | ||
} | ||
|