-
Notifications
You must be signed in to change notification settings - Fork 89
231 lines (216 loc) · 8.58 KB
/
Copy pathci.yml
File metadata and controls
231 lines (216 loc) · 8.58 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
# libdb continuous integration.
#
# Builds the living fork (master) and PRs across as many of the platforms,
# compilers, and configure options that Berkeley DB and GitHub-hosted runners
# both support. Experimental/best-effort jobs are marked continue-on-error so
# they inform without gating.
name: CI
on:
push:
branches: [master]
pull_request:
workflow_dispatch:
inputs:
full_tcl:
description: 'Run the full TCL regression suite (long)'
type: boolean
default: false
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
# ----------------------------------------------------------------------------
# POSIX builds: Linux + macOS, gcc + clang, across configure variants.
# ----------------------------------------------------------------------------
posix:
name: ${{ matrix.os }} ${{ matrix.cc }} ${{ matrix.config }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, ubuntu-22.04, macos-latest, macos-14]
cc: [gcc, clang]
config: [default, debug, cxx, sql, no-crypto, smallbuild]
exclude:
# Reduce fan-out: only exercise the full config set on ubuntu-latest.
- { os: ubuntu-22.04, config: cxx }
- { os: ubuntu-22.04, config: sql }
- { os: ubuntu-22.04, config: no-crypto }
- { os: ubuntu-22.04, config: smallbuild }
- { os: macos-14, config: cxx }
- { os: macos-14, config: sql }
- { os: macos-14, config: no-crypto }
- { os: macos-14, config: smallbuild }
# BDB's C++ headers don't compile against Xcode's libc++ <atomic>.
- { os: macos-latest, config: cxx }
env:
CC: ${{ matrix.cc }}
steps:
- uses: actions/checkout@v4
- name: Map config to configure flags
id: cfg
run: |
case "${{ matrix.config }}" in
default) flags="" ;;
debug) flags="--enable-debug --enable-diagnostic" ;;
cxx) flags="--enable-cxx" ;;
sql) flags="--enable-sql" ;;
no-crypto) flags="--disable-cryptography" ;;
smallbuild) flags="--enable-smallbuild" ;;
esac
echo "flags=$flags" >> "$GITHUB_OUTPUT"
- name: Configure
working-directory: build_unix
run: ../dist/configure ${{ steps.cfg.outputs.flags }}
- name: Build
working-directory: build_unix
run: make -j$(getconf _NPROCESSORS_ONLN 2>/dev/null || sysctl -n hw.ncpu)
- name: Smoke test (C API)
working-directory: build_unix
run: |
# ex_access exercises open/put/get/cursor on a btree.
make ex_access 2>/dev/null || true
ls -l libdb-*.a 2>/dev/null || ls -l .libs/libdb-*.* 2>/dev/null || true
# ----------------------------------------------------------------------------
# 32-bit build on Linux (pointer-size / portability coverage).
# ----------------------------------------------------------------------------
linux-32bit:
name: ubuntu 32-bit
runs-on: ubuntu-latest
continue-on-error: true
steps:
- uses: actions/checkout@v4
- name: Install 32-bit toolchain
run: |
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install -y gcc-multilib g++-multilib
- name: Configure (32-bit)
working-directory: build_unix
run: ../dist/configure --build=i686-pc-linux-gnu --with-mutex=POSIX/pthreads "CFLAGS=-m32" "LDFLAGS=-m32"
- name: Build
working-directory: build_unix
run: make -j$(nproc)
# ----------------------------------------------------------------------------
# AddressSanitizer / UBSan build + smoke (catches memory/UB regressions).
# ----------------------------------------------------------------------------
sanitizers:
name: clang asan+ubsan
runs-on: ubuntu-latest
continue-on-error: true
env:
CC: clang
steps:
- uses: actions/checkout@v4
- name: Configure (sanitizers)
working-directory: build_unix
run: ../dist/configure --enable-debug "CFLAGS=-fsanitize=address,undefined -fno-omit-frame-pointer -g"
- name: Build
working-directory: build_unix
run: make -j$(nproc)
# ----------------------------------------------------------------------------
# TCL test suite (targeted by default; full suite on manual dispatch).
# ----------------------------------------------------------------------------
tcl-tests:
name: tcl tests (${{ github.event.inputs.full_tcl == 'true' && 'full' || 'targeted' }})
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Tcl
run: sudo apt-get update && sudo apt-get install -y tcl-dev tcl
- name: Configure (test + tcl)
working-directory: build_unix
run: ../dist/configure --enable-debug --enable-test --with-tcl=/usr/lib/tcl8.6
- name: Build
working-directory: build_unix
run: make -j$(nproc)
- name: Run tests
working-directory: build_unix
run: |
if [ "${{ github.event.inputs.full_tcl }}" = "true" ]; then
cat > /tmp/run.tcl <<'TCL'
source ../test/tcl/test.tcl
run_std
TCL
else
cat > /tmp/run.tcl <<'TCL'
source ../test/tcl/test.tcl
foreach t {lock001 txn001 test001 ssi001 ssi002} {
source ../test/tcl/$t.tcl
set a {}
if {$t eq "test001"} { set a btree }
if {[catch {eval $t $a} res]} { puts "FAIL $t: $res"; exit 1 }
puts "PASS $t"
}
TCL
fi
timeout 3600 tclsh /tmp/run.tcl 2>&1 | tee /tmp/out.txt
! grep -qE "^FAIL|FAIL:" /tmp/out.txt
# ----------------------------------------------------------------------------
# Windows build via the bundled Visual Studio solution (best-effort).
# ----------------------------------------------------------------------------
windows:
name: windows msbuild
runs-on: windows-latest
continue-on-error: true
steps:
- uses: actions/checkout@v4
- uses: microsoft/setup-msbuild@v2
- name: Build Berkeley DB library
shell: cmd
working-directory: build_windows
# Use the VS2010 (.vcxproj) solution -- the legacy Berkeley_DB.sln uses
# VS2008 .vcproj files MSBuild can no longer load (MSB4025). Build only
# the `db` library project and retarget to the runner's toolset/SDK.
run: msbuild Berkeley_DB_vs2010.sln /m /t:db /p:Configuration=Release /p:Platform=x64 /p:PlatformToolset=v143 /p:WindowsTargetPlatformVersion=10.0
# ----------------------------------------------------------------------------
# Meson/Ninja build of the core library (parallel build system).
# ----------------------------------------------------------------------------
meson:
name: meson/ninja ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install Meson + Ninja
run: python -m pip install --upgrade meson ninja
- name: Configure (Ninja backend)
run: meson setup build-meson
- name: Build
run: ninja -C build-meson
- name: Smoke test (link + db_version)
run: |
cat > /tmp/smoke.c <<'EOF'
#include <stdio.h>
#include "db.h"
int main(void){int a,b,c;char *s=db_version(&a,&b,&c);
printf("libdb %s (%d.%d.%d)\n",s,a,b,c);return 0;}
EOF
cc /tmp/smoke.c -Ibuild-meson -Lbuild-meson -ldb -o /tmp/smoke
if [ "$RUNNER_OS" = "macOS" ]; then export DYLD_LIBRARY_PATH=build-meson; else export LD_LIBRARY_PATH=build-meson; fi
/tmp/smoke
# ----------------------------------------------------------------------------
# Nix flake: build the default package via `nix build`.
# ----------------------------------------------------------------------------
nix-flake:
name: nix flake build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Nix (flakes enabled)
uses: cachix/install-nix-action@v27
with:
extra_nix_config: |
experimental-features = nix-command flakes
- name: Build the flake's default package
run: nix build .#libdb-meson --print-build-logs
- name: Show result
run: ls -l result/lib