Node.js Package #59
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
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created | |
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages | |
name: Node.js Package | |
on: | |
# release: | |
# types: [created] | |
workflow_dispatch: | |
jobs: | |
# buildx86: | |
# runs-on: ubuntu-latest | |
# permissions: | |
# contents: write | |
# packages: write | |
# deployments: write | |
# env: | |
# NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
# steps: | |
# - uses: actions/checkout@v4 | |
# - uses: actions/setup-node@v3 | |
# with: | |
# node-version: 20 | |
# registry-url: https://npm.pkg.github.com/ | |
# - uses: mmomtchev/setup-swig@v3 | |
# with: | |
# branch: jse | |
# - run: swig -version | |
# # build x86_64 version, test, pack, package and native module | |
# - run: npm i --ignore-scripts | |
# - run: ./node_modules/@mapbox/node-pre-gyp/bin/node-pre-gyp rebuild package | |
# - run: npm run test | |
# - run: npm publish | |
# - run: NODE_PRE_GYP_GITHUB_TOKEN=$NODE_AUTH_TOKEN node ./node_modules/node-pre-gyp-github/bin/node-pre-gyp-github.js publish --release | |
# # # build for mac, package and upload native module | |
# # - run: sudo apt-get install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu | |
# # - run: apt-get install uuid-dev:arm64 --download-only | |
# # - run: curl -s https://nodejs.org/download/release/$(node --version)/node-$(node --version)-linux-arm64.tar.gz > /tmp/nodearm64.tgz | |
# # - run: npm i --ignore-scripts | |
# # - run: CCARCH=aarch64-linux-gnu CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-g++ CC_host="gcc" CXX_host="g++" ./node_modules/@mapbox/node-pre-gyp/bin/node-pre-gyp rebuild package --tarball /tmp/nodearm64.tgz --arch=arm64 | |
# # - run: NODE_PRE_GYP_GITHUB_TOKEN=$NODE_AUTH_TOKEN node ./node_modules/node-pre-gyp-github/bin/node-pre-gyp-github.js publish --release --arch=arm64 | |
archs: | |
# The host should always be linux | |
runs-on: ubuntu-latest | |
name: Build on ${{ matrix.distro }} ${{ matrix.arch }} | |
permissions: | |
contents: write | |
packages: write | |
deployments: write | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
# Run steps on a matrix of 4 arch/distro combinations | |
strategy: | |
matrix: | |
include: | |
- arch: aarch64 | |
distro: ubuntu-latest | |
# - arch: aarch64 | |
# distro: bullseye | |
# - arch: ppc64le | |
# distro: alpine_latest | |
# - arch: none | |
# distro: none | |
# base_image: riscv64/busybox | |
steps: | |
- uses: actions/checkout@v4 | |
# - uses: actions/setup-node@v3 | |
# with: | |
# node-version: 20 | |
# registry-url: https://npm.pkg.github.com/ | |
# - uses: mmomtchev/setup-swig@v3 | |
# with: | |
# branch: jse | |
- uses: uraimo/run-on-arch-action@v2 | |
name: Build artifact | |
id: build | |
with: | |
arch: ${{ matrix.arch }} | |
distro: ${{ matrix.distro }} | |
# Not required, but speeds up builds | |
githubToken: ${{ github.token }} | |
# The shell to run commands with in the container | |
shell: /bin/sh | |
# do the build | |
run: | | |
apt-get install git | |
apt-get satisfy "nodejs (< 21.0.0)" | |
git clone https://github.com/mmomtchev/swig.git && cd swig && ./configure && make && make install && cd .. | |
swig -version | |
npm i --ignore-scripts | |
./node_modules/@mapbox/node-pre-gyp/bin/node-pre-gyp rebuild package | |
npm run test | |
NODE_PRE_GYP_GITHUB_TOKEN=$NODE_AUTH_TOKEN node ./node_modules/node-pre-gyp-github/bin/node-pre-gyp-github.js publish --release | |