Skip to content

Commit 4368bbe

Browse files
committed
build for node 24
1 parent 820fee6 commit 4368bbe

File tree

4 files changed

+68
-90
lines changed

4 files changed

+68
-90
lines changed

.github/workflows/build.yml

Lines changed: 28 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -3,39 +3,34 @@ name: build
33
on:
44
push:
55
branches:
6-
- master
6+
- main
77
pull_request:
88
branches:
9-
- master
9+
- main
1010
release:
1111
types:
1212
- released
1313
workflow_dispatch: {}
1414

1515
env:
1616
# See https://github.com/nodejs/release#release-schedule
17-
# Node.js v16 EOL = 2023-09-11. v21 EOL = 2024-06-01.
18-
NODE_BUILD_CMD: npx --no-install prebuild -r node -t 18.0.0 -t 20.0.0 -t 22.0.0 -t 23.0.0 --include-regex '_sqlite3'
19-
# Merge with NODE_BUILD_CMD when Node.js v18 is EOL
20-
NO_V18_NODE_BUILD_CMD: npx --no-install prebuild -r node -t 20.0.0 -t 22.0.0 -t 23.0.0 --include-regex '_sqlite3'
21-
# See https://www.electronjs.org/docs/latest/tutorial/electron-timelines#version-support-policy
22-
# Electron v25 EOL = 2023-12-05. v26 EOL = 2024-02-20. v27 EOL = 2024-04-16. v28 EOL = 2024-06-11. v29 EOL = 2024-08-20.
23-
17+
# Node.js v20 EOL = 2026-04-30. v22 EOL = 2027-04-30. v23 EOL = 2025-06-01. v24 EOL = 2028-04-30.
18+
NODE_BUILD_CMD: npx --no-install prebuild -r node -t 20.0.0 -t 22.0.0 -t 23.0.0 -t 24.0.0 --include-regex '_sqlite3'
2419

2520
jobs:
2621
test:
2722
strategy:
2823
matrix:
2924
os:
30-
- ubuntu-20.04
25+
- ubuntu-22.04
3126
- macos-13
3227
- macos-14
3328
- windows-2019
3429
node:
35-
- 18
3630
- 20
3731
- 22
3832
- 23
33+
- 24
3934
name: Testing Node ${{ matrix.node }} on ${{ matrix.os }}
4035
runs-on: ${{ matrix.os }}
4136
steps:
@@ -61,17 +56,18 @@ jobs:
6156
publish:
6257
if: ${{ github.event_name == 'release' }}
6358
name: Publishing to NPM
64-
runs-on: ubuntu-20.04
59+
runs-on: ubuntu-22.04
6560
needs:
6661
- prebuild
6762
- prebuild-alpine
6863
- prebuild-alpine-arm
64+
- prebuild-linux-x64
6965
- prebuild-linux-arm
7066
steps:
7167
- uses: actions/checkout@v4
7268
- uses: actions/setup-node@v4
7369
with:
74-
node-version: 18
70+
node-version: 20
7571
registry-url: https://registry.npmjs.org
7672
- run: npm publish
7773
env:
@@ -83,7 +79,6 @@ jobs:
8379
fail-fast: false
8480
matrix:
8581
os:
86-
- ubuntu-20.04
8782
- macos-13
8883
- macos-14
8984
- windows-2019
@@ -94,36 +89,38 @@ jobs:
9489
- uses: actions/checkout@v4
9590
- uses: actions/setup-node@v4
9691
with:
97-
node-version: 18
92+
node-version: 20
9893
- if: ${{ startsWith(matrix.os, 'windows') }}
9994
run: pip.exe install setuptools
10095
- if: ${{ startsWith(matrix.os, 'macos') }}
10196
run: brew install python-setuptools
102-
- if: ${{ !startsWith(matrix.os, 'windows') && !startsWith(matrix.os, 'macos') }}
103-
run: python3 -m pip install setuptools
104-
- if: ${{ startsWith(matrix.os, 'ubuntu') }}
105-
run: |
106-
sudo apt update
107-
sudo apt install gcc-10 g++-10 -y
108-
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 100 --slave /usr/bin/g++ g++ /usr/bin/g++-10 --slave /usr/bin/gcov gcov /usr/bin/gcov-10
10997
- run: npm install --ignore-scripts
11098
- run: ${{ env.NODE_BUILD_CMD }} -u ${{ secrets.GITHUB_TOKEN }}
11199
- if: matrix.os == 'windows-2019'
112100
run: |
113101
${{ env.NODE_BUILD_CMD }} --arch ia32 -u ${{ secrets.GITHUB_TOKEN }}
114-
${{ env.NO_V18_NODE_BUILD_CMD }} --arch arm64 -u ${{ secrets.GITHUB_TOKEN }}
102+
${{ env.NODE_BUILD_CMD }} --arch arm64 -u ${{ secrets.GITHUB_TOKEN }}
103+
104+
prebuild-linux-x64:
105+
if: ${{ github.event_name == 'release' }}
106+
name: Prebuild on Linux x64
107+
runs-on: ubuntu-latest
108+
container: node:20-bullseye
109+
needs: test
110+
steps:
111+
- uses: actions/checkout@v4
112+
- run: npm install --ignore-scripts
113+
- run: ${{ env.NODE_BUILD_CMD }} -u ${{ secrets.GITHUB_TOKEN }}
115114

