Skip to content

Commit 8f871d2

Browse files
committed
chore: enhance CI with TSan, coverage artifacts, and binary packaging
1 parent f2dbae2 commit 8f871d2

1 file changed

Lines changed: 38 additions & 4 deletions

File tree

.github/workflows/ci.yml

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,33 +23,45 @@ jobs:
2323
strategy:
2424
matrix:
2525
compiler: [clang++, g++]
26+
sanitizer: [address, thread]
27+
exclude:
28+
- compiler: g++
29+
sanitizer: thread # Focus TSan on Clang for faster CI
2630

2731
steps:
2832
- uses: actions/checkout@v3
2933

3034
- name: Install dependencies
3135
run: |
3236
sudo apt-get update
33-
sudo apt-get install -y cmake clang clang-tidy llvm ninja-build ccache
37+
sudo apt-get install -y cmake clang clang-tidy llvm ninja-build ccache lcov
3438
3539
- name: Cache ccache
3640
uses: actions/cache@v3
3741
with:
3842
path: ~/.ccache
39-
key: ${{ runner.os }}-${{ matrix.compiler }}-ccache-${{ github.sha }}
43+
key: ${{ runner.os }}-${{ matrix.compiler }}-${{ matrix.sanitizer }}-ccache-${{ github.sha }}
4044
restore-keys: |
41-
${{ runner.os }}-${{ matrix.compiler }}-ccache-
45+
${{ runner.os }}-${{ matrix.compiler }}-${{ matrix.sanitizer }}-ccache-
4246
4347
- name: Configure CMake
4448
run: |
4549
mkdir build
4650
cd build
4751
export CCACHE_DIR=~/.ccache
52+
# Use matrix sanitizer. ThreadSanitizer requires specialized flags.
53+
if [ "${{ matrix.sanitizer }}" == "thread" ]; then
54+
SAN_FLAGS="-fsanitize=thread"
55+
else
56+
SAN_FLAGS="-fsanitize=address -fno-omit-frame-pointer"
57+
fi
58+
4859
cmake .. -G Ninja \
4960
-DCMAKE_CXX_COMPILER=${{ matrix.compiler }} \
5061
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
62+
-DCMAKE_CXX_FLAGS="$SAN_FLAGS" \
5163
-DBUILD_TESTS=ON \
52-
-DBUILD_COVERAGE=OFF
64+
-DBUILD_COVERAGE=${{ matrix.sanitizer == 'address' && 'ON' || 'OFF' }}
5365
5466
- name: Build
5567
run: |
@@ -66,3 +78,25 @@ jobs:
6678
./transaction_manager_tests
6779
./statement_tests
6880
./recovery_tests
81+
82+
- name: Generate Coverage Report
83+
if: matrix.sanitizer == 'address' && matrix.compiler == 'clang++'
84+
run: |
85+
cd build
86+
lcov --directory . --capture --output-file coverage.info
87+
lcov --remove coverage.info '/usr/*' '*/tests/*' '*/CMakeFiles/*' --output-file filtered_coverage.info
88+
genhtml filtered_coverage.info --output-directory out_coverage
89+
90+
- name: Upload Coverage
91+
if: matrix.sanitizer == 'address' && matrix.compiler == 'clang++'
92+
uses: actions/upload-artifact@v3
93+
with:
94+
name: code-coverage-report
95+
path: build/out_coverage
96+
97+
- name: Upload Binaries
98+
if: matrix.sanitizer == 'address'
99+
uses: actions/upload-artifact@v3
100+
with:
101+
name: cloudsql-bin-${{ matrix.compiler }}
102+
path: build/sqlEngine

0 commit comments

Comments
 (0)