Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 51 additions & 27 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ concurrency:
jobs:
build:
runs-on: ${{ matrix.os }}
permissions:
contents: write
packages: write
id-token: write
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -61,7 +57,7 @@ jobs:

name: ${{ matrix.os }} (host=${{ matrix.host }}, target=${{ matrix.target }})
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
Expand Down Expand Up @@ -102,41 +98,29 @@ jobs:
echo "CXXFLAGS=${CXXFLAGS:-} -include ../src/gcc-preinclude.h" >> $GITHUB_ENV

- name: Build binaries
run: yarn prebuild -a ${{ env.TARGET }}
run: yarn prebuild --arch ${{ env.TARGET }} --tag-libc

- name: Print binary info
if: contains(matrix.os, 'ubuntu')
run: |
ldd build/**/node_sqlite3.node
ldd prebuilds/*/*.node
echo "---"
nm build/**/node_sqlite3.node | grep "GLIBC_" | c++filt || true
nm prebuilds/*/*.node | grep "GLIBC_" | c++filt || true
echo "---"
file build/**/node_sqlite3.node
file prebuilds/*/*.node

- name: Run tests
run: yarn test

- name: Upload binaries to commit artifacts
- name: Upload prebuilds to artifacts
uses: actions/upload-artifact@v4
if: matrix.node == 24 && matrix.os == 'ubuntu-22.04'
with:
name: prebuilt-binaries
path: prebuilds/*
name: prebuilds-${{ matrix.os }}-${{ matrix.host }}-${{ matrix.target }}-${{ matrix.node }}
path: prebuilds/
retention-days: 7

- name: Upload binaries to GitHub Release
run: yarn upload --upload-all ${{ github.token }}
if: startsWith(github.ref, 'refs/tags/')
- name: Publish
run: |
npm publish --provenance --access=public
if: matrix.node == 24 && matrix.os == 'ubuntu-22.04' && startsWith(github.ref, 'refs/tags/')
build-qemu:
runs-on: ubuntu-24.04-arm
permissions:
contents: write
packages: write
id-token: write
strategy:
fail-fast: false
matrix:
Expand All @@ -159,7 +143,7 @@ jobs:
node: 22
name: ${{ matrix.variant }} (node=${{ matrix.node }}, target=${{ matrix.target }})
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3
Expand All @@ -180,7 +164,47 @@ jobs:
.
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
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
npm publish --dry-run

- name: Upload binaries to GitHub Release
run: yarn install --ignore-scripts && yarn upload --upload-all ${{ github.token }}
- name: Publish to npm
run: npm publish --provenance --access=public
if: startsWith(github.ref, 'refs/tags/')
4 changes: 3 additions & 1 deletion deps/common-sqlite.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@
'-O2'
],
'GCC_OPTIMIZATION_LEVEL': '3',
'LLVM_LTO': 'YES',
'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES',
'GCC_GENERATE_DEBUGGING_SYMBOLS': 'NO',
'DEAD_CODE_STRIPPING': 'YES',
'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES'
Expand All @@ -57,4 +59,4 @@
}
}
}
}
}
10 changes: 6 additions & 4 deletions deps/sqlite3.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
'target_defaults': {
'default_configuration': 'Release',
"cflags": [
'-O3', '-flto', '-pipe', '-ffunction-sections', '-fdata-sections'
'-O3', '-flto', '-pipe', '-ffunction-sections', '-fdata-sections', '-fvisibility=hidden'
],
'cxxflags':[
'-O3', '-flto', '-pipe', '-ffunction-sections', '-fdata-sections'
'-O3', '-flto', '-pipe', '-ffunction-sections', '-fdata-sections', '-fvisibility=hidden'
],
'ldflags': [ '-flto', '-Wl,--gc-sections','-s' ],
'ldflags': [ '-flto', '-Wl,--gc-sections', '-s' ],
'configurations': {
'Debug': {
'defines': [ 'DEBUG', '_DEBUG' ],
Expand All @@ -35,6 +35,8 @@
'msvs_settings': {
'VCCLCompilerTool': {
'Optimization': 2, # /O2
'FavorSizeOrSpeed': 1, # /Ot (Favor fast code)
'StringPooling': 'true', # /GF
'EnableFunctionLevelLinking': 'true', # /Gy
'EnableIntrinsicFunctions': 'true',
},
Expand Down Expand Up @@ -103,4 +105,4 @@
],
}
]
}
}
Loading