-
Notifications
You must be signed in to change notification settings - Fork 0
205 lines (175 loc) · 6.11 KB
/
ci.yml
File metadata and controls
205 lines (175 loc) · 6.11 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
name: cloudSQL CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
style-check:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
- name: Run clang-format fix
run: |
sudo apt-get update
sudo apt-get install -y clang-format
find src include tests -name "*.cpp" -o -name "*.hpp" | xargs clang-format -i
- name: Commit style fixes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "style: automated clang-format fixes"
build:
needs: style-check
runs-on: ubuntu-latest
strategy:
matrix:
compiler: [clang++, g++]
sanitizer: [address, thread]
exclude:
- compiler: g++
sanitizer: thread # Focus TSan on Clang for faster CI
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y cmake clang clang-tidy llvm ninja-build ccache || (sleep 10 && sudo apt-get update && sudo apt-get install -y cmake clang clang-tidy llvm ninja-build ccache)
- name: Cache ccache
uses: actions/cache@v4
with:
path: ~/.ccache
key: ${{ runner.os }}-${{ matrix.compiler }}-${{ matrix.sanitizer }}-ccache-${{ github.sha }}
restore-keys: |
${{ runner.os }}-${{ matrix.compiler }}-${{ matrix.sanitizer }}-ccache-
- name: Configure CMake
run: |
mkdir build
cd build
export CCACHE_DIR=~/.ccache
cmake .. -G Ninja \
-DCMAKE_CXX_COMPILER=${{ matrix.compiler }} \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DUSE_SANITIZER=${{ matrix.sanitizer }} \
-DBUILD_TESTS=ON \
-DSTRICT_LINT=OFF \
-DCMAKE_CXX_CLANG_TIDY="" \
-DBUILD_COVERAGE=${{ matrix.sanitizer == 'address' && 'ON' || 'OFF' }}
- name: Build
run: |
cd build
ninja sqlEngineCore
ninja
- name: Upload Build Artifacts
uses: actions/upload-artifact@v4
with:
name: build-${{ matrix.compiler }}-${{ matrix.sanitizer }}
path: build/
include-hidden-files: true
test:
needs: build
runs-on: ubuntu-latest
strategy:
matrix:
compiler: [clang++, g++]
sanitizer: [address, thread]
exclude:
- compiler: g++
sanitizer: thread
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y lcov python3 llvm || (sleep 10 && sudo apt-get update && sudo apt-get install -y lcov python3 llvm)
- name: Download Build Artifacts
uses: actions/download-artifact@v4
with:
name: build-${{ matrix.compiler }}-${{ matrix.sanitizer }}
path: build/
- name: Restore Permissions
run: |
chmod +x build/cloudSQL
chmod +x build/*_tests || true
- name: Run Unit Tests
run: |
cd build
ctest --output-on-failure
- name: Run Distributed Tests
run: |
./tests/run_dist_test.sh tests/logic/*.slt
- name: Generate Coverage Report
if: matrix.sanitizer == 'address' && matrix.compiler == 'clang++'
run: |
cd build
lcov --directory . --capture --output-file coverage.info --gcov-tool "$GITHUB_WORKSPACE/.github/scripts/llvm-gcov.sh" --ignore-errors inconsistent
lcov --remove coverage.info '/usr/*' '*/tests/*' '*/CMakeFiles/*' '*/_deps/*' --output-file filtered_coverage.info --ignore-errors inconsistent,unused
genhtml filtered_coverage.info --output-directory out_coverage --ignore-errors inconsistent
- name: Upload Coverage
if: matrix.sanitizer == 'address' && matrix.compiler == 'clang++'
uses: actions/upload-artifact@v4
with:
name: code-coverage-report
path: build/out_coverage
- name: Upload Binaries
if: matrix.sanitizer == 'address'
uses: actions/upload-artifact@v4
with:
name: cloudsql-bin-${{ matrix.compiler }}
path: build/cloudSQL
performance-benchmarks:
needs: style-check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y cmake clang ninja-build ccache python3
- name: Configure CMake (Release)
run: |
mkdir build
cd build
cmake .. -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_BENCHMARKS=ON \
-DBUILD_TESTS=OFF
- name: Build Benchmarks
run: |
cd build
ninja storage_bench execution_bench network_bench
- name: Restore Performance Baseline
id: restore-baseline
uses: actions/cache/restore@v4
with:
path: build/baseline.json
key: perf-baseline-${{ runner.os }}-main
- name: Run Benchmarks
run: |
cd build
./storage_bench --benchmark_format=json > storage.json
./execution_bench --benchmark_format=json > execution.json
./network_bench --benchmark_format=json > network.json
# Merge results into one current.json
python3 -c "import json; s=json.load(open('storage.json')); e=json.load(open('execution.json')); n=json.load(open('network.json')); s['benchmarks'].extend(e['benchmarks']); s['benchmarks'].extend(n['benchmarks']); json.dump(s, open('current.json', 'w'))"
- name: Check for Performance Regressions
run: |
if [ -f build/baseline.json ]; then
python3 scripts/check_perf_regression.py build/current.json build/baseline.json 0.20
else
echo "No baseline found to compare against."
fi
- name: Save New Baseline
if: github.ref == 'refs/heads/main'
uses: actions/cache/save@v4
with:
path: build/current.json
key: perf-baseline-${{ runner.os }}-main-${{ github.sha }}
- name: Upload Current Results
uses: actions/upload-artifact@v4
with:
name: performance-results
path: build/current.json