Node x64 release workflow (#378)
This commit is contained in:
185
.github/workflows/node-release.yml
vendored
Normal file
185
.github/workflows/node-release.yml
vendored
Normal file
@@ -0,0 +1,185 @@
|
||||
name: node-release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
description: Choose a release type
|
||||
required: true
|
||||
type: choice
|
||||
options:
|
||||
- prerelease
|
||||
- patch
|
||||
- minor
|
||||
- major
|
||||
|
||||
jobs:
|
||||
bump_version:
|
||||
runs-on: ubuntu-20.04
|
||||
|
||||
defaults:
|
||||
run:
|
||||
working-directory: ./
|
||||
shell: bash
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 18
|
||||
|
||||
- name: Bump Version
|
||||
run: |
|
||||
git config user.name github-actions
|
||||
git config user.email github-actions@github.com
|
||||
npm version ${{ github.event.inputs.version }} --preid pre -m "Update node version to (${{ github.event.inputs.version }})"
|
||||
git push
|
||||
|
||||
build:
|
||||
strategy:
|
||||
matrix:
|
||||
os:
|
||||
- macos-12
|
||||
- ubuntu-20.04
|
||||
node: [ 10, 14, 16, 18 ]
|
||||
name: OS ${{ matrix.os }} Node ${{ matrix.node }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
needs: bump_version
|
||||
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 Latest Version
|
||||
run: git pull
|
||||
|
||||
- name: Install dependencies
|
||||
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 glfw3 || brew install glfw3
|
||||
brew list libuv || brew install libuv
|
||||
|
||||
- name: Install dependencies
|
||||
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: Setup node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: ${{ matrix.node }}
|
||||
|
||||
- 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@v2
|
||||
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 }} -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'
|
||||
run: |
|
||||
cmake . -B build -G Ninja -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -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: Test
|
||||
if: runner.os == 'Linux'
|
||||
run: xvfb-run --auto-servernum npm test
|
||||
|
||||
- name: Test
|
||||
if: runner.os == 'macOS'
|
||||
run: npm test
|
||||
|
||||
- name: Pack
|
||||
if: github.ref != 'refs/heads/main'
|
||||
run: |
|
||||
npm pack --dry-run
|
||||
|
||||
- name: Publish Release to Github
|
||||
if: github.ref == 'refs/heads/main'
|
||||
run: |
|
||||
npm run package
|
||||
npm run release
|
||||
env:
|
||||
NODE_PRE_GYP_GITHUB_TOKEN: ${{ secrets.CR_PAT }}
|
||||
|
||||
- name: Publish to NPM (release)
|
||||
if: matrix.os == 'ubuntu-20.04' && matrix.node == '18' && github.ref == 'refs/heads/main' && github.event.inputs.version != 'prerelease'
|
||||
run: |
|
||||
npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN}
|
||||
npm publish --access public
|
||||
env:
|
||||
NPM_TOKEN: ${{ secrets.NPM_ORG_TOKEN }}
|
||||
|
||||
- name: Publish to NPM (prerelease)
|
||||
if: matrix.os == 'ubuntu-20.04' && matrix.node == '18' && github.ref == 'refs/heads/main' && github.event.inputs.version == 'prerelease'
|
||||
run: |
|
||||
npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN}
|
||||
npm publish --tag next --access public
|
||||
env:
|
||||
NPM_TOKEN: ${{ secrets.NPM_ORG_TOKEN }}
|
||||
|
||||
Reference in New Issue
Block a user