update for node 21 (#1794)

Co-authored-by: mwilsnd <mwilsnd@gmail.com>
This commit is contained in:
Andrew Calcutt
2023-10-23 11:06:58 -04:00
committed by GitHub
parent da45706601
commit ae2c90719e
5 changed files with 55 additions and 24 deletions

View File

@@ -69,7 +69,7 @@ jobs:
fail-fast: false
matrix:
include:
- runs-on: ubuntu-20.04
- runs-on: ubuntu-22.04
arch: x86_64
- runs-on: [self-hosted, linux, ARM64]
arch: arm64
@@ -128,9 +128,7 @@ jobs:
libcurl4-openssl-dev \
libglfw3-dev \
libuv1-dev \
g++-10 \
libc++-9-dev \
libc++abi-9-dev \
g++-12 \
libjpeg-dev \
libpng-dev \
libwebp-dev
@@ -139,7 +137,7 @@ jobs:
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 18
node-version: 20
- name: npm ci
run: npm ci --ignore-scripts
@@ -148,6 +146,14 @@ jobs:
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1
# Fixes an issue with the image causing builds to fail - https://github.com/actions/runner-images/issues/8598
- name: Remove Strawberry Perl from PATH (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
$env:PATH = $env:PATH -replace "C:\\Strawberry\\c\\bin;", ""
"PATH=$env:PATH" | Out-File -FilePath $env:GITHUB_ENV -Append
- name: Setup cmake (Linux)
if: runner.os == 'Linux' && runner.arch != 'arm64'
uses: jwlawson/actions-setup-cmake@v1.14
@@ -199,8 +205,8 @@ jobs:
-G Ninja \
-DCMAKE_BUILD_TYPE=${{ env.BUILDTYPE }} \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_C_COMPILER=gcc-10 \
-DCMAKE_CXX_COMPILER=g++-10 \
-DCMAKE_C_COMPILER=gcc-12 \
-DCMAKE_CXX_COMPILER=g++-12 \
-DMLN_WITH_NODE=ON
- name: "Create directory '${{ github.workspace }}/platform/windows/vendor/vcpkg/bincache' (Windows)"
@@ -267,7 +273,7 @@ jobs:
GALLIUM_DRIVER: softpipe
run: |
Invoke-WebRequest https://github.com/pal1000/mesa-dist-win/releases/download/22.3.5/mesa3d-22.3.5-release-msvc.7z -OutFile mesa3d.7z
& 'C:\Program Files\7-Zip\7z.exe' e -olib\node-v108 .\mesa3d.7z x64\opengl32.dll x64\libgallium_wgl.dll x64\libGLESv2.dll x64\libglapi.dll
& 'C:\Program Files\7-Zip\7z.exe' e -olib\node-v115 .\mesa3d.7z x64\opengl32.dll x64\libgallium_wgl.dll x64\libGLESv2.dll x64\libglapi.dll
npm test
# On PRs make sure that the npm package can be packaged.

View File

@@ -53,7 +53,7 @@ jobs:
fail-fast: false
matrix:
include:
- runs-on: ubuntu-20.04
- runs-on: ubuntu-22.04
arch: x86_64
- runs-on: [self-hosted, linux, ARM64]
arch: arm64
@@ -69,7 +69,7 @@ jobs:
needs: bump_version
continue-on-error: true
env:
BUILDTYPE: 'Release'
BUILDTYPE: "Release"
defaults:
run:
@@ -117,16 +117,13 @@ jobs:
sudo apt-get update
sudo apt-get install -y \
ccache \
cmake \
ninja-build \
pkg-config \
xvfb \
libcurl4-openssl-dev \
libglfw3-dev \
libuv1-dev \
g++-10 \
libc++-9-dev \
libc++abi-9-dev \
g++-12 \
libjpeg-dev \
libpng-dev \
libwebp-dev
@@ -135,7 +132,7 @@ jobs:
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 18
node-version: 20
- name: npm ci
run: npm ci --ignore-scripts
@@ -144,6 +141,20 @@ jobs:
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1
# Fixes an issue with the image causing builds to fail - https://github.com/actions/runner-images/issues/8598
- name: Remove Strawberry Perl from PATH (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
$env:PATH = $env:PATH -replace "C:\\Strawberry\\c\\bin;", ""
"PATH=$env:PATH" | Out-File -FilePath $env:GITHUB_ENV -Append
- name: Setup cmake (Linux)
if: runner.os == 'Linux' && runner.arch != 'arm64'
uses: jwlawson/actions-setup-cmake@v1.14
with:
cmake-version: "3.19.x"
- name: Set up ccache (MacOS/Linux)
if: runner.os == 'MacOS' || runner.os == 'Linux'
uses: hendrikmuhs/ccache-action@v1
@@ -158,13 +169,20 @@ jobs:
if: runner.os == 'Windows'
uses: hendrikmuhs/ccache-action@v1
with:
variant: 'sccache'
variant: "sccache"
key: ${{ matrix.runs-on }}-${{ env.BUILDTYPE }}-${{ github.job }}-${{ github.ref }}-${{ github.sha }}-${{ github.head_ref }}
restore-keys: |
${{ matrix.runs-on }}-${{ env.BUILDTYPE }}-${{ github.job }}-${{ github.ref }}-${{ github.sha }}
${{ matrix.runs-on }}-${{ env.BUILDTYPE }}-${{ github.job }}-${{ github.ref }}
${{ matrix.runs-on }}-${{ env.BUILDTYPE }}-${{ github.job }}
- name: Cache cmake-node-module deps
uses: actions/cache@v3
with:
# downloaded with platform/node/cmake/module.cmake
path: build/headers
key: ${{ runner.os }}-${{ runner.arch }}-cmake-node-module-deps
- name: Configure maplibre-native (MacOS)
if: runner.os == 'MacOS'
run: |
@@ -172,16 +190,19 @@ jobs:
-G Ninja \
-DCMAKE_BUILD_TYPE=${{ env.BUILDTYPE }} \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DMLN_WITH_NODE=ON
- name: Configure maplibre-native (Linux)
if: runner.os == 'Linux'
shell: bash -leo pipefail {0}
run: |
cmake . -B build \
-G Ninja \
-DCMAKE_BUILD_TYPE=${{ env.BUILDTYPE }} \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_C_COMPILER=gcc-10 \
-DCMAKE_CXX_COMPILER=g++-10
-DCMAKE_C_COMPILER=gcc-12 \
-DCMAKE_CXX_COMPILER=g++-12 \
-DMLN_WITH_NODE=ON
- name: "Create directory '${{ github.workspace }}/platform/windows/vendor/vcpkg/bincache' (Windows)"
if: runner.os == 'Windows'
@@ -207,7 +228,8 @@ jobs:
cmake . -B build \
-G Ninja \
-DCMAKE_BUILD_TYPE=${{ env.BUILDTYPE }} \
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache \
-DMLN_WITH_NODE=ON
- name: Build maplibre-native (MacOS/Linux)
if: runner.os == 'MacOS' || runner.os == 'Linux'
@@ -238,7 +260,7 @@ jobs:
./platform/node/scripts/publish.sh --target_arch=arm64
publish_npm:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
needs: publish_binaries
defaults:
@@ -257,7 +279,7 @@ jobs:
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 18
node-version: 20
- name: Publish to NPM (release)
if: github.ref == 'refs/heads/main' && (github.event.inputs.version == 'patch' || github.event.inputs.version == 'minor' || github.event.inputs.version == 'major')

View File

@@ -6,7 +6,7 @@ include(${CMAKE_CURRENT_LIST_DIR}/cmake/module.cmake)
add_node_module(
mbgl-node
INSTALL_PATH ${PROJECT_SOURCE_DIR}/lib/{node_abi}/mbgl.node
NAN_VERSION 2.17.0
NAN_VERSION 2.18.0
EXCLUDE_NODE_ABIS
46
47

View File

@@ -9,7 +9,7 @@ if [[ "${CIRCLE_TAG}" == "node-v${PACKAGE_JSON_VERSION}" ]] || [[ "${PUBLISH:-}"
# Changes to the version targets here should happen in tandem with updates to the
# EXCLUDE_NODE_ABIS property in cmake/node.cmake and the "node" engines property in
# package.json.
for TARGET in 14.0.0 16.0.0 18.0.0; do
for TARGET in 16.0.0 18.0.0 20.0.0; do
rm -rf build/stage
if [[ "${BUILDTYPE}" == "RelWithDebInfo" ]]; then

View File

@@ -53,7 +53,10 @@ void NodeRequest::New(const Nan::FunctionCallbackInfo<v8::Value>& info) {
Nan::Set(info.This(), Nan::New("kind").ToLocalChecked(), info[4]);
v8::Local<v8::Value> argv[] = {info.This()};
request->asyncResource->runInAsyncScope(
Nan::To<v8::Object>(target->handle()->GetInternalField(1)).ToLocalChecked(), "request", 1, argv);
Nan::To<v8::Object>(target->handle()->GetInternalField(1).As<v8::Value>()).ToLocalChecked(),
"request",
1,
argv);
info.GetReturnValue().Set(info.This());
}