Test with all supported node versions #307
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
pull_request: | |
push: | |
branches: | |
- master | |
jobs: | |
Build: | |
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }} | |
runs-on: ${{ matrix.os }} | |
container: ${{ matrix.docker }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
# - ubuntu-22.04 | |
- ubuntu-20.04 | |
- windows-2022 | |
node_version: [10, 12, 14, 16, 18, 20, 22] | |
node_arch: | |
- x64 | |
cpp_arch: | |
- x64 | |
ARCH: | |
- x64 | |
zmq_draft: | |
- false | |
docker: | |
- "" | |
include: | |
# https://pnpm.io/installation#compatibility | |
- {node_version: 10, pnpm_version: 6} | |
- {node_version: 12, pnpm_version: 6} | |
- {node_version: 14, pnpm_version: 7} | |
- {node_version: 16, pnpm_version: 8} | |
- {node_version: 18, pnpm_version: 9} | |
- {node_version: 20, pnpm_version: 9} | |
- {node_version: 22, pnpm_version: 9} | |
- os: windows-2022 | |
node_version: 18 | |
node_arch: x86 | |
ARCH: x86 | |
cpp_arch: amd64_x86 | |
zmq_draft: false | |
# - os: windows-2022 | |
# node_version: 18 | |
# node_arch: x64 | |
# ARCH: arm64 | |
# cpp_arch: amd64_arm64 | |
# zmq_draft: false | |
- os: macos-13 | |
node_version: 18 | |
node_arch: x64 | |
ARCH: x86_64 | |
cpp_arch: x64 | |
zmq_draft: false | |
- os: macos-13 | |
node_version: 18 | |
node_arch: x64 | |
ARCH: arm64 | |
cpp_arch: amd64_arm64 | |
zmq_draft: false | |
# Alpine | |
- os: ubuntu-22.04 | |
docker: node:18-alpine | |
node_version: 18 | |
node_arch: x64 | |
ARCH: x64 | |
cpp_arch: x64 | |
zmq_draft: false | |
env: | |
ZMQ_DRAFT: ${{ matrix.zmq_draft }} | |
ZMQ_SHARED: false | |
ARCH: ${{ matrix.ARCH }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
./node_modules/ | |
./build/ | |
key: | |
"cache-OS:${{ matrix.os }}-arch:${{ matrix.node_arch | |
}}-ZMQ_DRAFT:${{ matrix.zmq_draft }}-Node:${{ matrix.node_version | |
}}-${{ hashFiles('./package.json') }}" | |
restore-keys: | | |
"cache-OS:${{ matrix.os }}-arch:${{ matrix.node_arch }}-ZMQ_DRAFT:${{ matrix.zmq_draft }}-Node:${{ matrix.node_version }}-" | |
- name: Setup Cpp | |
if: ${{ !matrix.docker }} | |
uses: aminya/setup-cpp@v1 | |
with: | |
vcvarsall: ${{ contains(matrix.os, 'windows') }} | |
cmake: true | |
python: true | |
architecture: ${{ matrix.cpp_arch }} | |
- uses: pnpm/action-setup@v4 | |
if: ${{ !matrix.docker }} | |
with: | |
version: ${{ matrix.pnpm_version }} | |
- name: Install Node | |
if: ${{ !matrix.docker }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node_version }} | |
architecture: ${{ matrix.node_arch }} | |
- name: Install Mac-OS x86_64 Dependencies | |
if: ${{ contains(matrix.os, 'macos') && matrix.ARCH == 'x86_64' }} | |
run: | | |
brew install libsodium gnutls | |
- name: Install Mac-OS arm64 Dependencies | |
if: ${{ contains(matrix.os, 'macos') && matrix.ARCH == 'arm64' }} | |
run: | | |
brew uninstall libsodium --force --ignore-dependencies | |
source ./script/macos-arm-deps.sh | |
echo "PATH=$PATH" >> $GITHUB_ENV | |
echo "PKG_CONFIG_PATH=$PKG_CONFIG_PATH" >> $GITHUB_ENV | |
echo "npm_config_target_arch=$npm_config_target_arch" >> $GITHUB_ENV | |
- name: Install Dependencies and Build | |
if: ${{ !matrix.docker }} | |
run: pnpm install | |
- name: Prebuild | |
if: ${{ !matrix.docker }} | |
run: pnpm run build.prebuild | |
- name: Prebuild Docker | |
if: ${{ matrix.docker }} | |
run: | | |
apk add --no-cache pkgconfig curl tar python3 make gcc g++ cmake | |
musl-dev && npm i -g pnpm@${{ matrix.pnpm_version }} && pnpm install && pnpm run build.prebuild | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
path: ./prebuilds | |
- name: Lint | |
if: "${{ contains(matrix.os, 'ubuntu') && !matrix.docker }}" | |
run: pnpm run lint-test | |
- name: Test (Debug) | |
if: ${{ !matrix.docker }} | |
uses: nick-fields/retry@v3 | |
with: | |
timeout_minutes: 5 | |
max_attempts: 1 | |
command: | | |
pnpm run clean | |
pnpm run test.skip_gc_tests | |
continue-on-error: true | |
- name: Test Electron (Main) | |
if: "${{ contains(matrix.os, 'ubuntu') && !matrix.docker }}" | |
uses: nick-fields/retry@v3 | |
with: | |
timeout_minutes: 5 | |
max_attempts: 1 | |
command: | | |
sudo apt-get install xvfb | |
pnpm install -g electron@latest | |
pnpm run clean | |
xvfb-run --auto-servernum pnpm run test.electron.main | |
continue-on-error: true | |
- name: Tests + GC Tests (Release) | |
if: ${{ !matrix.docker }} | |
uses: nick-fields/retry@v3 | |
with: | |
timeout_minutes: 5 | |
max_attempts: 1 | |
command: | | |
pnpm run clean | |
pnpm run test | |
continue-on-error: true |