Skip to content

ci: add smoke-test for various node version and package managers #471

ci: add smoke-test for various node version and package managers

ci: add smoke-test for various node version and package managers #471

Workflow file for this run

name: CI
on:
pull_request:
push:
branches:
- master
jobs:
Build:
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-20.04
- windows-2019
node_arch:
- x64
cpp_arch:
- x64
docker:
- ""
docker_cmd:
- ""
include:
- os: windows-2019
node_arch: ia32
cpp_arch: amd64_x86
# - os: windows-2022
# node_arch: x64
# arch: arm64
# cpp_arch: amd64_arm64
- os: macos-13
node_arch: x64
cpp_arch: x64
- os: macos-14
node_arch: arm64
cpp_arch: amd64_arm64
# Alpine
- os: ubuntu-22.04
docker: node:18-alpine
docker_cmd:
apk add --no-cache bash build-base curl git g++ make ninja-build
pkgconfig unzip zip python3 tar cmake ninja musl-dev && cp
/usr/lib/ninja-build/bin/ninja /usr/bin/ninja && npm i -g pnpm &&
pnpm install && pnpm run build
node_arch: x64
cpp_arch: x64
env:
npm_config_zmq_draft: false
npm_config_zmq_shared: false
npm_config_arch: ${{ matrix.node_arch }}
npm_config_target_arch: ${{ matrix.node_arch }}
setup_node_arch: ${{ matrix.node_arch }}
steps:
- uses: actions/checkout@v4
- name: Cache
uses: actions/cache@v4
with:
path: |
./node_modules/
~/vcpkg
key:
# prettier-ignore
"cache-OS:${{ matrix.os }}-arch:${{ matrix.node_arch}}-ZMQ_DRAFT:${{env.npm_config_zmq_draft }}-${{hashFiles('./package.json') }}"
restore-keys: |
"cache-OS:${{ matrix.os }}-arch:${{ matrix.node_arch }}-ZMQ_DRAFT:${{ env.npm_config_zmq_draft }}-"
- name: Env map
run: |
if [ "${{ matrix.node_arch }}" = "ia32" ]; then
echo "setup_node_arch=x86" > $GITHUB_ENV
fi
shell: bash
- name: Setup Cpp
if: ${{ !matrix.docker }}
uses: aminya/setup-cpp@v1
with:
vcvarsall: ${{ contains(matrix.os, 'windows') }}
cmake: true
ninja: true
python: true
vcpkg: true
architecture: ${{ matrix.cpp_arch }}
- name: Install Mac-OS x86_64 Dependencies
if: ${{ contains(matrix.os, 'macos') && matrix.node_arch == 'x64' }}
run: |
brew install libsodium gnutls
- name: Install Mac-OS arm64 Dependencies
if: ${{ contains(matrix.os, 'macos') && matrix.node_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
- uses: pnpm/action-setup@v4
if: ${{ !matrix.docker }}
- name: Install Node 20
if: ${{ !matrix.docker }}
uses: actions/setup-node@v4
with:
node-version: 20
architecture: ${{ env.setup_node_arch }}
- name: Install and Build Native
if: ${{ !matrix.docker }}
run: pnpm install
- name: Build JavaScript
if: ${{ !matrix.docker }}
run: pnpm run build.js
- name: Install Node 10
if: ${{ !matrix.docker && matrix.os != 'macos-14' }}
uses: actions/setup-node@v4
with:
node-version: 10
architecture: ${{ env.setup_node_arch }}
- name: Build Native
if: ${{ !matrix.docker && matrix.node_arch != 'ia32' }}
run: npm run build.native
- name: Build Native Windows 32
if: ${{ matrix.os == 'windows-2019' && matrix.node_arch == 'ia32' }}
run:
node ./node_modules/@aminya/cmake-ts/build/main.js named-configs
windows-x86
- name: Use Node 20
if: ${{ !matrix.docker }}
uses: actions/setup-node@v4
with:
node-version: 20
architecture: ${{ env.setup_node_arch }}
- name: Prebuild Docker
if: ${{ matrix.docker }}
run: |
docker login -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} ghcr.io
docker pull ${{ matrix.docker }}
docker tag ${{ matrix.docker }} builder
docker run --volume ${{ github.workspace }}:/app --workdir /app --privileged builder sh -c "${{ matrix.docker_cmd }}"
- name: Upload build
uses: actions/upload-artifact@v4
with:
path: ./build
name: build-${{ strategy.job-index }}
overwrite: true
- name: Lint
if: "${{ contains(matrix.os, 'ubuntu') && !matrix.docker }}"
run: pnpm run lint-test
- name: Test
if: ${{ !matrix.docker }}
uses: nick-fields/retry@v3
with:
timeout_minutes: 5
max_attempts: 1
command: |
pnpm run test
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
xvfb-run --auto-servernum pnpm run test.electron.main
continue-on-error: true
Package:
runs-on: ubuntu-latest
needs: Build
steps:
- name: Merge Artifacts
uses: actions/upload-artifact/merge@v4
with:
name: build
pattern: build-*
delete-merged: true
- uses: actions/checkout@v4
- name: Place build
uses: actions/download-artifact@v4
with:
name: build
path: ./build
- name: Install Node
uses: actions/setup-node@v4
with:
node-version-file: "./.nvmrc"
- name: Install Pnpm
uses: pnpm/action-setup@v4
- name: Pack Zeromq
run: |
pnpm install
pnpm pack
- name: Upload Pack
uses: actions/upload-artifact@v4
with:
path: ./*.tgz
name: pack
overwrite: true
SmokeTest:
runs-on: ${{ matrix.os }}
needs: Package
strategy:
fail-fast: false
matrix:
os:
- ubuntu-24.04
- windows-2022
- macos-14
- macos-13
node-version:
# - 10
- 22
steps:
- name: Download Pack
uses: actions/download-artifact@v4
with:
name: pack
- name: Install Node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install Yarn 2
if: matrix.node-version == 10
run: |
npm i -g yarn@^2
- name: Install Yarn Latest
if: matrix.node-version == 22
run: |
npm i -g yarn@latest
- name: Install Pnpm 5
if: matrix.node-version == 10
uses: pnpm/action-setup@v4
with:
version: 5
- name: Install Pnpm 9
if: matrix.node-version == 22
uses: pnpm/action-setup@v4
with:
version: 9
- uses: actions/checkout@v4
- name: Smoke Test
run: bash ./script/smoke-test.bash