add nodejs v22 and v23 to build matrix #316
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: Build | |
on: | |
release: | |
types: [ published ] | |
push: | |
branches: [ main ] | |
paths-ignore: | |
- 'package.json' | |
- 'CHANGELOG.md' | |
pull_request: | |
branches: [ main ] | |
workflow_dispatch: | |
inputs: | |
tags: | |
required: false | |
description: 'Misc tags' | |
# cancel older, redundant runs of same workflow on same branch | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }} | |
cancel-in-progress: true | |
jobs: | |
# ------------------------------------------------------------------------------- | |
# Do a clean build, test, and publish | |
# ------------------------------------------------------------------------------- | |
build: | |
name: Build for Node-${{ matrix.node_ver }} ${{ matrix.config.target }}/${{ matrix.config.arch }} | |
runs-on: ${{ matrix.config.os }} | |
# container: ${{ matrix.config.container }} | |
env: | |
BUILD_NUMBER: ${{ github.run_number }} | |
AWS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
strategy: | |
matrix: | |
config: | |
- { os: windows-latest, target: "windows", arch: "x64" } | |
- { os: ubuntu-20.04, target: "linux", arch: "x64" } | |
- { os: ubuntu-20.04, target: "linux", arch: "arm64" } | |
- { os: macos-13, target: "macos", arch: "x64" } | |
- { os: macos-13, target: "macos", arch: "arm64" } | |
node_ver: [ 22 ] # scale down for now [ 16, 18, 19, 20, 21, 22, 23] | |
fail-fast: false | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
submodules: 'recursive' | |
# token: ${{ secrets.ZITI_CI_GH_TOKEN }} | |
- name: macOS tools | |
if: runner.os == 'macOS' | |
shell: bash | |
run: brew install autoconf autoconf-archive automake pkg-config | |
- name: Setup PkgConfig (Windows) | |
if: matrix.config.target == 'windows' | |
run: | | |
choco install pkgconfiglite | |
- name: Get crossbuild tools | |
if: matrix.config.target == 'linux' && matrix.config.arch != 'x64' | |
run: | | |
sudo apt update -y | |
sudo apt install -y crossbuild-essential-${{ matrix.config.arch }} | |
- name: Node Version | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node_ver }} | |
- name: Extract branch name | |
shell: bash | |
run: echo "branch=${GITHUB_REF#refs/heads/}" >> $GITHUB_OUTPUT | |
id: extract_branch | |
- name: Print branch name | |
shell: bash | |
run: | | |
echo "## branch name is: ${{ steps.extract_branch.outputs.branch }}" | |
- name: Get current date | |
id: date | |
run: echo "date=$(date)" >> $GITHUB_OUTPUT | |
- name: Install CMake/Ninja | |
uses: lukka/get-cmake@v3.30.1 | |
- name: Run VCPKG | |
uses: lukka/run-vcpkg@v11 | |
# will use baseline from vcpkg.json | |
with: | |
# get baseline from vcpkg | |
vcpkgJsonGlob: './vcpkg.json' | |
- name: show versions | |
run: | | |
echo ===== gcc ===== | |
gcc --version | |
echo ===== cmake ===== | |
cmake --version | |
echo "ninja: $(ninja --version)" | |
echo "node: $(node --version)" | |
echo "npm: $(npm --version)" | |
- name: restore dependencies cache | |
uses: actions/cache@v4 | |
with: | |
key: deps-${{ matrix.config.target }}-${{ matrix.config.arch }}-${{ hashFiles('./vcpkg.json') }} | |
path: './vcpkg/packages' | |
- name: Build NodeJS-SDK | |
id: buildSDK | |
run: | | |
cd ${{ runner.workspace }}/${{ github.event.repository.name }} | |
npm install | |
npm run build:package -- --target_arch=${{ matrix.config.arch }} | |
env: | |
PRESET: ci-${{ matrix.config.target }}-${{ matrix.config.arch }} | |
TARGET_ARCH: ${{ matrix.config.arch }} | |
BUILD_DATE: ${{ steps.date.outputs.date }} | |
- name: show build result | |
if: always() | |
run: echo build result ${{ steps.buildSDK.outcome }} | |
- name: debug build failure | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: build-logs-${{ matrix.config.target }}-${{ matrix.config.arch }} | |
path: | | |
./vcpkg/buildtrees/**/*.log | |
./build/**/*log | |
- name: Hello test | |
if: matrix.config.arch == 'x64' | |
run: | | |
node tests/hello.js | |
- name: upload artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ziti_nodejs_${{ matrix.config.target }}_${{ matrix.config.arch }}_nodev${{ matrix.node_ver }} | |
path: | | |
./build/Release/ziti_sdk_nodejs.node | |
if-no-files-found: error | |
- name: upload release bundle | |
uses: softprops/action-gh-release@v0.1.13 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
files: | | |
./build/stage/**/ziti_sdk_nodejs*.tar.gz | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
if: env.AWS_KEY_ID != '' && startsWith(github.ref, 'refs/tags/') | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: us-east-1 | |
- name: Publish Binary to S3 (for all OS's, Node versions, and architectures) | |
run: | | |
./node_modules/.bin/node-pre-gyp --target_arch=${{ matrix.config.arch }} unpublish publish | |
sleep 5 | |
if: startsWith(github.ref, 'refs/tags/') | |
- name: Install Binary | |
run: | | |
npm install --fallback-to-build=false | |
sleep 5 | |
if: startsWith(github.ref, 'refs/tags/') | |
- name: Fetch Binary info | |
if: env.AWS_KEY_ID != '' && startsWith(github.ref, 'refs/tags/') | |
run: | | |
./node_modules/.bin/node-pre-gyp info | |
- name: NPM Publish | |
uses: JS-DevTools/npm-publish@v1 | |
with: | |
token: ${{ secrets.NPM_TOKEN }} | |
access: public | |
if: | | |
matrix.config.os == 'ubuntu-20.04' && matrix.node_ver == '20' && matrix.config.arch == 'x64' && startsWith(github.ref, 'refs/tags/') |