116115
prebuild-alpine:
117116
if: ${{ github.event_name == 'release' }}
118-
strategy:
119-
fail-fast: false
120117
name: Prebuild on alpine
121118
runs-on: ubuntu-latest
122-
container: node:18-alpine
119+
container: node:20-alpine
123120
needs: test
124121
steps:
125122
- uses: actions/checkout@v4
126-
- run: apk add build-base git python3 py3-setuptools --update-cache
123+
- run: apk add build-base git python3 py3-setuptools libstdc++ --update-cache
127124
- run: npm install --ignore-scripts
128125
- run: ${{ env.NODE_BUILD_CMD }} -u ${{ secrets.GITHUB_TOKEN }}
129126

@@ -142,8 +139,8 @@ jobs:
142139
- uses: actions/checkout@v4
143140
- uses: docker/setup-qemu-action@v3
144141
- run: |
145-
docker run --rm -v $(pwd):/tmp/project --entrypoint /bin/sh --platform linux/${{ matrix.arch }} node:18-alpine -c "\
146-
apk add build-base git python3 py3-setuptools --update-cache && \
142+
docker run --rm -v $(pwd):/tmp/project --entrypoint /bin/sh --platform linux/${{ matrix.arch }} node:20-alpine -c "\
143+
apk add build-base git python3 py3-setuptools libstdc++ --update-cache && \
147144
cd /tmp/project && \
148145
npm install --ignore-scripts && \
149146
${{ env.NODE_BUILD_CMD }} -u ${{ secrets.GITHUB_TOKEN }}"
@@ -163,7 +160,7 @@ jobs:
163160
- uses: actions/checkout@v4
164161
- uses: docker/setup-qemu-action@v3
165162
- run: |
166-
docker run --rm -v $(pwd):/tmp/project --entrypoint /bin/sh --platform linux/${{ matrix.arch }} node:18-bullseye -c "\
163+
docker run --rm -v $(pwd):/tmp/project --entrypoint /bin/sh --platform linux/${{ matrix.arch }} node:20-bullseye -c "\
167164
cd /tmp/project && \
168165
npm install --ignore-scripts && \
169-
${{ env.NODE_BUILD_CMD }} -u ${{ secrets.GITHUB_TOKEN }}"
166+
${{ env.NODE_BUILD_CMD }} -u ${{ secrets.GITHUB_TOKEN }}"

binding.gyp

Lines changed: 36 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44

