-
Notifications
You must be signed in to change notification settings - Fork 1
274 lines (263 loc) · 9.39 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
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
name: Build
on:
merge_group:
push:
paths-ignore:
- 'mkdocs.yml'
- '*.sh'
branches:
- master
pull_request:
paths-ignore:
- 'docs/**'
- 'LICENSE.txt'
- 'mkdocs.yml'
- '*.md'
branches:
- master
concurrency:
group: build-${{ github.ref }}
cancel-in-progress: true
env:
CTEST_OUTPUT_ON_FAILURE: 1
SCCACHE_GHA_ENABLED: "true"
jobs:
# {{{ Common checks
check_PR_TODOs:
name: "Check PR-TODOs"
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- name: "Checking for open PR-related TODO items"
run: ./scripts/check-pr-todos.sh
check_clang_format:
name: "Check C++ style"
runs-on: ubuntu-22.04
env:
LLVM_VERSION: 19
steps:
- uses: actions/checkout@v4
- name: Install clang
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh $LLVM_VERSION
sudo apt-get install clang-format-$LLVM_VERSION
- name: "Clang-format"
run: find ./src/ \( -name "*.cpp" -o -name "*.h" \) -exec clang-format-19 --Werror --dry-run {} \;
check_clang_tidy:
name: "Check clang-tidy"
runs-on: ubuntu-24.04
if: github.ref != 'refs/heads/master'
steps:
- uses: actions/checkout@v4
- name: ccache
uses: hendrikmuhs/[email protected]
with:
key: "ccache-ubuntu2404-clang-tidy"
max-size: 256M
- name: "update APT database"
run: sudo apt -q update
- name: Install clang
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 20
sudo apt -qy install clang-tidy
- name: "install dependencies"
run: sudo apt install -y cmake ninja-build catch2 unixodbc-dev sqlite3 libsqlite3-dev libsqliteodbc uuid-dev
- name: Install GCC
run: sudo apt install -y g++-14
- name: "cmake"
run: |
cmake -S . -B build -G Ninja \
-D CMAKE_CXX_COMPILER="g++-14"
- name: "build"
run: cmake --build build
- name: "run clang-tidy"
# TODO: Reenable Model directory once design is working with Clang/Clang-Tidy
run: find ./src/ -name "*.cpp" -o -name "*.h" | grep -v Model | xargs -n 1 -P $(nproc) clang-tidy -format-style=file -p build
# }}}
# {{{ Windows
windows:
name: "Windows"
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- name: Run sccache-cache
uses: mozilla-actions/[email protected]
- name: "vcpkg: Install dependencies"
uses: lukka/[email protected]
id: runvcpkg
with:
vcpkgDirectory: ${{ runner.workspace }}/vcpkg
vcpkgGitCommitId: 80403036a665cb8fcc1a1b3e17593d20b03b2489
- name: "Generate build files"
run: cmake --preset windows-cl-release
env:
VCPKG_ROOT: "${{ runner.workspace }}/vcpkg"
- name: "Build"
run: cmake --build --preset windows-cl-release
- name: "Test"
if: false # TODO: Install sqliteodbc first
run: ctest --preset windows-cl-release
# }}}
# {{{ Ubuntu build CC matrix
ubuntu_build_cc_matrix:
strategy:
fail-fast: false
matrix:
cxx: [23]
build_type: ["RelWithDebInfo"]
compiler:
[
"GCC 14",
"Clang 19",
]
name: "Ubuntu Linux 24.04 (${{ matrix.compiler }}, C++${{ matrix.cxx }})"
runs-on: ubuntu-24.04
outputs:
id: "${{ matrix.compiler }} (C++${{ matrix.cxx }}, ${{ matrix.build_type }})"
steps:
- uses: actions/checkout@v4
- name: ccache
uses: hendrikmuhs/[email protected]
with:
key: "ccache-ubuntu2404-${{ matrix.compiler }}-${{ matrix.cxx }}-${{ matrix.build_type }}"
max-size: 256M
- name: "update APT database"
run: sudo apt -q update
- name: "Set up output var: CC_VERSION"
id: extract_matrix
run: |
CC_VERSION=$( echo "${{ matrix.compiler }}" | awk '{ print $2; }')
echo "CC_VERSION=${CC_VERSION}" >> "$GITHUB_OUTPUT"
- name: "install dependencies"
run: sudo apt install -y cmake ninja-build catch2 unixodbc-dev sqlite3 libsqlite3-dev libsqliteodbc uuid-dev
- name: "inspect"
run: |
dpkg -L unixodbc-common
dpkg -L unixodbc-dev
- name: Install GCC
if: ${{ startsWith(matrix.compiler, 'GCC') }}
run: sudo apt install -y g++-${{ steps.extract_matrix.outputs.CC_VERSION }}
- name: Install Clang
if: ${{ startsWith(matrix.compiler, 'Clang') }}
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh ${{ steps.extract_matrix.outputs.CC_VERSION }}
# What about: libc++-dev libc++abi-dev
sudo apt-get install -y \
clang-format-${{ steps.extract_matrix.outputs.CC_VERSION }} \
clang-${{ steps.extract_matrix.outputs.CC_VERSION }}
- name: "cmake"
run: |
CC_NAME=$(echo "${{ matrix.compiler }}" | awk '{ print tolower($1); }')
CC_VER=$( echo "${{ matrix.compiler }}" | awk '{ print $2; }')
test "${{ matrix.compiler }}" = "GCC 8" && EXTRA_CMAKE_FLAGS="$EXTRA_CMAKE_FLAGS -DPEDANTIC_COMPILER_WERROR=ON"
test "${CC_NAME}" = "gcc" && CC_EXE="g++"
if [[ "${CC_NAME}" = "clang" ]]; then
CC_EXE="clang++"
# CMAKE_CXX_FLAGS="-stdlib=libc++"
# CMAKE_EXE_LINKER_FLAGS="-stdlib=libc++ -lc++abi"
# EXTRA_CMAKE_FLAGS="$EXTRA_CMAKE_FLAGS -DENABLE_TIDY=ON"
# EXTRA_CMAKE_FLAGS="$EXTRA_CMAKE_FLAGS -DPEDANTIC_COMPILER_WERROR=OFF"
fi
cmake \
$EXTRA_CMAKE_FLAGS \
-DCMAKE_BUILD_TYPE="${{ matrix.build_type }}" \
-DCMAKE_CXX_STANDARD=${{ matrix.cxx }} \
-DCMAKE_CXX_COMPILER="${CC_EXE}-${CC_VER}" \
-DCMAKE_CXX_FLAGS="${CMAKE_CXX_FLAGS}" \
-DCMAKE_EXE_LINKER_FLAGS="${CMAKE_EXE_LINKER_FLAGS}" \
-DCMAKE_INSTALL_PREFIX="/usr/local" \
-DPEDANTIC_COMPILER_WERROR=OFF \
-DLIGHTWEIGHT_BUILD_SHARED=ON \
--preset linux-gcc-release
- name: "build"
run: cmake --build --preset linux-gcc-release -- -j3
# NB: Don't run the tests here, as we want to run them later for each individual database
# - name: "tests"
# run: ctest --preset linux-gcc-release
# NB: Don't run valgrind test here, as we want to run them later for each individual database
# - name: "Run tests through valgrind (without model tests)"
# run: |
# valgrind \
# --error-exitcode=1 \
# --leak-check=full \
# --leak-resolution=high \
# --num-callers=64 \
# out/build/linux-gcc-release/src/tests/LightweightTest '~[model]'
- name: "package tar.gz"
run: |
cpack --preset linux-gcc-release
cp out/package/linux-gcc-debug/Lightweight-*-Linux.tar.gz ./Lightweight-Linux-CI.tar.gz
- name: "Move tests to root directory"
run: mv out/build/linux-gcc-release/src/tests/LightweightTest .
- name: "Upload unit tests"
if: ${{ matrix.compiler == 'GCC 14' && matrix.cxx == '23' }}
uses: actions/upload-artifact@v4
with:
name: ubuntu2404-tests
path: |
Lightweight-Linux-CI.tar.gz
retention-days: 1
dbms_test_matrix:
strategy:
fail-fast: false
matrix:
database:
[
"SQLite3",
"MS SQL Server 2019",
"MS SQL Server 2022",
"PostgreSQL",
# TODO: "Oracle"
# TODO: "MySQL" or "MariaDB"
]
name: "Tests (${{ matrix.database }})"
runs-on: ubuntu-24.04
needs: [ubuntu_build_cc_matrix]
env:
DBMS: "${{ matrix.database }}"
steps:
- uses: actions/checkout@v4
- name: "Download unit test binaries"
uses: actions/download-artifact@v4
with:
name: ubuntu2404-tests
- name: "Extract package"
run: |
sudo tar -xvf Lightweight-Linux-CI.tar.gz --strip-components=1 -C /usr/local
- name: "install dependencies"
run: sudo apt install -y unixodbc-dev unixodbc odbcinst uuid-dev valgrind
- name: "Setup ${{ matrix.database }}"
id: setup
run: bash ./.github/prepare-test-run.sh "${{ matrix.database }}"
# Don't do ODBC tracing for now
# - name: "Enable ODBC tracing"
# run: |
# echo "[ODBC]" | sudo tee -a /etc/odbcinst.ini
# echo "Trace=Yes" | sudo tee -a /etc/odbcinst.ini
# echo "TraceFile=/dev/stdout" | sudo tee -a /etc/odbcinst.ini
- name: "~/.odbc.ini: set ServerName"
if: ${{ matrix.database == 'Oracle' }}
run: |
sed -i "s/ServerName =.*/ServerName = localhost/" ~/.odbc.ini
- name: "CI Debug prints"
if: ${{ matrix.database == 'Oracle' }}
run: |
echo "ODBC_CONNECTION_STRING=${{ steps.setup.outputs.ODBC_CONNECTION_STRING }}"
ldd /home/runner/oracle/instantclient_21_3/libsqora.so.21.1
- name: "Run SQL tests"
env:
ODBC_CONNECTION_STRING: "${{ steps.setup.outputs.ODBC_CONNECTION_STRING }}"
run: |
# Don't do --error-exitcode=1 for now
valgrind \
--leak-check=full \
--leak-resolution=high \
--num-callers=64 \
LightweightTest
# }}}