Update dependency prebuild to v13 #489
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: 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-latest | |
- ubuntu-20.04 | |
- windows-latest | |
host: | |
- x64 | |
target: | |
- x64 | |
node: | |
- 18 | |
include: | |
- os: windows-latest | |
node: 18 | |
host: x86 | |
target: x86 | |
- os: macos-m1 | |
node: 18 | |
host: arm64 | |
target: arm64 | |
name: ${{ matrix.os }} (host=${{ matrix.host }}, target=${{ matrix.target }}) | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node }} | |
architecture: ${{ matrix.host }} | |
- name: Add yarn (self-hosted) | |
if: matrix.os == 'macos-m1' | |
run: npm install -g yarn | |
- name: Add setuptools for Python 3.12 (temp) | |
if: matrix.os != 'macos-m1' | |
run: pip install setuptools | |
- name: Add msbuild to PATH | |
uses: microsoft/[email protected] | |
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 -a ${{ env.TARGET }} | |
- name: Print binary info | |
if: contains(matrix.os, 'ubuntu') | |
run: | | |
ldd build/**/node_sqlite3.node | |
echo "---" | |
nm build/**/node_sqlite3.node | grep "GLIBC_" | c++filt || true | |
echo "---" | |
file build/**/node_sqlite3.node | |
- name: Run tests | |
run: yarn test | |
- name: Upload binaries to commit artifacts | |
uses: actions/upload-artifact@v3 | |
if: matrix.node == 18 | |
with: | |
name: prebuilt-binaries | |
path: prebuilds/* | |
retention-days: 7 | |
- name: Upload binaries to GitHub Release | |
run: yarn upload --upload-all ${{ github.token }} | |
if: matrix.node == 18 && startsWith(github.ref, 'refs/tags/') | |
build-qemu: | |
runs-on: ubuntu-latest | |
if: github.event_name == 'workflow_dispatch' || startsWith(github.ref, 'refs/tags/') | |
strategy: | |
fail-fast: false | |
matrix: | |
node: | |
- 18 | |
target: | |
- linux/arm64 | |
variant: | |
- bullseye | |
- alpine3.15 | |
include: | |
# musl x64 builds | |
- target: linux/amd64 | |
variant: alpine3.15 | |
node: 18 | |
name: ${{ matrix.variant }} (node=${{ matrix.node }}, target=${{ matrix.target }}) | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # 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: Upload binaries to commit artifacts | |
uses: actions/upload-artifact@v3 | |
if: matrix.node == 18 | |
with: | |
name: prebuilt-binaries | |
path: prebuilds/* | |
retention-days: 7 | |
- name: Upload binaries to GitHub Release | |
run: yarn install --ignore-scripts && yarn upload --upload-all ${{ github.token }} | |
if: matrix.node == 18 && startsWith(github.ref, 'refs/tags/') |