-
-
Notifications
You must be signed in to change notification settings - Fork 816
164 lines (145 loc) · 4.58 KB
/
ci.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
154
155
156
157
158
159
160
161
162
163
164
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@0ad4b8fadaa221de15dcec353f45205ec38ea70b # 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/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 -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@0ad4b8fadaa221de15dcec353f45205ec38ea70b # 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/')