Skip to content

prebuilds

prebuilds #55

Workflow file for this run

name: prebuilds
on:
workflow_dispatch:
inputs:
is_release:
description: "Set to true if a release version."
required: true
default: false
type: boolean
sha:
description: "The git SHA to use for release. Only set if needing to publish"
required: false
default: ""
type: string
version:
description: "The Release version. Allowed format: x.y.z"
required: false
default: ""
type: string
publish_dryrun:
description: "Set to true to in order to do a npm publish dry run."
required: false
default: false
type: boolean
npm_tag:
description: "The tag value to use to publish to npm."
required: false
default: ""
type: choice
options:
- ''
- dev
- beta
- rc
cxx_change:
description: "The PR number or SHA if wanting to build against a PR/SHA in the C++ SDK"
required: false
type: string
env:
DEFAULT_NODE: "18"
jobs:
validate-input:
runs-on: ubuntu-22.04
steps:
- name: If release, verify SHA is provided
if: inputs.is_release && inputs.sha == ''
run: |
echo "::error If releasing, must provide a SHA."
exit 1
- name: If release version, npm tag also provided
if: inputs.version != '' && inputs.npm_tag == ''
run: |
echo "::error If releasing by setting a release version, must provide a npm tag."
exit 1
lint:
runs-on: ubuntu-22.04
needs: validate-input
strategy:
matrix:
node-version: ["18.x"]
steps:
- uses: actions/checkout@v4
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Confirm Node version
run: node --version
- name: Install dependencies
run: |
npm ci --ignore-scripts
- name: Run lint
run: npm run lint
- name: Check deps & audit
if: inputs.is_release || inputs.version != ''
run: |
npm run check-deps
npm audit --omit=dev
sdist:
runs-on: ubuntu-22.04
needs: lint
outputs:
sdist_name: ${{ steps.create_sdist.outputs.sdist_name }}
ncbcc_version: ${{ steps.create_sdist.outputs.ncbcc_version }}
napi_version: ${{ steps.create_sdist.outputs.napi_version }}
steps:
- name: Checkout (with SHA)
if: inputs.sha != ''
uses: actions/checkout@v4
with:
ref: ${{ inputs.sha }}
submodules: recursive
fetch-depth: 0
fetch-tags: true
- name: Checkout (no SHA)
if: inputs.sha == ''
uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
fetch-tags: true
- name: Checkout pull-request
if: github.event_name == 'workflow_dispatch' && inputs.cxx_change != '' && startsWith(inputs.cxx_change, 'PR_')
run: |
cd deps/couchbase-cxx-client
git fetch origin pull/$(echo "$CXX_CHG" | cut -d'_' -f 2)/head:tmp
git checkout tmp
git log --oneline -n 10
env:
CXX_CHG: ${{ inputs.cxx_change }}
- name: Checkout branch
if: github.event_name == 'workflow_dispatch' && inputs.cxx_change != '' && startsWith(inputs.cxx_change, 'BR_')
run: |
cd deps/couchbase-cxx-client
git fetch origin
git --no-pager branch -r
git checkout $(echo "$CXX_CHG" | cut -d'_' -f 2)
git log --oneline -n 10
cd ../..
env:
CXX_CHG: ${{ inputs.cxx_change }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "18.x"
- name: Confirm Node.js version
run: node --version
- name: Install dependencies
run: |
npm ci --ignore-scripts
- name: Set CPM cache
run: npm run prebuild -- --configure --set-cpm-cache --use-boringssl
- name: Set version (from input)
if: inputs.version != ''
run: |
echo "NCBCC_VERSION=${{ inputs.version }}" >> $GITHUB_ENV
- name: Set version
if: inputs.version == '' && inputs.is_release
run: |
TMP_VERSION=$(node -e "console.log(JSON.parse(fs.readFileSync('package.json')).version)")
echo "NCBCC_VERSION=${TMP_VERSION%%-*}" >> $GITHUB_ENV
- name: Set version
if: inputs.version == '' && !inputs.is_release
run: |
TMP_VERSION=$(node -e "console.log(JSON.parse(fs.readFileSync('package.json')).version)")
echo "NCBCC_VERSION=$TMP_VERSION.${{ github.run_number }}" >> $GITHUB_ENV
- name: Create sdist with version
id: create_sdist
run: |
rm -rf ./build
node -e "var x = JSON.parse(fs.readFileSync('package.json')); x.version = '$NCBCC_VERSION'; fs.writeFileSync('package.json', JSON.stringify(x));"
node -e "var x = JSON.parse(fs.readFileSync('package-lock.json')); x.version = '$NCBCC_VERSION'; fs.writeFileSync('package-lock.json', JSON.stringify(x));"
NAPI_VERSION=$(node -p "JSON.parse(fs.readFileSync('package.json')).binary.napi_versions[0]")
echo "napi_version=$NAPI_VERSION" >> "$GITHUB_OUTPUT"
echo "NCBCC_VERSION=$NCBCC_VERSION"
echo "ncbcc_version=$NCBCC_VERSION" >> "$GITHUB_OUTPUT"
mkdir sdist
npm pack --pack-destination sdist
cd sdist
SDIST_NAME=$(find . -name '*.tgz' | cut -c 3- | rev | cut -c 5- | rev)
echo "SDIST_NAME=$SDIST_NAME"
echo "sdist_name=$SDIST_NAME" >> "$GITHUB_OUTPUT"
- name: Upload Node.js sdist
uses: actions/upload-artifact@v4
with:
retention-days: 1
name: ncbcc-sdist
path: |
./sdist/*.tgz
- name: Cleanup sdist
run: |
rm -rf sdist
- name: Create platPackage.json
run: |
curl -o platformPackages.js ${CI_SCRIPTS_URL}/ci_scripts/platformPackages.js
node platformPackages.js --create-platform-package-json
env:
CI_SCRIPTS_URL: "https://raw.githubusercontent.com/couchbaselabs/sdkbuild-jenkinsfiles/master/couchnode"
- name: Upload platform package.json
uses: actions/upload-artifact@v4
with:
retention-days: 1
name: ncbcc-platform-packagejson
path: |
./platPkg.json
- name: Create test requirements
run: |
mkdir ncbcc-lib
cd ncbcc-lib
cp ../tsconfig.json .
cp ../typedoc.json .
cp ../.npmignore .
cp -r ../lib .
ls -alh
- name: Upload docs requirements
uses: actions/upload-artifact@v4
with:
retention-days: 1
name: ncbcc-lib
path: |
./ncbcc-lib
linux-prebuilds:
needs: sdist
name: Build prebuild for linux on ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: ['ubuntu-22.04']
node-version: ["16"]
arch: ['x86_64', "arm64"]
steps:
- uses: actions/download-artifact@v4
with:
name: ncbcc-sdist
- name: Extract sdist source
run: |
ls -alh
SDIST_NAME=${{ needs.sdist.outputs.sdist_name }}
tar -xvzf $SDIST_NAME.tgz
cp -r package/** .
rm -rf package
- name: Set up QEMU
if: ${{ matrix.arch == 'arm64' }}
uses: docker/setup-qemu-action@v3
with:
platforms: arm64
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ github.job }}-linux-${{ matrix.arch }}-node${{ matrix.node-version }}
- name: Install dependencies & setup
run: |
npm install --omit=dev --ignore-scripts
mkdir -p output/prebuilds
mkdir -p output/prebuilds_debug
echo "BUILD_TYPE=RelWithDebInfo" >> $GITHUB_ENV
- name: Run in docker
uses: addnab/docker-run-action@v3
with:
image: jacasey/columnar-node${{ matrix.node-version }}-${{ matrix.arch }}:1.0.0
options: >-
--platform linux/${{ matrix.arch == 'x86_64' && 'amd64' || 'arm64'}}
-v ${{ github.workspace }}:/work
-e CN_BUILD_CONFIG=${{ env.BUILD_TYPE }}
-e CCACHE_DIR=/work/.ccache
-e CN_CACHE_OPTION=ccache
-e CN_VERBOSE_MAKEFILE=ON
run: |
node --version
cat /etc/os-release
ldd --version
ls -alh /work
cd /work
env
ARCH=$(node -p "process.arch")
PLATFORM=$(node -p "process.platform")
NAPI_VERSION=${{ needs.sdist.outputs.napi_version }}
NCBCC_VERSION=${{ needs.sdist.outputs.ncbcc_version }}
echo "Building binary for platform=$PLATFORM, n-api=$NAPI_VERSION, arch=$ARCH"
npm run prebuild -- --use-boringssl --parallel 4 --use-cmakejs-build
FILENAME="couchbase-columnar-v$NCBCC_VERSION-napi-$NAPI_VERSION-linux-$ARCH-boringssl"
cd build/$CN_BUILD_CONFIG
ls -alh
mv couchbase_impl.node $FILENAME.node
tar -cvzf $FILENAME-debug.tar.gz $FILENAME.node
mv $FILENAME-debug.tar.gz ../../output/prebuilds_debug
objcopy --only-keep-debug $FILENAME.node $FILENAME.debug.node
objcopy --strip-debug --strip-unneeded $FILENAME.node
objcopy --add-gnu-debuglink=$FILENAME.debug.node $FILENAME.node
rm $FILENAME.debug.node
ls -alh
cd ../..
mv build/$CN_BUILD_CONFIG/$FILENAME.node output/prebuilds
rm -rf build
- name: Upload prebuild
uses: actions/upload-artifact@v4
with:
retention-days: 1
name: linux-${{ matrix.arch }}-prebuild
path: |
./output/prebuilds/*.node
- name: Upload debug prebuild as artifact
uses: actions/upload-artifact@v4
with:
retention-days: 1
name: ncbcc-debug-artifact-linux-${{ matrix.arch }}-prebuild
path: |
./output/prebuilds_debug/*.tar.gz
alpine-prebuilds:
needs: sdist
name: Build prebuild for alpine on ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
os: ['ubuntu-22.04']
node-version: ["18"]
arch: ['x86_64', "arm64"]
steps:
- uses: actions/download-artifact@v4
with:
name: ncbcc-sdist
- name: Extract sdist source
run: |
ls -alh
SDIST_NAME=${{ needs.sdist.outputs.sdist_name }}
tar -xvzf $SDIST_NAME.tgz
cp -r package/** .
rm -rf package
- name: Set up QEMU
if: ${{ matrix.arch == 'arm64' }}
uses: docker/setup-qemu-action@v3
with:
platforms: arm64
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ github.job }}-alpine-${{ matrix.arch }}-node${{ matrix.node-version }}
- name: Create output directories
run: |
mkdir -p output/prebuilds
mkdir -p output/prebuilds_debug
echo "BUILD_TYPE=RelWithDebInfo" >> $GITHUB_ENV
- name: Run in docker
uses: addnab/docker-run-action@v3
with:
image: jacasey/columnar-alpine319-node${{ matrix.node-version }}-${{ matrix.arch }}:1.0.0
options: >-
--platform linux/${{ matrix.arch == 'x86_64' && 'amd64' || 'arm64'}}
-v ${{ github.workspace }}:/work
-e CN_BUILD_CONFIG=${{ env.BUILD_TYPE }}
-e CCACHE_DIR=/work/.ccache
-e CN_CACHE_OPTION=ccache
-e CN_VERBOSE_MAKEFILE=ON
run: |
node --version
cat /etc/os-release
ldd --version
ls -alh /work
cd /work
env
npm install --omit=dev --ignore-scripts
ARCH=$(node -p "process.arch")
PLATFORM=$(node -p "process.platform")
NAPI_VERSION=${{ needs.sdist.outputs.napi_version }}
NCBCC_VERSION=${{ needs.sdist.outputs.ncbcc_version }}
echo "Building binary for platform=$PLATFORM, n-api=$NAPI_VERSION, arch=$ARCH"
npm run prebuild -- --use-boringssl --parallel 4 --use-cmakejs-build
FILENAME="couchbase-columnar-v$NCBCC_VERSION-napi-$NAPI_VERSION-linuxmusl-$ARCH-boringssl"
cd build/$CN_BUILD_CONFIG
ls -alh
mv couchbase_impl.node $FILENAME.node
tar -cvzf $FILENAME-debug.tar.gz $FILENAME.node
mv $FILENAME-debug.tar.gz ../../output/prebuilds_debug
objcopy --only-keep-debug $FILENAME.node $FILENAME.debug.node
objcopy --strip-debug --strip-unneeded $FILENAME.node
objcopy --add-gnu-debuglink=$FILENAME.debug.node $FILENAME.node
rm $FILENAME.debug.node
ls -alh
cd ../..
mv build/$CN_BUILD_CONFIG/$FILENAME.node output/prebuilds
rm -rf build
- name: Upload prebuild
uses: actions/upload-artifact@v4
with:
retention-days: 1
name: linuxmusl-${{ matrix.arch }}-prebuild
path: |
./output/prebuilds/*.node
- name: Upload debug prebuild as artifact
uses: actions/upload-artifact@v4
with:
retention-days: 1
name: ncbcc-debug-artifact-linuxmusl-${{ matrix.arch }}-prebuild
path: |
./output/prebuilds_debug/*.tar.gz
macos-prebuilds:
needs: sdist
name: Build prebuild for macos on ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
include:
- os: macos-13
node-version: "18.x"
arch: "x86_64"
- os: macos-14
node-version: "18.x"
arch: "arm64"
steps:
- uses: actions/download-artifact@v4
with:
name: ncbcc-sdist
- name: Extract sdist source
run: |
ls -alh
SDIST_NAME=${{ needs.sdist.outputs.sdist_name }}
tar -xvzf $SDIST_NAME.tgz
cp -r package/** .
rm -rf $SDIST_NAME
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ github.job }}-macos-${{ matrix.arch }}-node${{ matrix.node-version }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Confirm Node version
run: |
node --version
node -p "process.arch"
- name: Install dependencies
run: |
npm install --omit=dev --ignore-scripts
mkdir -p output/prebuilds
mkdir -p output/prebuilds_debug
echo "BUILD_TYPE=RelWithDebInfo" >> $GITHUB_ENV
- name: Downgrade CMake
if: ${{ matrix.arch == 'x86_64' }}
run: |
brew uninstall cmake
mkdir ~/Downloads/CMake
curl --silent --location --retry 3 "https://github.com/Kitware/CMake/releases/download/v3.28.1/cmake-3.28.1-macos-universal.dmg" --output ~/Downloads/CMake/cmake-Darwin-x86_64.dmg
yes | PAGER=cat hdiutil attach -quiet -mountpoint /Volumes/cmake-Darwin-x86_64 ~/Downloads/CMake/cmake-Darwin-x86_64.dmg
cp -R /Volumes/cmake-Darwin-x86_64/CMake.app /Applications/
hdiutil detach /Volumes/cmake-Darwin-x86_64
sudo "/Applications/CMake.app/Contents/bin/cmake-gui" --install=/usr/local/bin
- name: Build binary
run: |
env
npm run prebuild -- --use-boringssl --parallel 4 --use-cmakejs-build
env:
CN_BUILD_CONFIG: ${{ env.BUILD_TYPE }}
CCACHE_DIR: .ccache
CN_CACHE_OPTION: ccache
CN_VERBOSE_MAKEFILE: ON
- name: Reduce prebuild size
run: |
ARCH=$(node -p "process.arch")
PLATFORM=$(node -p "process.platform")
NAPI_VERSION=${{ needs.sdist.outputs.napi_version }}
NCBCC_VERSION=${{ needs.sdist.outputs.ncbcc_version }}
echo "Built binary for platform=$PLATFORM, n-api=$NAPI_VERSION, arch=$ARCH"
FILENAME="couchbase-columnar-v$NCBCC_VERSION-napi-$NAPI_VERSION-macos-$ARCH-boringssl"
cd build/RelWithDebInfo
ls -alh
mv couchbase_impl.node $FILENAME.node
tar -cvzf $FILENAME-debug.tar.gz $FILENAME.node
mv $FILENAME-debug.tar.gz ../../output/prebuilds_debug
xcrun strip -Sx $FILENAME.node
ls -alh
cd ../..
mv build/$BUILD_TYPE/$FILENAME.node output/prebuilds
rm -rf build
- name: Upload prebuild
uses: actions/upload-artifact@v4
with:
retention-days: 1
name: macos-${{ matrix.arch }}-prebuild
path: |
./output/prebuilds/*.node
- name: Upload debug prebuild as artifact
uses: actions/upload-artifact@v4
with:
retention-days: 1
name: ncbcc-debug-artifact-macos-${{ matrix.arch }}-prebuild
path: |
./output/prebuilds_debug/*.tar.gz
windows-prebuilds:
needs: sdist
name: Build prebuild for Windows on ${{ matrix.arch }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
node-version: ["18.x"]
include:
- os: windows-2022
arch: "x86_64"
steps:
- uses: actions/download-artifact@v4
with:
name: ncbcc-sdist
- name: Extract sdist source
run: |
dir
set SDIST_NAME=${{ needs.sdist.outputs.sdist_name }}
tar -xvzf %SDIST_NAME%.tgz
xcopy package . /E
rmdir package /S /Q
shell: cmd
- name: Install NASM
run: |
choco install --no-progress nasm
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Confirm Node version
run: |
node --version
node -p "process.arch"
- name: Install dependencies
shell: cmd
run: |
npm install --omit=dev --ignore-scripts
- name: Build binary
run: |
npm run prebuild -- --use-boringssl --parallel 4 --use-cmakejs-build
env:
CN_VERBOSE_MAKEFILE: ON
- name: Rename prebuilds
shell: cmd
run : |
dir /a
dir /a build\Release
md output
md output\prebuilds
md output\prebuilds_debug
dir /a output
set NAPI_VERSION=${{ needs.sdist.outputs.napi_version }}
set NCBCC_VERSION=${{ needs.sdist.outputs.ncbcc_version }}
set FILENAME=couchbase-columnar-v%NCBCC_VERSION%-napi-%NAPI_VERSION%-win32-x64-boringssl
move build\Release\couchbase_impl.node output\prebuilds\%FILENAME%.node
move build\Release\couchbase_impl.pdb output\prebuilds_debug\%FILENAME%.pdb
dir /a output\prebuilds
dir /a output\prebuilds_debug
- name: Upload prebuild
uses: actions/upload-artifact@v4
with:
retention-days: 1
name: windows-${{ matrix.arch }}-prebuild
path: |
./output/prebuilds/*.node
- name: Upload debug prebuild as artifact
uses: actions/upload-artifact@v4
with:
retention-days: 1
name: ncbcc-debug-artifact-windows-${{ matrix.arch }}-prebuild
path: |
./output/prebuilds_debug/*.pdb
validate-linux-prebuilds:
needs: linux-prebuilds
name: Validate Node.js ${{ matrix.node-version }} prebuild for linux (${{ matrix.arch }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ['ubuntu-22.04']
node-version: ["16", "18", "20"]
arch: ['x86_64', 'arm64']
steps:
- name: Set up QEMU
if: ${{ matrix.arch == 'arm64' }}
uses: docker/setup-qemu-action@v3
with:
platforms: arm64
- uses: actions/download-artifact@v4
with:
name: ncbcc-sdist
- name: Setup prebuild npmrc
run: |
mkdir -p prebuilds
- uses: actions/download-artifact@v4
with:
name: linux-${{ matrix.arch }}-prebuild
path: prebuilds
- name: Run in docker
uses: addnab/docker-run-action@v3
with:
image: node:${{ matrix.node-version }}-bullseye-slim
options: >-
--platform linux/${{ matrix.arch == 'x86_64' && 'amd64' || 'arm64'}}
-v ${{ github.workspace }}:/work
run: |
node --version
cd /work
ls -alh
npm init -y
echo "columnar_local_prebuilds=/work/prebuilds" >> .npmrc
cat .npmrc
PKG=$(find . -name '*.tgz' | cut -c 3-)
npm install $PKG
node -p "JSON.parse(require('couchbase-columnar').cbppMetadata)"
- name: Upload Node.js prebuild as artifact
if: ${{ matrix.node-version == env.DEFAULT_NODE }}
uses: actions/upload-artifact@v4
with:
retention-days: 1
name: ncbcc-artifact-linux-${{ matrix.arch }}-prebuild
path: prebuilds/*.node
validate-alpine-prebuilds:
needs: alpine-prebuilds
name: Validate Node.js ${{ matrix.node-version }} prebuild for alpine (${{ matrix.arch }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ['ubuntu-22.04']
node-version: ["16", "18", "20"]
arch: ['x86_64', 'arm64']
steps:
- name: Set up QEMU
if: ${{ matrix.arch == 'arm64' }}
uses: docker/setup-qemu-action@v3
with:
platforms: arm64
- uses: actions/download-artifact@v4
with:
name: ncbcc-sdist
- name: Setup prebuild npmrc
run: |
mkdir prebuilds
- uses: actions/download-artifact@v4
with:
name: linuxmusl-${{ matrix.arch }}-prebuild
path: prebuilds
- name: Run in docker
uses: addnab/docker-run-action@v3
with:
image: node:${{ matrix.node-version }}-alpine
options: >-
--platform linux/${{ matrix.arch == 'x86_64' && 'amd64' || 'arm64'}}
-v ${{ github.workspace }}:/work
run: |
node --version
cd /work
ls -alh
npm init -y
echo "columnar_local_prebuilds=/work/prebuilds" >> .npmrc
cat .npmrc
PKG=$(find . -name '*.tgz' | cut -c 3-)
npm install $PKG
node -p "JSON.parse(require('couchbase-columnar').cbppMetadata)"
- name: Upload Node.js prebuild as artifact
if: ${{ matrix.node-version == env.DEFAULT_NODE }}
uses: actions/upload-artifact@v4
with:
retention-days: 1
name: ncbcc-artifact-linuxmusl-${{ matrix.arch }}-prebuild
path: prebuilds/*.node
validate-macos-prebuilds:
needs: macos-prebuilds
name: Validate Node.js ${{ matrix.node-version }} prebuild for macos (${{ matrix.os == 'macos-14' && 'arm64' || 'x86_64' }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["macos-13", "macos-14"]
node-version: ["16", "18", "20"]
steps:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Confirm Node version
run: |
node --version
node -p "process.arch"
- uses: actions/download-artifact@v4
with:
name: ncbcc-sdist
- name: Setup prebuild npmrc
run: |
mkdir prebuilds
echo "columnar_local_prebuilds=${{ github.workspace }}/prebuilds" >> .npmrc
cat .npmrc
- uses: actions/download-artifact@v4
with:
name: macos-${{ matrix.os == 'macos-14' && 'arm64' || 'x86_64' }}-prebuild
path: prebuilds
- name: Install w/ prebuild
run: |
npm init -y
PKG=$(find . -name '*.tgz' | cut -c 3-)
npm install $PKG --omit=dev
node -p "JSON.parse(require('couchbase-columnar').cbppMetadata)"
- name: Upload Node.js prebuild as artifact
if: ${{ matrix.node-version == env.DEFAULT_NODE }}
uses: actions/upload-artifact@v4
with:
retention-days: 1
name: ncbcc-artifact-macos-${{ matrix.os == 'macos-14' && 'arm64' || 'x86_64' }}-prebuild
path: prebuilds/*.node
validate-windows-prebuilds:
needs: windows-prebuilds
name: Validate Node.js ${{ matrix.node-version }} prebuild Windows (${{ matrix.arch }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["windows-latest"]
node-version: ["16", "18", "20"]
arch: ["x86_64"]
steps:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Confirm Node version
run: |
node --version
node -p "process.arch"
- uses: actions/download-artifact@v4
with:
name: ncbcc-sdist
- name: Setup install and prebuild npmrc
shell: cmd
run: |
dir /a
md prebuilds
echo "columnar_local_prebuilds=${{ github.workspace }}\prebuilds" >> .npmrc
type .npmrc
- uses: actions/download-artifact@v4
with:
name: windows-${{ matrix.arch }}-prebuild
path: prebuilds
- name: Install w/ prebuild
run: |
npm init -y
$env:PKG_NAME=$(gci *.tgz).Name
gci $env:PKG_NAME
npm install $env:PKG_NAME
node -p "JSON.parse(require('couchbase-columnar').cbppMetadata)"
- name: Upload Node.js prebuild as artifact
if: ${{ matrix.node-version == env.DEFAULT_NODE }}
uses: actions/upload-artifact@v4
with:
retention-days: 1
name: ncbcc-artifact-windows-${{ matrix.arch }}-prebuild
path: prebuilds/*.node
upload-npm:
name: Upload to npm
needs: [validate-linux-prebuilds, validate-alpine-prebuilds, validate-macos-prebuilds, validate-windows-prebuilds]
runs-on: ubuntu-22.04
steps:
- uses: actions/download-artifact@v4
with:
name: ncbcc-sdist
- name: Extract sdist source
run: |
ls -alh
SDIST=$(find . -name '*.tgz' | cut -c 3-)
tar -xvzf $SDIST
cp -r package/** .
rm -rf package
- uses: actions/download-artifact@v4
with:
name: ncbcc-lib
- uses: actions/download-artifact@v4
with:
pattern: ncbcc-artifact-*
path: prebuilds
merge-multiple: true
- uses: actions/download-artifact@v4
with:
name: ncbcc-platform-packagejson
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.DEFAULT_NODE }}
- name: Confirm Node version
run: |
node --version
node -p "process.arch"
- name: Build platform packages
run: |
ls -alh prebuilds
curl -o platformPackages.js ${CI_SCRIPTS_URL}/ci_scripts/platformPackages.js
node platformPackages.js --build-platform-packages --d ${{ github.workspace }}/prebuilds
rm platPkg.json
ls -alh prebuilds
cat package.json
env:
CI_SCRIPTS_URL: "https://raw.githubusercontent.com/couchbaselabs/sdkbuild-jenkinsfiles/master/couchnode"
- name: Create sdist artifact
run: |
npm install --ignore-scripts
mkdir sdist
npm pack --pack-destination sdist
- name: Upload Node.js sdist as artifact
uses: actions/upload-artifact@v4
with:
retention-days: 1
name: ncbcc-artifact-sdist
path: |
./sdist/*.tgz
- name: Publish to npm
run: |
env
rm -rf sdist
curl -o publish_to_npm.sh ${CI_SCRIPTS_URL}/ci_scripts/publish_to_npm.sh
chmod 755 publish_to_npm.sh
./publish_to_npm.sh ${{ github.workspace }} ${{ github.workspace }}/prebuilds
env:
CI_SCRIPTS_URL: "https://raw.githubusercontent.com/couchbaselabs/sdkbuild-jenkinsfiles/master/couchnode"
PUBLISH_DRY_RUN: "${{ inputs.publish_dryrun }}"
NPM_TAG: ${{ inputs.npm_tag }}