Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
217 lines
5.8 KiB
YAML
217 lines
5.8 KiB
YAML
name: node-ci
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches:
|
|
- main
|
|
tags:
|
|
- 'node-*'
|
|
paths:
|
|
- 'platform/node/**'
|
|
- ".github/workflows/node-ci.yml"
|
|
- "bin/**"
|
|
- "expression-test/**"
|
|
- "include/**"
|
|
- "metrics/**"
|
|
- "platform/default/**"
|
|
- "render-test/**"
|
|
- "scripts/**"
|
|
- "src/**"
|
|
- "test/**"
|
|
- "vendor/**"
|
|
- maplibre-gl-js
|
|
- ".gitmodules"
|
|
- "!**/*.md"
|
|
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
paths:
|
|
- 'platform/node/**'
|
|
- ".github/workflows/node-ci.yml"
|
|
- "bin/**"
|
|
- "expression-test/**"
|
|
- "include/**"
|
|
- "metrics/**"
|
|
- "platform/default/**"
|
|
- "render-test/**"
|
|
- "scripts/**"
|
|
- "src/**"
|
|
- "test/**"
|
|
- "vendor/**"
|
|
- maplibre-gl-js
|
|
- ".gitmodules"
|
|
- "!**/*.md"
|
|
|
|
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-20.04
|
|
arch: x86_64
|
|
- runs-on: macos-12
|
|
arch: x86_64
|
|
- runs-on: macos-12-arm
|
|
arch: arm64
|
|
continue-on-error: true
|
|
env:
|
|
BUILDTYPE: ${{github.ref == 'refs/heads/main' && 'Release' || 'Debug'}}
|
|
|
|
defaults:
|
|
run:
|
|
working-directory: ./
|
|
shell: bash
|
|
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
submodules: recursive
|
|
fetch-depth: 0
|
|
|
|
- name: Get OS Architecture
|
|
run: uname -m
|
|
|
|
- name: Setup node
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: 18
|
|
|
|
- name: Install dependencies macOS
|
|
if: runner.os == 'macOS'
|
|
env:
|
|
HOMEBREW_NO_AUTO_UPDATE: 1
|
|
HOMEBREW_NO_INSTALL_CLEANUP: 1
|
|
run: |
|
|
brew list cmake || brew install cmake
|
|
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 \
|
|
cmake \
|
|
ninja-build \
|
|
pkg-config \
|
|
xvfb \
|
|
libcurl4-openssl-dev \
|
|
libglfw3-dev \
|
|
libuv1-dev \
|
|
g++-10 \
|
|
libc++-9-dev \
|
|
libc++abi-9-dev
|
|
/usr/sbin/update-ccache-symlinks
|
|
|
|
- name: npm ci
|
|
run: npm ci --ignore-scripts
|
|
|
|
- name: Prepare ccache
|
|
run: ccache --clear --set-config cache_dir=~/.ccache
|
|
|
|
- name: Cache ccache
|
|
uses: actions/cache@v3
|
|
env:
|
|
cache-name: ccache-v1
|
|
with:
|
|
path: ~/.ccache
|
|
key: ${{ env.cache-name }}-${{ matrix.os }}-${{ github.job }}-${{ github.ref }}-${{ github.sha }}-${{ github.head_ref }}
|
|
restore-keys: |
|
|
${{ env.cache-name }}-${{ matrix.os }}-${{ github.job }}-${{ github.ref }}-${{ github.sha }}
|
|
${{ env.cache-name }}-${{ matrix.os }}-${{ github.job }}-${{ github.ref }}
|
|
${{ env.cache-name }}-${{ matrix.os }}-${{ github.job }}
|
|
|
|
- name: Clear ccache statistics
|
|
run: |
|
|
ccache --zero-stats --set-config cache_dir=~/.ccache
|
|
ccache --max-size=2G --set-config cache_dir=~/.ccache
|
|
ccache --show-stats --set-config cache_dir=~/.ccache
|
|
|
|
- name: CMake
|
|
if: runner.os == 'MacOS'
|
|
run: |
|
|
cmake . -B build -G Ninja -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_BUILD_TYPE=${{ env.BUILDTYPE }}
|
|
|
|
- name: CMake
|
|
if: runner.os == 'Linux'
|
|
run: |
|
|
cmake . -B build -G Ninja -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_BUILD_TYPE=${{ env.BUILDTYPE }} -DCMAKE_C_COMPILER=gcc-10 -DCMAKE_CXX_COMPILER=g++-10
|
|
|
|
- name: Build
|
|
run: |
|
|
cmake --build build -j $(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null)
|
|
|
|
- name: Run render tests on macOS
|
|
if: runner.os == 'macOS'
|
|
run: ./build/mbgl-render-test-runner --manifestPath metrics/macos-xcode11-release-style.json
|
|
|
|
- name: Upload render test artifacts
|
|
uses: actions/upload-artifact@v3
|
|
if: always()
|
|
with:
|
|
name: render-query-test-results
|
|
path: metrics/macos-xcode11-release-style.html
|
|
|
|
- name: Test
|
|
if: runner.os == 'Linux'
|
|
run: xvfb-run --auto-servernum npm test
|
|
|
|
- name: Test
|
|
if: runner.os == 'macOS'
|
|
run: npm test
|
|
|
|
# On PRs make sure that the npm package can be packaged.
|
|
- name: Pack
|
|
if: github.ref != 'refs/heads/main'
|
|
run: |
|
|
npm pack --dry-run
|
|
|
|
test_linux_arm:
|
|
runs-on: macos-12-arm
|
|
name: test (ubuntu-20.04, arm64)
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
with:
|
|
submodules: recursive
|
|
fetch-depth: 0
|
|
|
|
- name: Install dependencies macOS
|
|
if: runner.os == 'macOS'
|
|
env:
|
|
HOMEBREW_NO_AUTO_UPDATE: 1
|
|
HOMEBREW_NO_INSTALL_CLEANUP: 1
|
|
run: |
|
|
brew install docker docker-compose
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v2
|
|
|
|
- name: Create the docker build image
|
|
uses: docker/build-push-action@v4
|
|
with:
|
|
context: .
|
|
platforms: linux/arm64
|
|
file: platform/node/scripts/Dockerfile_Build
|
|
tags: build
|
|
push: false
|
|
load: true
|
|
|
|
- name: Run the docker build image and create node libs
|
|
run: docker run --rm -v $(pwd):/data build
|