-
Notifications
You must be signed in to change notification settings - Fork 0
388 lines (343 loc) · 15.8 KB
/
Copy pathci.yml
File metadata and controls
388 lines (343 loc) · 15.8 KB
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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
quality:
name: Code quality
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install tools
run: |
sudo apt-get update
sudo apt-get install -y clang-format python3
- name: Run checks
run: python3 scripts/checkpatch.py
build:
name: Build and test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
meson ninja-build pkg-config \
libarchive-dev liblmdb-dev libgpgme-dev libseccomp-dev
- name: Install yyjson
run: |
git clone --depth=1 https://github.com/ibireme/yyjson.git /tmp/yyjson
gcc -O2 -shared -fPIC -o /tmp/libyyjson.so /tmp/yyjson/src/yyjson.c
sudo cp /tmp/libyyjson.so /usr/local/lib/
sudo cp /tmp/yyjson/src/yyjson.h /usr/local/include/
sudo ldconfig
- name: Build
run: |
meson setup build --buildtype=debug
meson compile -C build
- name: Test
run: meson test -C build --print-errorlogs
sanitize:
name: Sanitizers (ASan + UBSan)
runs-on: ubuntu-latest
env:
ASAN_OPTIONS: halt_on_error=1
UBSAN_OPTIONS: halt_on_error=1:print_stacktrace=1
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
meson ninja-build pkg-config clang \
libarchive-dev liblmdb-dev libgpgme-dev libseccomp-dev
- name: Install yyjson
run: |
git clone --depth=1 https://github.com/ibireme/yyjson.git /tmp/yyjson
gcc -O2 -shared -fPIC -o /tmp/libyyjson.so /tmp/yyjson/src/yyjson.c
sudo cp /tmp/libyyjson.so /usr/local/lib/
sudo cp /tmp/yyjson/src/yyjson.h /usr/local/include/
sudo ldconfig
- name: Build with sanitizers
run: |
CC=clang meson setup build-san \
--buildtype=debug \
-Db_sanitize=address,undefined \
-Db_lundef=false
meson compile -C build-san
- name: Test
run: meson test -C build-san --print-errorlogs
arch-asm:
name: Assembly (minor arch validation)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install clang + lld
run: |
sudo apt-get update
sudo apt-get install -y clang lld
- name: Assemble and PIC-link each minor arch backend
run: |
set -e
assemble() {
dir="$1"; shift
for a in crc32 md5 sha256; do
clang "$@" -fPIC -c "arch/$dir/$a.S" -o "/tmp/${dir}_$a.o"
done
clang "$@" -shared -fPIC -fuse-ld=lld -Wl,-z,text -nostdlib \
"/tmp/${dir}_crc32.o" "/tmp/${dir}_md5.o" "/tmp/${dir}_sha256.o" \
-o "/tmp/${dir}.so"
echo "OK: $dir"
}
assemble arm -target arm-linux-gnueabihf -march=armv7-a
assemble x86 -target i386-linux-gnu
assemble riscv32 -target riscv32-linux-gnu -march=rv32gc -mabi=ilp32
assemble mips -target mipsel-linux-gnu -march=mips32r2
assemble ppc32 -target powerpc-linux-gnu
assemble ppc32le -target powerpcle-linux-gnu
assemble ppc64 -target powerpc64-linux-gnu -mabi=elfv2
assemble ppc64le -target powerpc64le-linux-gnu
cross-aarch64:
name: Cross-compile (aarch64)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Add arm64 architecture
run: |
sudo dpkg --add-architecture arm64
sudo sed -i '/^deb \[/!s/^deb /deb [arch=amd64] /' /etc/apt/sources.list
sudo find /etc/apt/sources.list.d/ -name '*.list' \
-exec sed -i '/^deb \[/!s/^deb /deb [arch=amd64] /' {} +
sudo find /etc/apt/sources.list.d/ -name '*.sources' \
-exec sed -i '/^Architectures:/d; /^Types:/i Architectures: amd64' {} +
. /etc/os-release
sudo tee /etc/apt/sources.list.d/arm64-ports.list << EOF
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports ${VERSION_CODENAME} main restricted universe
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports ${VERSION_CODENAME}-updates main restricted universe
deb [arch=arm64] http://ports.ubuntu.com/ubuntu-ports ${VERSION_CODENAME}-security main restricted universe
EOF
sudo apt-get update
- name: Install dependencies
run: |
sudo apt-get install -y \
clang lld llvm \
gcc-aarch64-linux-gnu \
meson ninja-build pkg-config \
libarchive-dev:arm64 \
liblmdb-dev:arm64 \
libsodium-dev:arm64 \
libseccomp-dev:arm64
- name: Build yyjson for arm64
run: |
git clone --depth=1 https://github.com/ibireme/yyjson.git /tmp/yyjson
clang --target=aarch64-linux-gnu -O2 -shared -fPIC \
-o /tmp/libyyjson.so /tmp/yyjson/src/yyjson.c
sudo cp /tmp/libyyjson.so /usr/lib/aarch64-linux-gnu/
sudo cp /tmp/yyjson/src/yyjson.h /usr/include/
printf 'Name: yyjson\nDescription: Fast JSON library\nVersion: 0.0.0\nLibs: -L/usr/lib/aarch64-linux-gnu -lyyjson\nCflags: -I/usr/include\n' | \
sudo tee /usr/lib/aarch64-linux-gnu/pkgconfig/yyjson.pc
- name: Cross-compile
env:
PKG_CONFIG_LIBDIR: /usr/lib/aarch64-linux-gnu/pkgconfig:/usr/share/pkgconfig
run: |
meson setup build-aarch64 \
--cross-file cross-aarch64.txt \
--buildtype=release
meson compile -C build-aarch64
cross-riscv64:
name: Cross-compile (riscv64)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Add riscv64 architecture
run: |
sudo dpkg --add-architecture riscv64
sudo sed -i '/^deb \[/!s/^deb /deb [arch=amd64] /' /etc/apt/sources.list
sudo find /etc/apt/sources.list.d/ -name '*.list' \
-exec sed -i '/^deb \[/!s/^deb /deb [arch=amd64] /' {} +
sudo find /etc/apt/sources.list.d/ -name '*.sources' \
-exec sed -i '/^Architectures:/d; /^Types:/i Architectures: amd64' {} +
. /etc/os-release
sudo tee /etc/apt/sources.list.d/riscv64-ports.list << EOF
deb [arch=riscv64] http://ports.ubuntu.com/ubuntu-ports ${VERSION_CODENAME} main restricted universe
deb [arch=riscv64] http://ports.ubuntu.com/ubuntu-ports ${VERSION_CODENAME}-updates main restricted universe
deb [arch=riscv64] http://ports.ubuntu.com/ubuntu-ports ${VERSION_CODENAME}-security main restricted universe
EOF
sudo apt-get update
- name: Install dependencies
run: |
sudo apt-get install -y \
clang lld llvm \
gcc-riscv64-linux-gnu \
meson ninja-build pkg-config \
libarchive-dev:riscv64 \
liblmdb-dev:riscv64 \
libsodium-dev:riscv64 \
libseccomp-dev:riscv64
- name: Build yyjson for riscv64
run: |
git clone --depth=1 https://github.com/ibireme/yyjson.git /tmp/yyjson
clang --target=riscv64-linux-gnu -O2 -shared -fPIC \
-o /tmp/libyyjson.so /tmp/yyjson/src/yyjson.c
sudo cp /tmp/libyyjson.so /usr/lib/riscv64-linux-gnu/
sudo cp /tmp/yyjson/src/yyjson.h /usr/include/
printf 'Name: yyjson\nDescription: Fast JSON library\nVersion: 0.0.0\nLibs: -L/usr/lib/riscv64-linux-gnu -lyyjson\nCflags: -I/usr/include\n' | \
sudo tee /usr/lib/riscv64-linux-gnu/pkgconfig/yyjson.pc
- name: Cross-compile
env:
PKG_CONFIG_LIBDIR: /usr/lib/riscv64-linux-gnu/pkgconfig:/usr/share/pkgconfig
run: |
meson setup build-riscv64 \
--cross-file cross-riscv64.txt \
--buildtype=release
meson compile -C build-riscv64
cross-mips64el:
name: Cross-compile (mips64el)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Add mips64el architecture
run: |
sudo dpkg --add-architecture mips64el
sudo sed -i '/^deb \[/!s/^deb /deb [arch=amd64] /' /etc/apt/sources.list
sudo find /etc/apt/sources.list.d/ -name '*.list' \
-exec sed -i '/^deb \[/!s/^deb /deb [arch=amd64] /' {} +
sudo find /etc/apt/sources.list.d/ -name '*.sources' \
-exec sed -i '/^Architectures:/d; /^Types:/i Architectures: amd64' {} +
. /etc/os-release
sudo tee /etc/apt/sources.list.d/mips64el-ports.list << EOF
deb [arch=mips64el] http://ports.ubuntu.com/ubuntu-ports ${VERSION_CODENAME} main restricted universe
deb [arch=mips64el] http://ports.ubuntu.com/ubuntu-ports ${VERSION_CODENAME}-updates main restricted universe
deb [arch=mips64el] http://ports.ubuntu.com/ubuntu-ports ${VERSION_CODENAME}-security main restricted universe
EOF
sudo apt-get update
- name: Install dependencies
run: |
sudo apt-get install -y \
clang lld llvm \
gcc-mips64el-linux-gnuabi64 \
meson ninja-build pkg-config \
cmake autoconf automake libtool gperf
- name: Build cross libs for mips64el
run: |
TRIPLET=mips64el-linux-gnuabi64
SYSROOT=/usr/lib/${TRIPLET}
sudo mkdir -p ${SYSROOT}/pkgconfig
CC="clang --target=${TRIPLET}"
# zlib (required by libarchive)
curl -fsSL https://github.com/madler/zlib/releases/download/v1.3.1/zlib-1.3.1.tar.gz | tar xz -C /tmp
cd /tmp/zlib-1.3.1
CC="${CC}" ./configure --prefix=/usr --libdir=${SYSROOT} --static
make -j$(nproc) && sudo make install
printf 'Name: zlib\nVersion: 1.3.1\nLibs: -L%s -lz\nCflags: -I/usr/include\n' "${SYSROOT}" | sudo tee ${SYSROOT}/pkgconfig/zlib.pc
# libsodium
curl -fsSL https://download.libsodium.org/libsodium/releases/libsodium-1.0.20.tar.gz | tar xz -C /tmp
cd /tmp/libsodium-1.0.20
./configure --host=${TRIPLET} CC="${CC}" --prefix=/usr --libdir=${SYSROOT} --disable-shared
make -j$(nproc) && sudo make install
printf 'Name: libsodium\nVersion: 1.0.20\nLibs: -L%s -lsodium\nCflags: -I/usr/include\n' "${SYSROOT}" | sudo tee ${SYSROOT}/pkgconfig/libsodium.pc
# lmdb
curl -fsSL https://github.com/LMDB/lmdb/archive/refs/tags/LMDB_0.9.32.tar.gz | tar xz -C /tmp
cd /tmp/lmdb-LMDB_0.9.32/libraries/liblmdb
make CC="clang --target=${TRIPLET}" liblmdb.a
sudo cp liblmdb.a ${SYSROOT}/liblmdb.a
sudo cp lmdb.h /usr/include/lmdb.h
printf 'Name: lmdb\nVersion: 0.9.32\nLibs: -L%s -llmdb\nCflags: -I/usr/include\n' "${SYSROOT}" | sudo tee ${SYSROOT}/pkgconfig/lmdb.pc
# libarchive (with zlib)
curl -fsSL https://github.com/libarchive/libarchive/releases/download/v3.7.4/libarchive-3.7.4.tar.gz | tar xz -C /tmp
cd /tmp/libarchive-3.7.4
CFLAGS="-I/usr/include" LDFLAGS="-L${SYSROOT}" \
./configure --host=${TRIPLET} CC="${CC}" --prefix=/usr --libdir=${SYSROOT} --disable-shared \
--without-bz2lib --without-libb2 --without-iconv --without-lz4 --without-zstd \
--without-lzma --without-cng --without-xml2 --without-expat --with-zlib
make -j$(nproc) && sudo make install
printf 'Name: libarchive\nVersion: 3.7.4\nLibs: -L%s -larchive -lz\nCflags: -I/usr/include\n' "${SYSROOT}" | sudo tee ${SYSROOT}/pkgconfig/libarchive.pc
# libseccomp
curl -fsSL https://github.com/seccomp/libseccomp/releases/download/v2.5.5/libseccomp-2.5.5.tar.gz | tar xz -C /tmp
cd /tmp/libseccomp-2.5.5
./configure --host=${TRIPLET} CC="${CC}" --prefix=/usr --libdir=${SYSROOT} --disable-shared
make -j$(nproc) && sudo make install
printf 'Name: libseccomp\nVersion: 2.5.5\nLibs: -L%s -lseccomp\nCflags: -I/usr/include\n' "${SYSROOT}" | sudo tee ${SYSROOT}/pkgconfig/libseccomp.pc
- name: Build yyjson for mips64el
run: |
git clone --depth=1 https://github.com/ibireme/yyjson.git /tmp/yyjson
clang --target=mips64el-linux-gnuabi64 -O2 -shared -fPIC \
-o /tmp/libyyjson.so /tmp/yyjson/src/yyjson.c
sudo cp /tmp/libyyjson.so /usr/lib/mips64el-linux-gnuabi64/
sudo cp /tmp/yyjson/src/yyjson.h /usr/include/
printf 'Name: yyjson\nDescription: Fast JSON library\nVersion: 0.0.0\nLibs: -L/usr/lib/mips64el-linux-gnuabi64 -lyyjson\nCflags: -I/usr/include\n' | \
sudo tee /usr/lib/mips64el-linux-gnuabi64/pkgconfig/yyjson.pc
- name: Cross-compile
env:
PKG_CONFIG_LIBDIR: /usr/lib/mips64el-linux-gnuabi64/pkgconfig:/usr/share/pkgconfig
run: |
meson setup build-mips64el \
--cross-file cross-mips64.txt \
--buildtype=release
meson compile -C build-mips64el
cross-armhf:
name: Cross-compile (armhf)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Add armhf architecture
run: |
sudo dpkg --add-architecture armhf
sudo sed -i '/^deb \[/!s/^deb /deb [arch=amd64] /' /etc/apt/sources.list
sudo find /etc/apt/sources.list.d/ -name '*.list' \
-exec sed -i '/^deb \[/!s/^deb /deb [arch=amd64] /' {} +
sudo find /etc/apt/sources.list.d/ -name '*.sources' \
-exec sed -i '/^Architectures:/d; /^Types:/i Architectures: amd64' {} +
. /etc/os-release
sudo tee /etc/apt/sources.list.d/armhf-ports.list << EOF
deb [arch=armhf] http://ports.ubuntu.com/ubuntu-ports ${VERSION_CODENAME} main restricted universe
deb [arch=armhf] http://ports.ubuntu.com/ubuntu-ports ${VERSION_CODENAME}-updates main restricted universe
deb [arch=armhf] http://ports.ubuntu.com/ubuntu-ports ${VERSION_CODENAME}-security main restricted universe
EOF
sudo apt-get update
- name: Install dependencies
run: |
sudo apt-get install -y \
clang lld llvm \
gcc-arm-linux-gnueabihf \
meson ninja-build pkg-config \
libarchive-dev:armhf \
liblmdb-dev:armhf \
libsodium-dev:armhf \
libseccomp-dev:armhf
- name: Build yyjson for armhf
run: |
git clone --depth=1 https://github.com/ibireme/yyjson.git /tmp/yyjson
clang --target=arm-linux-gnueabihf -O2 -shared -fPIC \
-o /tmp/libyyjson.so /tmp/yyjson/src/yyjson.c
sudo cp /tmp/libyyjson.so /usr/lib/arm-linux-gnueabihf/
sudo cp /tmp/yyjson/src/yyjson.h /usr/include/
printf 'Name: yyjson\nDescription: Fast JSON library\nVersion: 0.0.0\nLibs: -L/usr/lib/arm-linux-gnueabihf -lyyjson\nCflags: -I/usr/include\n' | \
sudo tee /usr/lib/arm-linux-gnueabihf/pkgconfig/yyjson.pc
- name: Cross-compile
env:
PKG_CONFIG_LIBDIR: /usr/lib/arm-linux-gnueabihf/pkgconfig:/usr/share/pkgconfig
run: |
meson setup build-armhf \
--cross-file cross-arm.txt \
--buildtype=release
meson compile -C build-armhf
freebsd:
name: Build (FreeBSD x86_64)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build and test on FreeBSD
uses: cross-platform-actions/action@v1.3.0
with:
operating_system: freebsd
architecture: x86-64
version: '14.3'
run: |
sudo pkg install -y meson pkgconf ninja lmdb libarchive yyjson libsodium gpgme
meson setup build --buildtype=release
meson compile -C build
meson test -C build