Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
306 lines
11 KiB
YAML
306 lines
11 KiB
YAML
name: node-ci
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches:
|
|
- main
|
|
- topic/drawable
|
|
- node-*.*.x
|
|
tags:
|
|
- "node-*"
|
|
paths:
|
|
- CMakeLists.txt
|
|
- "platform/linux/**"
|
|
- "platform/default/**"
|
|
- "platform/node/**"
|
|
- "platform/windows/**"
|
|
- "platform/darwin/**"
|
|
- "platform/macos/**"
|
|
- "platform/ios/platform/darwin/**"
|
|
- "platform/ios/platform/macos/**"
|
|
- ".github/workflows/node-ci.yml"
|
|
- "bin/**"
|
|
- "expression-test/**"
|
|
- "include/**"
|
|
- "metrics/**"
|
|
- "render-test/**"
|
|
- "scripts/**"
|
|
- "src/**"
|
|
- "test/**"
|
|
- "vendor/**"
|
|
- ".gitmodules"
|
|
- "!**/*.md"
|
|
- "package.json"
|
|
- "package-lock.json"
|
|
|
|
pull_request:
|
|
branches:
|
|
- "*"
|
|
paths:
|
|
- CMakeLists.txt
|
|
- "platform/linux/**"
|
|
- "platform/default/**"
|
|
- "platform/node/**"
|
|
- "platform/windows/**"
|
|
- "platform/darwin/**"
|
|
- "platform/macos/**"
|
|
- "platform/ios/platform/darwin/**"
|
|
- "platform/ios/platform/macos/**"
|
|
- ".github/workflows/node-ci.yml"
|
|
- "bin/**"
|
|
- "expression-test/**"
|
|
- "include/**"
|
|
- "metrics/**"
|
|
- "render-test/**"
|
|
- "scripts/**"
|
|
- "src/**"
|
|
- "test/**"
|
|
- "vendor/**"
|
|
- ".gitmodules"
|
|
- "!**/*.md"
|
|
- "package.json"
|
|
- "package-lock.json"
|
|
|
|
concurrency:
|
|
# cancel jobs on PRs only
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ${{ matrix.runs-on }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- runs-on: ubuntu-24.04
|
|
arch: x86_64
|
|
- runs-on: ubuntu-24.04-arm
|
|
arch: arm64
|
|
- runs-on: macos-15-intel
|
|
arch: x86_64
|
|
- runs-on: macos-15
|
|
arch: arm64
|
|
- runs-on: windows-2022
|
|
arch: x86_64
|
|
- runs-on: windows-11-arm
|
|
arch: arm64
|
|
continue-on-error: true
|
|
env:
|
|
BUILDTYPE: "Release"
|
|
|
|
defaults:
|
|
run:
|
|
working-directory: ./
|
|
shell: bash
|
|
|
|
steps:
|
|
- if: runner.os == 'Windows'
|
|
run: git config --global core.longpaths true
|
|
|
|
- name: Checkout
|
|
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v4
|
|
with:
|
|
submodules: recursive
|
|
persist-credentials: false
|
|
|
|
- name: Get OS Architecture
|
|
if: runner.os == 'MacOS' || runner.os == 'Linux'
|
|
run: uname -m
|
|
|
|
- name: Install dependencies (MacOS)
|
|
if: runner.os == 'MacOS'
|
|
env:
|
|
HOMEBREW_NO_AUTO_UPDATE: 1
|
|
HOMEBREW_NO_INSTALL_CLEANUP: 1
|
|
run: |
|
|
brew list ccache || brew install ccache
|
|
brew list ninja || brew install ninja
|
|
brew list pkg-config || brew install pkg-config
|
|
brew list glfw || brew install glfw
|
|
brew list libuv || brew install libuv
|
|
|
|
- name: Install dependencies (Linux)
|
|
if: runner.os == 'Linux'
|
|
env:
|
|
DEBIAN_FRONTEND: noninteractive
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y \
|
|
ccache \
|
|
ninja-build \
|
|
pkg-config \
|
|
xvfb \
|
|
libcurl4-openssl-dev \
|
|
libglfw3-dev \
|
|
libuv1-dev \
|
|
libjpeg-dev \
|
|
libpng-dev \
|
|
libwebp-dev
|
|
/usr/sbin/update-ccache-symlinks
|
|
|
|
- name: Use Node.js from nvmrc
|
|
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v4
|
|
with:
|
|
node-version-file: 'platform/node/.nvmrc'
|
|
|
|
- name: npm ci
|
|
working-directory: platform/node
|
|
run: npm ci --ignore-scripts
|
|
|
|
- name: Set up msvc dev cmd (Windows x64)
|
|
if: runner.os == 'Windows' && matrix.arch == 'x86_64'
|
|
uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1
|
|
|
|
- name: Set up msvc dev cmd (Windows ARM64)
|
|
if: runner.os == 'Windows' && matrix.arch == 'arm64'
|
|
uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1
|
|
with:
|
|
arch: amd64_arm64
|
|
|
|
- name: Test VSCMD_ARG_TGT_ARCH Environment
|
|
if: runner.os == 'Windows'
|
|
run: |
|
|
echo "VSCMD_ARG_TGT_ARCH=%VSCMD_ARG_TGT_ARCH%"
|
|
shell: cmd
|
|
|
|
- name: cmake version
|
|
run: |
|
|
cmake --version
|
|
|
|
- name: Set up ccache (MacOS/Linux)
|
|
if: runner.os == 'MacOS' || runner.os == 'Linux'
|
|
uses: hendrikmuhs/ccache-action@5ebbd400eff9e74630f759d94ddd7b6c26299639 # v1.2.20
|
|
with:
|
|
key: ${{ matrix.runs-on }}-${{ matrix.arch }}-${{ env.BUILDTYPE }}-${{ github.job }}-${{ github.sha }}
|
|
restore-keys: |
|
|
${{ matrix.runs-on }}-${{ matrix.arch }}-${{ env.BUILDTYPE }}-${{ github.job }}-${{ github.ref }}-${{ github.sha }}
|
|
${{ matrix.runs-on }}-${{ matrix.arch }}-${{ env.BUILDTYPE }}-${{ github.job }}-${{ github.ref }}
|
|
${{ matrix.runs-on }}-${{ matrix.arch }}-${{ env.BUILDTYPE }}-${{ github.job }}
|
|
${{ matrix.runs-on }}-${{ matrix.arch }}-${{ env.BUILDTYPE }}
|
|
|
|
- name: Set up ccache (Windows)
|
|
if: runner.os == 'Windows'
|
|
uses: hendrikmuhs/ccache-action@5ebbd400eff9e74630f759d94ddd7b6c26299639 # v1.2.20
|
|
with:
|
|
variant: "sccache"
|
|
key: ${{ matrix.runs-on }}-${{ matrix.arch }}-${{ env.BUILDTYPE }}-${{ github.job }}-${{ github.sha }}
|
|
restore-keys: |
|
|
${{ matrix.runs-on }}-${{ matrix.arch }}-${{ env.BUILDTYPE }}-${{ github.job }}-${{ github.ref }}-${{ github.sha }}
|
|
${{ matrix.runs-on }}-${{ matrix.arch }}-${{ env.BUILDTYPE }}-${{ github.job }}-${{ github.ref }}
|
|
${{ matrix.runs-on }}-${{ matrix.arch }}-${{ env.BUILDTYPE }}-${{ github.job }}
|
|
${{ matrix.runs-on }}-${{ matrix.arch }}-${{ env.BUILDTYPE }}
|
|
|
|
- name: Cache cmake-node-module deps
|
|
uses: actions/cache@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5.0.2
|
|
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: |
|
|
cmake --preset macos-metal-node -DCMAKE_BUILD_TYPE=${{ env.BUILDTYPE }}
|
|
|
|
- name: Configure maplibre-native (Linux)
|
|
if: runner.os == 'Linux'
|
|
run: |
|
|
cmake --preset linux-opengl-node -DCMAKE_BUILD_TYPE=${{ env.BUILDTYPE }}
|
|
|
|
- name: Get vcpkg commit id
|
|
if: runner.os == 'Windows'
|
|
shell: pwsh
|
|
run: |
|
|
$vcpkg_commit_id = ($(git submodule status .\platform\windows\vendor\vcpkg).Trim() -split ' ')[0]
|
|
Add-Content -Path $env:GITHUB_ENV -Value "VCPKG_COMMIT_ID=${vcpkg_commit_id}"
|
|
|
|
- name: Restore vcpkg binary cache
|
|
if: runner.os == 'Windows'
|
|
uses: actions/cache/restore@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5.0.2
|
|
with:
|
|
path: ${{ github.workspace }}\platform\windows\vendor\vcpkg\archives
|
|
key: vcpkg-${{ env.VCPKG_COMMIT_ID }}
|
|
|
|
- name: Configure maplibre-native (Windows x64)
|
|
if: runner.os == 'Windows' && matrix.arch == 'x86_64'
|
|
shell: pwsh
|
|
env:
|
|
VCPKG_INSTALL_OPTIONS: "--debug"
|
|
VCPKG_BINARY_SOURCES: "clear;files,${{ github.workspace }}\\platform\\windows\\vendor\\vcpkg\\archives,readwrite"
|
|
run: |
|
|
cmake --preset windows-opengl-node -DCMAKE_BUILD_TYPE=${{ env.BUILDTYPE }}
|
|
|
|
- name: Configure maplibre-native (Windows arm64)
|
|
if: runner.os == 'Windows' && matrix.arch == 'arm64'
|
|
shell: pwsh
|
|
env:
|
|
VCPKG_INSTALL_OPTIONS: "--debug"
|
|
VCPKG_BINARY_SOURCES: "clear;files,${{ github.workspace }}\\platform\\windows\\vendor\\vcpkg\\archives,readwrite"
|
|
run: |
|
|
cmake --preset windows-arm64-opengl-node -DCMAKE_BUILD_TYPE=${{ env.BUILDTYPE }}
|
|
|
|
- name: Build maplibre-native (MacOS/Linux)
|
|
if: runner.os == 'MacOS' || runner.os == 'Linux'
|
|
run: |
|
|
cmake --build build -j "$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null)"
|
|
|
|
- name: Build maplibre-native (Windows)
|
|
if: runner.os == 'Windows'
|
|
run: |
|
|
cmake --build build
|
|
|
|
- name: Run render tests on macOS
|
|
id: render_tests
|
|
if: runner.os == 'macOS'
|
|
continue-on-error: ${{ runner.arch == 'X64' }}
|
|
run: ./build/mbgl-render-test-runner --manifestPath metrics/macos-xcode11-release-style.json
|
|
|
|
- name: Upload render test artifacts (MacOS)
|
|
if: runner.os == 'MacOS' && steps.render_tests.outcome == 'failure'
|
|
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
|
|
with:
|
|
name: render-query-test-results_${{ runner.os }}_${{ matrix.arch }}
|
|
path: metrics/macos-xcode11-release-style.html
|
|
|
|
- name: Test (Linux)
|
|
working-directory: platform/node
|
|
if: runner.os == 'Linux'
|
|
run: xvfb-run --auto-servernum npm test
|
|
|
|
- name: Test (MacOS)
|
|
if: runner.os == 'MacOS'
|
|
continue-on-error: true # flaky on CI
|
|
working-directory: platform/node
|
|
run: npm test
|
|
|
|
- name: Test (Windows x64)
|
|
if: runner.os == 'Windows' && matrix.arch == 'x86_64'
|
|
shell: pwsh
|
|
working-directory: platform/node
|
|
env:
|
|
LIBGL_ALWAYS_SOFTWARE: true
|
|
GALLIUM_DRIVER: llvmpipe
|
|
run: |
|
|
(Invoke-WebRequest https://api.github.com/repos/pal1000/mesa-dist-win/releases -Headers @{ Authorization = ('Bearer {0}' -f '${{ secrets.GITHUB_TOKEN }}') } | ConvertFrom-Json)[0].assets | Where-Object name -match 'mesa3d-.+-release-msvc\.7z' | foreach { Invoke-WebRequest $_.browser_download_url -OutFile mesa3d.7z }
|
|
& 'C:\Program Files\7-Zip\7z.exe' e -olib\node-v137 .\mesa3d.7z x64\opengl32.dll x64\libgallium_wgl.dll x64\libGLESv2.dll
|
|
npm test
|
|
|
|
- name: Test (Windows ARM64)
|
|
if: runner.os == 'Windows' && matrix.arch == 'arm64'
|
|
shell: pwsh
|
|
working-directory: platform/node
|
|
env:
|
|
LIBGL_ALWAYS_SOFTWARE: true
|
|
GALLIUM_DRIVER: llvmpipe
|
|
run: |
|
|
(Invoke-WebRequest https://api.github.com/repos/mmozeiko/build-mesa/releases -Headers @{ Authorization = ('Bearer {0}' -f '${{ secrets.GITHUB_TOKEN }}') } | ConvertFrom-Json)[0].assets | Where-Object name -match 'mesa-llvmpipe-arm64-.+\.7z' | foreach { Invoke-WebRequest $_.browser_download_url -OutFile mesa3d.7z }
|
|
& 'C:\Program Files\7-Zip\7z.exe' e -olib\node-v137 .\mesa3d.7z opengl32.dll libGLESv2.dll
|
|
npm test
|
|
# On PRs make sure that the npm package can be packaged.
|
|
- name: Pack
|
|
working-directory: platform/node
|
|
run: |
|
|
npm pack --dry-run
|