55
{
66
'includes': ['deps/common.gypi'],
7+
'variables': {
8+
'is_alpine%': '<!(test -f /etc/alpine-release && echo 1 || echo 0)',
9+
},
710
'targets': [
811
{
912
'target_name': 'better_sqlite3',
@@ -31,36 +34,44 @@
3134
},
3235
{
3336
'target_name': 'zero_sqlite3',
34-
'type': 'executable',
35-
'dependencies': ['deps/sqlite3.gyp:locate_sqlite3'],
36-
'sources': ['<(SHARED_INTERMEDIATE_DIR)/sqlite3/sqlite3.c', '<(SHARED_INTERMEDIATE_DIR)/sqlite3/shell.c'],
37-
'include_dirs': ['<(SHARED_INTERMEDIATE_DIR)/sqlite3/'],
38-
'direct_dependent_settings': {
39-
'include_dirs': ['<(SHARED_INTERMEDIATE_DIR)/sqlite3/'],
40-
},
41-
'cflags': ['-std=c99', '-w'],
42-
'xcode_settings': {
43-
'OTHER_CFLAGS': ['-std=c99'],
44-
'WARNING_CFLAGS': ['-w'],
45-
},
4637
'conditions': [
47-
['sqlite3 == ""', {
48-
'includes': ['deps/defines.gypi'],
38+
['is_alpine == "1"', {
39+
'type': 'none',
40+
'dependencies': [],
41+
'sources': [],
4942
}, {
50-
'defines': [
51-
# This is currently required by better-sqlite3.
52-
'SQLITE_ENABLE_COLUMN_METADATA',
43+
'type': 'executable',
44+
'dependencies': ['deps/sqlite3.gyp:locate_sqlite3'],
45+
'sources': ['<(SHARED_INTERMEDIATE_DIR)/sqlite3/sqlite3.c', '<(SHARED_INTERMEDIATE_DIR)/sqlite3/shell.c'],
46+
'include_dirs': ['<(SHARED_INTERMEDIATE_DIR)/sqlite3/'],
47+
'direct_dependent_settings': {
48+
'include_dirs': ['<(SHARED_INTERMEDIATE_DIR)/sqlite3/'],
49+
},
50+
'cflags': ['-std=c99', '-w', '-D_POSIX_SOURCE'],
51+
'xcode_settings': {
52+
'OTHER_CFLAGS': ['-std=c99'],
53+
'WARNING_CFLAGS': ['-w'],
54+
},
55+
'conditions': [
56+
['sqlite3 == ""', {
57+
'includes': ['deps/defines.gypi'],
58+
}, {
59+
'defines': [
60+
# This is currently required by better-sqlite3.
61+
'SQLITE_ENABLE_COLUMN_METADATA',
62+
],
63+
}]
5364
],
65+
'configurations': {
66+
'Debug': {
67+
'msvs_settings': { 'VCCLCompilerTool': { 'RuntimeLibrary': 1 } }, # static debug
68+
},
69+
'Release': {
70+
'msvs_settings': { 'VCCLCompilerTool': { 'RuntimeLibrary': 0 } }, # static release
71+
},
72+
},
5473
}]
5574
],
56-
'configurations': {
57-
'Debug': {
58-
'msvs_settings': { 'VCCLCompilerTool': { 'RuntimeLibrary': 1 } }, # static debug
59-
},
60-
'Release': {
61-
'msvs_settings': { 'VCCLCompilerTool': { 'RuntimeLibrary': 0 } }, # static release
62-
},
63-
},
6475
},
6576
],
6677
}

deps/sqlite3.gyp

Lines changed: 3 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66

77
{
88
'includes': ['common.gypi'],
9+
'variables': {
10+
'is_alpine%': '<!(test -f /etc/alpine-release && echo 1 || echo 0)',
11+
},
912
'targets': [
1013
{
1114
'target_name': 'locate_sqlite3',
@@ -65,38 +68,5 @@
6568
},
6669
},
6770
},
68-
{
69-
'target_name': 'shell',
70-
'type': 'executable',
71-
'dependencies': ['sqlite3'],
72-
'sources': ['<(SHARED_INTERMEDIATE_DIR)/sqlite3/sqlite3.c', '<(SHARED_INTERMEDIATE_DIR)/sqlite3/shell.c'],
73-
'include_dirs': ['<(SHARED_INTERMEDIATE_DIR)/sqlite3/'],
74-
'direct_dependent_settings': {
75-
'include_dirs': ['<(SHARED_INTERMEDIATE_DIR)/sqlite3/'],
76-
},
77-
'cflags': ['-std=c99', '-w'],
78-
'xcode_settings': {
79-
'OTHER_CFLAGS': ['-std=c99'],
80-
'WARNING_CFLAGS': ['-w'],
81-
},
82-
'conditions': [
83-
['sqlite3 == ""', {
84-
'includes': ['defines.gypi'],
85-
}, {
86-
'defines': [
87-
# This is currently required by better-sqlite3.
88-
'SQLITE_ENABLE_COLUMN_METADATA',
89-
],
90-
}]
91-
],
92-
'configurations': {
93-
'Debug': {
94-
'msvs_settings': { 'VCCLCompilerTool': { 'RuntimeLibrary': 1 } }, # static debug
95-
},
96-
'Release': {
97-
'msvs_settings': { 'VCCLCompilerTool': { 'RuntimeLibrary': 0 } }, # static release
98-
},
99-
},
100-
},
10171
],
10272
}

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@rocicorp/zero-sqlite3",
3-
"version": "1.0.4",
3+
"version": "1.0.5",
44
"description": "better-sqlite3 on bedrock",
55
"homepage": "https://github.com/rocicorp/zero-sqlite3",
66
"author": "Rocicorp",

0 commit comments

Comments
 (0)