fix: resolve TSan data races and CI configuration errors #10
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: cloudSQL CI | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| style-check: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Run clang-format check | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y clang-format | |
| find src include tests -name "*.cpp" -o -name "*.hpp" | xargs clang-format --dry-run --Werror | |
| build-and-test: | |
| 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 lcov | |
| - 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 \ | |
| -DBUILD_COVERAGE=${{ matrix.sanitizer == 'address' && 'ON' || 'OFF' }} | |
| - name: Build | |
| run: | | |
| cd build | |
| ninja sqlEngineCore | |
| ninja | |
| - name: Run Tests | |
| run: | | |
| cd build | |
| ./sqlEngine_tests | |
| ./lock_manager_tests | |
| ./server_tests | |
| ./transaction_manager_tests | |
| ./statement_tests | |
| ./recovery_tests | |
| - name: Generate Coverage Report | |
| if: matrix.sanitizer == 'address' && matrix.compiler == 'clang++' | |
| run: | | |
| cd build | |
| lcov --directory . --capture --output-file coverage.info | |
| lcov --remove coverage.info '/usr/*' '*/tests/*' '*/CMakeFiles/*' --output-file filtered_coverage.info | |
| genhtml filtered_coverage.info --output-directory out_coverage | |
| - 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/sqlEngine |