Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support MacOS arm and newer node #11

Merged
merged 14 commits into from
Jan 6, 2025
87 changes: 87 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: CI

on:
push:
branches:
- '*'
tags:
- '*'
pull_request:
branches:
- '*'

jobs:
build:
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [ubuntu-latest, macos-latest]
node-version: [16, 18, 20, 22]

steps:
- uses: actions/checkout@v4
with:
submodules: 'recursive'

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Set macOS system controls
if: runner.os == 'macOS'
run: |
sudo sysctl -w kern.sysv.shmall=65536
sudo sysctl -w kern.sysv.shmmax=16777216

- name: Setup build tools
run: |
npm install -g node-gyp
npm install -g node-pre-gyp-github

- name: Setup macOS build tools
if: runner.os == 'macOS'
run: |
env HOMEBREW_NO_AUTO_UPDATE=1 brew install autoconf automake libtool

- name: Set publish flag
run: |
echo "PUBLISH_BINARY=false" >> $GITHUB_ENV
if [[ "${{ github.ref }}" == "refs/tags/"* ]]; then
echo "PUBLISH_BINARY=true" >> $GITHUB_ENV
fi
if [[ "${{ github.event.head_commit.message }}" == *"[publish binary]"* ]]; then
echo "PUBLISH_BINARY=true" >> $GITHUB_ENV
fi

- name: Setup Linux compiler
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y g++
echo "CXX=g++" >> $GITHUB_ENV

- name: Install
run: |
npm install --build-from-source
npm test

- name: Publish
env:
NODE_PRE_GYP_GITHUB_TOKEN: ${{ secrets.NODE_PRE_GYP_GITHUB_TOKEN }}
run: |
if [[ $PUBLISH_BINARY == true ]]; then node-pre-gyp package; node-pre-gyp-github publish --release; fi;
./node_modules/.bin/node-pre-gyp clean
node-gyp clean

- name: Publish Check
run: |
INSTALL_RESULT=0
if [[ $PUBLISH_BINARY == true ]]; then INSTALL_RESULT=$(npm install --fallback-to-build=false > /dev/null)$? || true; fi;
if [[ $INSTALL_RESULT != 0 ]]; then echo "returned $INSTALL_RESULT";false; fi
./node_modules/.bin/node-pre-gyp clean
62 changes: 0 additions & 62 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var binary = require('node-pre-gyp');
var binary = require('@mapbox/node-pre-gyp');
var path = require('path');
var binding_path = binary.find(path.resolve(path.join(__dirname,'./package.json')));
var binding = require(binding_path);
Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"clean": "node-pre-gyp clean",
"test": "mocha",
"install": "node-pre-gyp install --fallback-to-build || (npm run build:fastcommon && npm run build:shmcache && npm run build:libbson && node-pre-gyp install --fallback-to-build)",
"build:fastcommon": "cd deps/libfastcommon && MACOSX_DEPLOYMENT_TARGET=10.7 ./make.sh",
"build:shmcache": "cd deps/libshmcache/src && MACOSX_DEPLOYMENT_TARGET=10.7 LIBRARY_PATH=../../libfastcommon/src INC_PATH=\" -I../../libfastcommon/src\" make -e",
"build:libbson": "cd deps/ && MACOSX_DEPLOYMENT_TARGET=10.7 ./build-libbson.sh",
"build:fastcommon": "cd deps/libfastcommon && MACOSX_DEPLOYMENT_TARGET=11.0 ./make.sh",
"build:shmcache": "cd deps/libshmcache/src && MACOSX_DEPLOYMENT_TARGET=11.0 LIBRARY_PATH=../../libfastcommon/src INC_PATH=\" -I../../libfastcommon/src\" make -e",
"build:libbson": "cd deps/ && MACOSX_DEPLOYMENT_TARGET=11.0 ./build-libbson.sh",
"trim": "cd deps/ && rm -rf libbson/.git && rm -rf libshmcache/.git && rm -rf libfastcommon/.git && rm libbson/.gitignore && rm libbson/README && cp libbson/README.rst libbson/README"
},
"binary": {
Expand All @@ -18,14 +18,14 @@
"remote_path": "{version}"
},
"devDependencies": {
"@mapbox/node-pre-gyp": "^1.0.11",
"mocha": "^3.2.0",
"node-gyp": "^11.0.0",
"node-pre-gyp-github": "^1.3.1"
},
"dependencies": {
"bindings": "^1.5.0",
"nan": "^2.14.1",
"node-gyp": "^3.8.0",
"node-pre-gyp": "^0.6.39"
"nan": "^2.22.0"
},
"gypfile": true,
"name": "shm-cache",
Expand All @@ -49,6 +49,6 @@
},
"homepage": "https://github.com/denghongcai/node-shm-cache#readme",
"engines": {
"node": ">=8"
"node": ">=16"
}
}
Loading