Improved node release workflow with arm support

This commit is contained in:
Andrew Calcutt
2022-09-23 19:31:08 -04:00
committed by GitHub
parent ab06f10217
commit b9a3931da4
5 changed files with 124 additions and 89 deletions

View File

@@ -73,14 +73,17 @@ concurrency:
jobs:
test:
runs-on: ${{ matrix.runs-on }}
strategy:
fail-fast: false
matrix:
os:
- macos-12
- ubuntu-20.04
node: [ 14, 16, 18 ]
name: OS ${{ matrix.os }} Node ${{ matrix.node }}
runs-on: ${{ matrix.os }}
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'}}
@@ -96,7 +99,15 @@ jobs:
submodules: recursive
fetch-depth: 0
- name: Install dependencies
- 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
@@ -109,7 +120,7 @@ jobs:
brew list glfw || brew install glfw
brew list libuv || brew install libuv
- name: Install dependencies
- name: Install dependencies Linux
if: runner.os == 'Linux'
env:
DEBIAN_FRONTEND: noninteractive
@@ -128,11 +139,6 @@ jobs:
libc++-9-dev \
libc++abi-9-dev
/usr/sbin/update-ccache-symlinks
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- name: npm ci
run: npm ci --ignore-scripts
@@ -159,7 +165,7 @@ jobs:
ccache --show-stats --set-config cache_dir=~/.ccache
- name: CMake
if: runner.os == 'macOS'
if: runner.os == 'MacOS'
run: |
cmake . -B build -G Ninja -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_BUILD_TYPE=${{ env.BUILDTYPE }} -DMBGL_WITH_COVERAGE=ON

View File

@@ -42,14 +42,17 @@ jobs:
git push
build:
runs-on: ${{ matrix.runs-on }}
strategy:
fail-fast: false
matrix:
os:
- macos-12
- ubuntu-20.04
node: [ 14, 16, 18 ]
name: OS ${{ matrix.os }} Node ${{ matrix.node }}
runs-on: ${{ matrix.os }}
include:
- runs-on: ubuntu-20.04
arch: x86_64
- runs-on: macos-12
arch: x86_64
- runs-on: macos-12-arm
arch: arm64
needs: bump_version
continue-on-error: true
env:
@@ -69,7 +72,15 @@ jobs:
- name: Get Latest Version
run: git pull
- name: Install dependencies
- 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
@@ -79,10 +90,10 @@ jobs:
brew list ccache || brew install ccache
brew list ninja || brew install ninja
brew list pkg-config || brew install pkg-config
brew list glfw3 || brew install glfw3
brew list glfw || brew install glfw
brew list libuv || brew install libuv
- name: Install dependencies
- name: Install dependencies Linux
if: runner.os == 'Linux'
env:
DEBIAN_FRONTEND: noninteractive
@@ -101,11 +112,6 @@ jobs:
libc++-9-dev \
libc++abi-9-dev
/usr/sbin/update-ccache-symlinks
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
- name: npm ci
run: npm ci --ignore-scripts
@@ -114,7 +120,7 @@ jobs:
run: ccache --clear --set-config cache_dir=~/.ccache
- name: Cache ccache
uses: actions/cache@v2
uses: actions/cache@v3
env:
cache-name: ccache-v1
with:
@@ -132,11 +138,9 @@ jobs:
ccache --show-stats --set-config cache_dir=~/.ccache
- name: CMake
if: runner.os == 'macOS'
if: runner.os == 'MacOS'
run: |
cmake . -B build -G Ninja -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_BUILD_TYPE=${{ env.BUILDTYPE }} -DMBGL_WITH_COVERAGE=ON
sed -i -e 's/$(ARCHS_STANDARD)/x86_64/g' build/build.ninja
sed -i -e 's/-arch arm64e/-arch x86_64/g' build/build.ninja
- name: CMake
if: runner.os == 'Linux'
@@ -147,26 +151,48 @@ jobs:
run: |
cmake --build build -j $(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null)
- name: Test
if: runner.os == 'Linux'
run: xvfb-run --auto-servernum npm test
#- name: Run render tests on macOS
# if: runner.os == 'macOS'
# run: ./build/mbgl-render-test-runner --manifestPath metrics/macos-xcode11-release-style.json
- name: Test
if: runner.os == 'macOS'
run: npm test
#- 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: Pack
if: github.ref != 'refs/heads/main'
run: |
npm pack --dry-run
#- name: Test
# if: runner.os == 'Linux'
# run: xvfb-run --auto-servernum npm test
- name: Publish Release to Github
if: github.ref == 'refs/heads/main'
run: |
npm run package
npm run release
#- name: Test
# if: runner.os == 'macOS' && matrix.arch != 'arm64'
# 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
- name: Publish X64 Release to Github
if: github.ref == 'refs/heads/main' && matrix.arch == 'x86_64'
env:
PUBLISH: true
BUILDTYPE: RelWithDebInfo
NODE_PRE_GYP_GITHUB_TOKEN: ${{ secrets.NODE_PRE_GYP_GITHUB_TOKEN }}
run: |
./platform/node/scripts/publish.sh
- name: Publish ARM Release to Github
if: github.ref == 'refs/heads/main' && matrix.arch == 'arm64'
env:
PUBLISH: true
BUILDTYPE: RelWithDebInfo
NODE_PRE_GYP_GITHUB_TOKEN: ${{ secrets.NODE_PRE_GYP_GITHUB_TOKEN }}
run: |
./platform/node/scripts/publish.sh --target_arch=arm64
- name: Publish to NPM (release)
if: matrix.os == 'ubuntu-20.04' && matrix.node == '18' && github.ref == 'refs/heads/main' && github.event.inputs.version != 'prerelease'
@@ -182,5 +208,4 @@ jobs:
npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN}
npm publish --tag next --access public
env:
NPM_TOKEN: ${{ secrets.NPM_ORG_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_ORG_TOKEN }}