Skip to content
This repository was archived by the owner on Dec 15, 2022. It is now read-only.

Commit 09a0618

Browse files
authored
Merge pull request #106 from dennisameling/use-napi-prebuilds
2 parents ac31612 + 9e11a2a commit 09a0618

10 files changed

+198
-674
lines changed

.github/workflows/ci.yml

+71-60
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ name: CI
22

33
on:
44
push:
5-
branches: [ master ]
5+
branches: [master]
66
tags:
77
- v*.*.*
88
pull_request:
9-
branches: [ master ]
9+
branches: [master]
1010

1111
jobs:
1212
build:
@@ -16,6 +16,8 @@ jobs:
1616
CC: "clang"
1717
CXX: "clang++"
1818
npm_config_clang: "1"
19+
# Needed until macos-11.0 hosted runners are available
20+
SDKROOT: "/Library/Developer/CommandLineTools/SDKs/MacOSX11.1.sdk"
1921

2022
strategy:
2123
matrix:
@@ -32,47 +34,56 @@ jobs:
3234
runs-on: ${{ matrix.os }}
3335

3436
steps:
35-
- uses: actions/checkout@v2
36-
- name: Use Node.js ${{ matrix.node-version }}
37-
uses: actions/setup-node@v1
38-
with:
39-
node-version: ${{ matrix.node-version }}
40-
41-
- run: npm install
42-
name: Setup environment
43-
44-
- run: npm test
45-
name: Run tests (Windows/macOS)
46-
47-
- run: |
48-
npm run prebuild-node
49-
npm run prebuild-electron
50-
name: Prebuild (x64)
51-
52-
- run: |
53-
npm run prebuild-electron-arm64
54-
npm run prebuild-electron-ia32
55-
if: ${{ matrix.os == 'windows-latest' }}
56-
name: Prebuild (Windows x86 + ARM64)
57-
58-
- run: |
59-
mkdir -p prebuilds && chmod 777 prebuilds
60-
docker build -t node-fs-admin/i386 docker/i386
61-
docker run --rm -v ${PWD}:/project node-fs-admin/i386 /bin/bash -c "cd /project && npm run prebuild-electron-ia32 && rm -rf build"
62-
docker build -t node-fs-admin/arm64-cross-compile docker/arm64-cross-compile
63-
docker run --rm -v ${PWD}:/project node-fs-admin/arm64-cross-compile /bin/bash -c "cd /project && npm run prebuild-electron-arm64"
64-
if: ${{ matrix.os == 'ubuntu-16.04' }}
65-
name: Prebuild (Linux x86 + ARM64)
66-
67-
- run: |
68-
ls prebuilds/
69-
name: List prebuilds
70-
71-
- name: Upload prebuilds to GitHub
72-
run: npm run upload
73-
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
74-
env:
75-
GITHUB_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37+
- uses: actions/checkout@v2
38+
- name: Use Node.js ${{ matrix.node-version }}
39+
uses: actions/setup-node@v1
40+
with:
41+
node-version: ${{ matrix.node-version }}
42+
43+
# This step can be removed as soon as official Windows arm64 builds are published:
44+
# https://github.com/nodejs/build/issues/2450#issuecomment-705853342
45+
- run: |
46+
$NodeVersion = (node --version) -replace '^.'
47+
$NodeFallbackVersion = "15.8.0"
48+
& .\script\download-node-lib-win-arm64.ps1 $NodeVersion $NodeFallbackVersion
49+
if: ${{ matrix.os == 'windows-latest' }}
50+
name: Install Windows arm64 node.lib
51+
52+
- run: npm install
53+
name: Setup environment
54+
55+
- run: npm test
56+
name: Run tests (Windows/macOS)
57+
58+
- run: npm run prebuild-napi-x64
59+
name: Prebuild (x64)
60+
61+
- run: npm run prebuild-napi-arm64
62+
name: Prebuild (arm64)
63+
if: ${{ matrix.os != 'ubuntu-16.04' }}
64+
65+
- run: npm run prebuild-napi-ia32
66+
if: ${{ matrix.os == 'windows-latest' }}
67+
name: Prebuild (Windows x86)
68+
69+
- run: |
70+
mkdir -p prebuilds && chmod 777 prebuilds
71+
docker build -t node-fs-admin/i386 docker/i386
72+
docker run --rm -v ${PWD}:/project node-fs-admin/i386 /bin/bash -c "cd /project && npm run prebuild-napi-ia32 && rm -rf build"
73+
docker build -t node-fs-admin/arm64-cross-compile docker/arm64-cross-compile
74+
docker run --rm -v ${PWD}:/project node-fs-admin/arm64-cross-compile /bin/bash -c "cd /project && npm run prebuild-napi-arm64"
75+
if: ${{ matrix.os == 'ubuntu-16.04' }}
76+
name: Prebuild (Linux x86 + ARM64)
77+
78+
- run: |
79+
ls prebuilds/
80+
name: List prebuilds
81+
82+
- name: Upload prebuilds to GitHub
83+
run: npm run upload
84+
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
85+
env:
86+
GITHUB_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7687

7788
# Separate step for publishing to NPM so we're sure that generating + uploading prebuilds worked on all platforms
7889
npm-publish:
@@ -82,20 +93,20 @@ jobs:
8293
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
8394

8495
steps:
85-
- uses: actions/checkout@v2
86-
- name: Use Node.js 15
87-
uses: actions/setup-node@v1
88-
with:
89-
node-version: 15.x
90-
registry-url: 'https://registry.npmjs.org'
91-
92-
- run: sudo apt-get install libsecret-1-dev
93-
name: Install additional dependencies
94-
95-
- run: npm install
96-
name: Setup environment
97-
98-
- run: npm publish --access public
99-
name: Upload to NPM
100-
env:
101-
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
96+
- uses: actions/checkout@v2
97+
- name: Use Node.js 15
98+
uses: actions/setup-node@v1
99+
with:
100+
node-version: 15.x
101+
registry-url: "https://registry.npmjs.org"
102+
103+
- run: sudo apt-get install libsecret-1-dev
104+
name: Install additional dependencies
105+
106+
- run: npm install
107+
name: Setup environment
108+
109+
- run: npm publish --access public
110+
name: Upload to NPM
111+
env:
112+
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}

binding.gyp

+13-1
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,23 @@
1313
'targets': [
1414
{
1515
'target_name': 'fs_admin',
16+
'defines': [
17+
"NAPI_VERSION=<(napi_build_version)",
18+
],
19+
'cflags!': [ '-fno-exceptions' ],
20+
'cflags_cc!': [ '-fno-exceptions' ],
21+
'xcode_settings': { 'GCC_ENABLE_CPP_EXCEPTIONS': 'YES',
22+
'CLANG_CXX_LIBRARY': 'libc++',
23+
'MACOSX_DEPLOYMENT_TARGET': '10.7',
24+
},
25+
'msvs_settings': {
26+
'VCCLCompilerTool': { 'ExceptionHandling': 1 },
27+
},
1628
'sources': [
1729
'src/main.cc',
1830
],
1931
'include_dirs': [
20-
'<!(node -e "require(\'nan\')")'
32+
'<!(node -p "require(\'node-addon-api\').include_dir")',
2133
],
2234
'conditions': [
2335
['OS=="win"', {

0 commit comments

Comments
 (0)