Skip to content

Node Build

Node Build #61

Workflow file for this run

name: Node Build
on:
workflow_dispatch:
inputs:
node_tag:
description: 'The tag of node to build'
required: true
default: v20.11.0
push:
tags:
- 'node'
permissions: write-all
defaults:
run:
shell: bash
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, windows-latest, macos-latest]
with-intl: [none, small-icu, full-icu]
include:
# linux
- os: ubuntu-20.04
with-intl: none
platform: linux
arch: x64
# - os: ubuntu-20.04
# with-intl: system-icu
# platform: linux
# arch: x64
- os: ubuntu-20.04
with-intl: small-icu
platform: linux
arch: x64
- os: ubuntu-20.04
with-intl: full-icu
platform: linux
arch: x64
# macos
- os: macos-latest
with-intl: none
platform: macos
arch: x64
# - os: macos-latest
# with-intl: system-icu
# platform: macos
# arch: x64
- os: macos-latest
with-intl: small-icu
platform: macos
arch: x64
- os: macos-latest
with-intl: full-icu
platform: macos
arch: x64
# windows
- os: windows-latest
with-intl: none
platform: windows
arch: x64
# - os: windows-latest
# with-intl: system-icu
# platform: windows
# arch: x64
- os: windows-latest
with-intl: small-icu
platform: windows
arch: x64
- os: windows-latest
with-intl: full-icu
platform: windows
arch: x64
steps:
- uses: actions/checkout@v3
- name: Checkout node for building
run: |
# when triggered by push, node_tag is empty, so use default tag
tag_name=${{ github.event.inputs.node_tag }}; if [ -z $tag_name ]; then tag_name='v20.11.0'; fi
echo "tag_name=$tag_name" >> "$GITHUB_ENV"
git clone -b $tag_name https://github.com/nodejs/node.git
cd node
git status
git branch
git log -1
- name: Install ubuntu deps
if: startsWith(matrix.os, 'ubuntu')
run: |
ls /usr/bin/gcc*
sudo update-alternatives --list gcc || true
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 10
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 10
sudo update-alternatives --list gcc || true
gcc -v
sudo apt update -y
sudo apt install -y build-essential python3 python3-pip make libicu-dev
- name: Install macos deps
if: startsWith(matrix.os, 'macos')
run: |
brew update
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 brew install icu4c pkg-config make
- name: Install windows deps
if: startsWith(matrix.os, 'windows')
run: |
choco upgrade chocolatey -y
choco install nasm vswhere
- name: Initialization for ${{ env.tag_name }} ...
run: |
echo ok!
- name: Install Visual Studio 2022 Community 17.9.7.0
if: startsWith(matrix.os, 'windows')
run: |
# https://github.com/actions/runner-images/issues/9154
choco upgrade visualstudio2022enterprise
# https://community.chocolatey.org/packages/visualstudio2022community/117.9.7.0
choco install visualstudio2022community --version=117.9.7.0
# https://community.chocolatey.org/packages/visualstudio2022buildtools/117.9.7.0
choco install visualstudio2022buildtools --version=117.9.7.0
# https://github.com/nodejs/node/blob/main/tools/bootstrap/windows_boxstarter#L21C15-L21C48
# choco install visualstudio2022-workload-vctools -y --params="--add Microsoft.VisualStudio.Component.VC.Tools.ARM64 --add Microsoft.VisualStudio.Component.VC.ATL.ARM64"
- name: Disable the default VS2022 Enterprise
if: startsWith(matrix.os, 'windows')
run: |
move "C:\Program Files\Microsoft Visual Studio\2022\Enterprise" "C:\Program Files\Microsoft Visual Studio\2022\Enterprise.default"
shell: cmd
- name: Checking VS product path ...
if: startsWith(matrix.os, 'windows')
continue-on-error: true
run: |
vswhere -products * -requires Microsoft.Component.MSBuild -property installationPath
shell: cmd
- name: Building for linux ...
if: startsWith(matrix.os, 'ubuntu')
run: |
./configure --with-intl=${{ matrix.with-intl }}
make -j$(nproc)
working-directory: node
- name: Building for macos ...
if: startsWith(matrix.os, 'macos')
run: |
# https://github.com/memkind/memkind/issues/33#issuecomment-540614162
echo "macos: sysctl -n hw.physicalcpu: $(sysctl -n hw.physicalcpu)"
echo "macos: sysctl -n hw.logicalcpu: $(sysctl -n hw.logicalcpu)"
echo "macos: getconf _NPROCESSORS_ONLN: $(getconf _NPROCESSORS_ONLN)"
./configure --with-intl=${{ matrix.with-intl }}
make -j$(getconf _NPROCESSORS_ONLN)
working-directory: node
- name: Building for windows ...
if: startsWith(matrix.os, 'windows')
run: |
set DEBUG_HELPER=1
set VSINSTALLDIR=C:\Program Files\Microsoft Visual Studio\2022\Community\
@REM call "C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\VsDevCmd.bat"
@REM call "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvarsall.bat" amd64
call "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\\Auxiliary\Build\vcvarsall.bat" amd64
@REM call "C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\Common7\Tools\VsDevCmd.bat"
@REM if with-intl is none, then use intl-none as build argument
set intl=${{ matrix.with-intl }}
if "%intl%" == "none" (
set intl=intl-none
)
.\vcbuild.bat ${{ matrix.arch }} ltcg %intl%
working-directory: node
shell: cmd
- name: Inspecting ...
run: |
ls -lR out
working-directory: node
- name: Prepare on windows ...
if: matrix.os != 'windows-latest'
run: |
cp node/out/Release/node node-${{ matrix.platform }}-${{ matrix.arch }}-${{ env.tag_name }}-with-intl-${{ matrix.with-intl }}
- name: Prepare on ubuntu ...
if: matrix.os == 'windows-latest'
run: |
cp node/out/Release/node.exe node-${{ matrix.platform }}-${{ matrix.arch }}-${{ env.tag_name }}-with-intl-${{ matrix.with-intl }}.exe
- name: Release
uses: softprops/action-gh-release@v1
with:
files: node-*
tag_name: node
release_name: node