Skip to content

Switch to prebuildify #94

Switch to prebuildify

Switch to prebuildify #94

Workflow file for this run

name: CI
on:
workflow_dispatch:
pull_request:
push:
branches:
- master
tags:
- '*'
env:
FORCE_COLOR: 1
concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- macos-15-intel
- ubuntu-22.04
- windows-latest
host:
- x64
target:
- x64
node:
- 20
- 24
include:
- os: macos-latest
node: 20
host: arm64
target: arm64
- os: ubuntu-22.04-arm
node: 20
host: arm64
target: arm64
- os: windows-11-arm
node: 20
host: arm64
target: arm64
- os: macos-latest
node: 24
host: arm64
target: arm64
- os: ubuntu-22.04-arm
node: 24
host: arm64
target: arm64
- os: windows-11-arm
node: 24
host: arm64
target: arm64
name: ${{ matrix.os }} (host=${{ matrix.host }}, target=${{ matrix.target }})
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
architecture: ${{ matrix.host }}
scope: '@appthreat'
- name: Add yarn
run: npm install -g yarn
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.3
if: contains(matrix.os, 'windows')
with:
msbuild-architecture: ${{ matrix.target }}
- name: Install dependencies
run: yarn install --ignore-scripts
- name: Check Node compatibility
run: node tools/semver-check.js
- name: Add env vars
shell: bash
run: |
echo "V=1" >> $GITHUB_ENV
if [ "${{ matrix.target }}" = "x86" ]; then
echo "TARGET=ia32" >> $GITHUB_ENV
else
echo "TARGET=${{ matrix.target }}" >> $GITHUB_ENV
fi
- name: Add Linux env vars
if: contains(matrix.os, 'ubuntu')
run: |
echo "CFLAGS=${CFLAGS:-} -include ../src/gcc-preinclude.h" >> $GITHUB_ENV
echo "CXXFLAGS=${CXXFLAGS:-} -include ../src/gcc-preinclude.h" >> $GITHUB_ENV
- name: Build binaries
run: yarn prebuild --arch ${{ env.TARGET }} --tag-libc
- name: Print binary info
if: contains(matrix.os, 'ubuntu')
run: |
ldd prebuilds/*/*.node
echo "---"
nm prebuilds/*/*.node | grep "GLIBC_" | c++filt || true
echo "---"
file prebuilds/*/*.node
- name: Run tests
run: yarn test
- name: Upload prebuilds to artifacts
uses: actions/upload-artifact@v4
with:
name: prebuilds-${{ matrix.os }}-${{ matrix.host }}-${{ matrix.target }}-${{ matrix.node }}
path: prebuilds/
retention-days: 7
build-qemu:
runs-on: ubuntu-24.04-arm
strategy:
fail-fast: false
matrix:
node:
- 20
target:
- linux/arm64
variant:
- alpine3.20
include:
- target: linux/arm64
variant: alpine3.21
node: 22
# musl x64 builds
- target: linux/amd64
variant: alpine3.20
node: 20
- target: linux/amd64
variant: alpine3.21
node: 22
name: ${{ matrix.variant }} (node=${{ matrix.node }}, target=${{ matrix.target }})
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build binaries and test
run: |
docker buildx build \
--file ./tools/BinaryBuilder.Dockerfile \
--load \
--tag sqlite-builder \
--platform ${{ matrix.target }} \
--no-cache \
--build-arg VARIANT=${{ matrix.variant }} \
--build-arg NODE_VERSION=${{ matrix.node }} \
.
CONTAINER_ID=$(docker create -it sqlite-builder)
docker cp $CONTAINER_ID:/usr/src/build/prebuilds/ ./prebuilds
- name: Sanitize target name for Artifact
run: |
SAFE_TARGET=$(echo "${{ matrix.target }}" | tr '/' '-')
echo "SAFE_TARGET=$SAFE_TARGET" >> $GITHUB_ENV
- name: Upload QEMU prebuilds to artifacts
uses: actions/upload-artifact@v4
with:
name: prebuilds-qemu-${{ matrix.variant }}-${{ env.SAFE_TARGET }}-${{ matrix.node }}
path: prebuilds/
retention-days: 7
publish:
needs: [build, build-qemu]
runs-on: ubuntu-22.04
if: startsWith(github.ref, 'refs/tags/')
permissions:
contents: write
packages: write
id-token: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 24
scope: '@appthreat'
- name: Download and merge all prebuilds
uses: actions/download-artifact@v4
with:
pattern: prebuilds-*
path: prebuilds/
merge-multiple: true
- name: Add yarn
run: npm install -g yarn
- name: Install dependencies
run: yarn install --ignore-scripts
- name: Publish to npm
run: npm publish --provenance --access=public