Skip to content

Commit f2bd3dd

Browse files
authored
Merge pull request #69 from wadey/github-actions
GitHub Actions
2 parents 6f79caf + e584e93 commit f2bd3dd

4 files changed

Lines changed: 133 additions & 4 deletions

File tree

.github/workflows/release.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: Release
2+
on:
3+
push:
4+
tags: ['*']
5+
jobs:
6+
build:
7+
permissions:
8+
contents: read
9+
strategy:
10+
matrix:
11+
include:
12+
- os: ubuntu-latest
13+
arch: x64
14+
build-group: linux-x64
15+
- os: ubuntu-latest
16+
arch: x64
17+
build-group: linux-arm
18+
- os: macos-latest
19+
arch: x64
20+
build-group: darwin-x64+arm64
21+
- os: windows-2019
22+
arch: x86
23+
build-group: win32-x86
24+
- os: windows-2019
25+
arch: x64
26+
build-group: win32-x64
27+
runs-on: ${{ matrix.os }}
28+
name: Build ${{ matrix.build-group }}
29+
env:
30+
BUILD_GROUP: ${{ matrix.build-group }}
31+
steps:
32+
- name: Checkout
33+
uses: actions/checkout@v3
34+
with:
35+
submodules: recursive
36+
- name: Set up node
37+
uses: actions/setup-node@v3
38+
with:
39+
node-version: 14
40+
architecture: ${{ matrix.arch }}
41+
- name: Install
42+
run: npm install --ignore-scripts
43+
- name: Prebuild
44+
run: npm run prebuild-$BUILD_GROUP
45+
shell: bash
46+
- name: Prepare artifact
47+
run: tar -zcvf $BUILD_GROUP.tar.gz -C prebuilds .
48+
shell: bash
49+
- name: Upload artifact
50+
uses: actions/upload-artifact@v3
51+
with:
52+
name: ${{ env.BUILD_GROUP }}
53+
path: ${{ env.BUILD_GROUP }}.tar.gz
54+
retention-days: 1
55+
release:
56+
needs: build
57+
permissions:
58+
contents: write
59+
runs-on: ubuntu-latest
60+
name: Release
61+
steps:
62+
- name: Checkout
63+
uses: actions/checkout@v3
64+
- name: Download artifacts
65+
uses: actions/download-artifact@v3
66+
with:
67+
path: artifacts
68+
- name: Create GitHub release
69+
uses: docker://antonyurchenko/git-release:v4
70+
env:
71+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
72+
with:
73+
args: artifacts/*/*.tar.gz

.github/workflows/test.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Test
2+
on: [push, pull_request]
3+
permissions:
4+
contents: read
5+
jobs:
6+
lint:
7+
runs-on: ubuntu-latest
8+
name: Lint
9+
steps:
10+
- name: Checkout
11+
uses: actions/checkout@v3
12+
with:
13+
submodules: recursive
14+
- name: Use node latest
15+
uses: actions/setup-node@v3
16+
with:
17+
node-version: latest
18+
- name: Install
19+
run: npm install
20+
- name: Lint Test
21+
run: npm run lint-test
22+
test:
23+
strategy:
24+
matrix:
25+
os: [ubuntu-latest, macos-latest, windows-latest]
26+
node: [12, 14, 16]
27+
arch: [x86, x64]
28+
exclude:
29+
- { os: ubuntu-latest, arch: x86 }
30+
- { os: macos-latest, arch: x86 }
31+
runs-on: ${{ matrix.os }}
32+
name: ${{ matrix.os }} / Node ${{ matrix.node }} ${{ matrix.arch }}
33+
steps:
34+
- name: Checkout
35+
uses: actions/checkout@v3
36+
with:
37+
submodules: recursive
38+
- name: Use node ${{ matrix.node }}
39+
uses: actions/setup-node@v3
40+
with:
41+
node-version: ${{ matrix.node }}
42+
architecture: ${{ matrix.arch }}
43+
- name: Install
44+
run: npm install
45+
- name: Test
46+
run: npm test

binding.gyp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
'cflags!': [ '-fno-exceptions' ],
77
'cflags_cc!': [ '-fno-exceptions' ],
88
'include_dirs': ["<!(node -p \"require('node-addon-api').include_dir\")"],
9-
'dependencies': ["<!(node -p \"require('node-addon-api').gyp\")"],
109
'conditions': [
1110
["OS=='win'", {
1211
"defines": [
@@ -24,7 +23,15 @@
2423
'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden
2524
'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',
2625
'CLANG_CXX_LIBRARY': 'libc++',
27-
'MACOSX_DEPLOYMENT_TARGET': '10.7',
26+
'MACOSX_DEPLOYMENT_TARGET': '10.9',
27+
"OTHER_CFLAGS": [
28+
"-arch x86_64",
29+
"-arch arm64",
30+
],
31+
"OTHER_LDFLAGS": [
32+
"-arch x86_64",
33+
"-arch arm64",
34+
],
2835
},
2936
}],
3037
],

package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,12 @@
1919
"install": "node-gyp-build",
2020
"rebuild": "node-gyp rebuild",
2121
"prebuild": "prebuildify -t 14.13.0 -t electron@18.2.0 --napi --strip",
22-
"prebuild-darwin": "prebuildify -t 14.13.0 -t electron@18.2.0 --arch x64+arm64 --napi --strip",
22+
"prebuild-linux-x64": "prebuildify -t 14.13.0 -t electron@18.2.0 --napi --strip",
23+
"prebuild-linux-arm": "prebuildify-cross -i linux-armv7 -t 14.13.0 --napi --strip",
24+
"prebuild-darwin-x64+arm64": "prebuildify -t 14.13.0 -t electron@18.2.0 --arch x64+arm64 --napi --strip",
25+
"prebuild-win32-x64": "prebuildify -t 14.13.0 -t electron@18.2.0 --napi --strip",
26+
"prebuild-win32-x86": "prebuildify -t 14.13.0 -t electron@18.2.0 --napi --strip",
2327
"download-prebuilds": "prebuildify-ci download",
24-
"prebuildify-cross-armv7": "prebuildify-cross --platform=linux --arch=arm --arm-version=7 -- -t 14.13.0 --napi --strip",
2528
"test": "node test.js",
2629
"format": "clang-format -i src/microtime.cc",
2730
"lint-test": "standard && clang-format -output-replacements-xml src/microtime.cc | (! grep -q '<replacement ') && node test.js"

0 commit comments

Comments
 (0)