Skip to content

add support for NodeJS v21 (#77) #263

add support for NodeJS v21 (#77)

add support for NodeJS v21 (#77) #263

Workflow file for this run

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-latest, target: "macos", arch: "x64" }
- { os: macos-latest, target: "macos", arch: "arm64" }
node_ver: [ 16, 18, 19, 20, 21]
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: 'recursive'
# token: ${{ secrets.ZITI_CI_GH_TOKEN }}
- 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@latest
- name: Run VCPKG
uses: lukka/run-vcpkg@v11
with:
# tag: 2023.10.19
vcpkgGitCommitId: '8eb57355a4ffb410a2e94c07b4dca2dffbee8e50'
- name: gcc version
run: |
gcc --version
- name: cmake version
run: |
cmake --version
- name: ninja version
run: |
ninja --version
- name: node version
run: |
node --version
- name: npm version
run: |
npm --version
- name: Build NodeJS-SDK
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: 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/[email protected]
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/')