forked from WiseLibs/better-sqlite3
-
Notifications
You must be signed in to change notification settings - Fork 0
153 lines (145 loc) · 5.1 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
name: build
on:
push:
branches:
- master
pull_request:
branches:
- master
release:
types:
- released
workflow_dispatch: {}
env:
# See https://nodejs.org/en/about/previous-releases
# Node.js 16 EOL = 11 Sep 2023
NODE_BUILD_CMD: npx --no-install prebuild -r node -t 18.0.0 -t 20.0.0 -t 21.0.0 -t 22.0.0 --include-regex 'better_sqlite3.node$'
# See https://www.electronjs.org/docs/latest/tutorial/electron-timelines#version-support-policy
# The v25 EOL = 2023-dec-5. v26 EOL = 2024-feb-20. v27 EOL = 2024-apr-16. v28 EOL = 2024-jun-11. v29 EOL = 2024-aug-20.
ELECTRON_BUILD_CMD: npx --no-install prebuild -r electron -t 25.0.0 -t 26.0.0 -t 27.0.0 -t 28.0.0 -t 29.0.0 -t 30.0.0 --include-regex 'better_sqlite3.node$'
jobs:
test:
strategy:
matrix:
os:
- ubuntu-20.04
- macos-latest
- macos-14
- windows-2019
node:
- 18
- 20
- 21
- 22
name: Testing Node ${{ matrix.node }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
- if: ${{ startsWith(matrix.os, 'windows') }}
run: pip.exe install setuptools
- if: ${{ startsWith(matrix.os, 'macos') }}
run: brew install python-setuptools
- if: ${{ !startsWith(matrix.os, 'windows') && !startsWith(matrix.os, 'macos') }}
run: python3 -m pip install setuptools
- run: npm install --ignore-scripts
- run: npm run build-debug
- run: npm test
- name: Test SpatiaLite extension
if: ${{ startsWith(matrix.os, 'ubuntu') }}
run: |
sudo apt update
sudo apt install libsqlite3-mod-spatialite -y
node -e "require('./lib/index.js')(':memory:').loadExtension('mod_spatialite').exec('SELECT InitSpatialMetaData();')"
publish:
if: ${{ github.event_name == 'release' }}
name: Publishing to NPM
runs-on: ubuntu-20.04
needs: test
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
registry-url: https://registry.npmjs.org
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
prebuild:
strategy:
matrix:
os:
- ubuntu-20.04
- macos-latest
- macos-14
- windows-2019
name: Prebuild on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
needs: publish
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
- if: ${{ startsWith(matrix.os, 'windows') }}
run: pip.exe install setuptools
- if: ${{ startsWith(matrix.os, 'macos') }}
run: brew install python-setuptools
- if: ${{ !startsWith(matrix.os, 'windows') && !startsWith(matrix.os, 'macos') }}
run: python3 -m pip install setuptools
- run: npm install --ignore-scripts
- run: ${{ env.NODE_BUILD_CMD }} -u ${{ secrets.GITHUB_TOKEN }}
- run: ${{ env.ELECTRON_BUILD_CMD }} -u ${{ secrets.GITHUB_TOKEN }}
- if: matrix.os == 'windows-2019'
run: |
${{ env.NODE_BUILD_CMD }} --arch ia32 -u ${{ secrets.GITHUB_TOKEN }}
npx --no-install prebuild -r node -t 20.0.0 -t 21.0.0 --include-regex 'better_sqlite3.node$' --arch arm64 -u ${{ secrets.GITHUB_TOKEN }}
${{ env.ELECTRON_BUILD_CMD }} --arch ia32 -u ${{ secrets.GITHUB_TOKEN }}
${{ env.ELECTRON_BUILD_CMD }} --arch arm64 -u ${{ secrets.GITHUB_TOKEN }}
prebuild-alpine:
name: Prebuild on alpine
runs-on: ubuntu-latest
container: node:18-alpine
needs: publish
steps:
- uses: actions/checkout@v4
- run: apk add build-base git python3 py3-setuptools --update-cache
- run: npm install --ignore-scripts
- run: ${{ env.NODE_BUILD_CMD }} -u ${{ secrets.GITHUB_TOKEN }}
prebuild-alpine-arm:
strategy:
matrix:
arch:
- arm/v7
- arm64
name: Prebuild on alpine (${{ matrix.arch }})
runs-on: ubuntu-latest
needs: publish
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
- run: |
docker run --rm -v $(pwd):/tmp/project --entrypoint /bin/sh --platform linux/${{ matrix.arch }} node:18-alpine -c "\
apk add build-base git python3 py3-setuptools --update-cache && \
cd /tmp/project && \
npm install --ignore-scripts && \
${{ env.NODE_BUILD_CMD }} -u ${{ secrets.GITHUB_TOKEN }}"
prebuild-linux-arm:
strategy:
matrix:
arch:
- arm/v7
- arm64
name: Prebuild on Linux (${{ matrix.arch }})
runs-on: ubuntu-latest
needs: publish
steps:
- uses: actions/checkout@v4
- uses: docker/setup-qemu-action@v3
- run: |
docker run --rm -v $(pwd):/tmp/project --entrypoint /bin/sh --platform linux/${{ matrix.arch }} node:18 -c "\
cd /tmp/project && \
npm install --ignore-scripts && \
${{ env.NODE_BUILD_CMD }} -u ${{ secrets.GITHUB_TOKEN }}"