chore: enable and fix clang-tidy check #338
Workflow file for this run
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: CI | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| permissions: | |
| pull-requests: write | |
| jobs: | |
| thread-mode: | |
| runs-on: ubuntu-latest | |
| container: | |
| image: zzjason/leanstore-dev:latest | |
| name: UT | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v3 | |
| - name: Config project | |
| run: | | |
| which vcpkg; | |
| cmake --preset debug_tsan | |
| - name: Cppcheck | |
| run: cppcheck --project=build/debug_tsan/compile_commands.json -i tests --error-exitcode=1 --check-level=exhaustive | |
| - name: Clang-format | |
| run: cmake --build build/debug_tsan --target=check-format | |
| - name: Build | |
| run: cmake --build build/debug_tsan -j `nproc` | |
| - name: Unit test with tsan | |
| run: TSAN_OPTIONS="suppressions=$(pwd)/tests/tsan.supp" ctest --test-dir build/debug_tsan --output-on-failure -j 2 | |
| - name: Generate coverage file | |
| run: gcovr -v -r . --xml-pretty --xml=coverage.xml --exclude 'build/*' --exclude 'tests/*' --exclude 'tools/*' --verbose | |
| - name: Upload coverage reports to Codecov | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| fail_ci_if_error: true | |
| files: coverage.xml | |
| verbose: true | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| coro-mode: | |
| runs-on: ubuntu-latest | |
| container: | |
| image: zzjason/leanstore-dev:latest | |
| name: "[COROUTINE] UT" | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v3 | |
| - name: Config project | |
| run: | | |
| which vcpkg; | |
| cmake --preset debug_coro | |
| - name: Run clang-tidy on changed files v1 | |
| run: | | |
| bash ".github/scripts/run-clang-tidy-pr.sh" \ | |
| "${{ github.event.pull_request.number }}" \ | |
| "${{ github.repository }}" \ | |
| "${{ secrets.GITHUB_TOKEN }}" \ | |
| "build/${{ matrix.build-config }}" | |
| - name: Run clang-tidy on changed files | |
| run: | | |
| BASE_SHA="${GITHUB_EVENT_PULL_REQUEST_BASE_SHA}" | |
| HEAD_SHA="${GITHUB_EVENT_PULL_REQUEST_HEAD_SHA}" | |
| MERGE_BASE=$(curl -s \ | |
| -H "Authorization: token ${GITHUB_TOKEN}" \ | |
| -H "Accept: application/vnd.github+json" \ | |
| "https://api.github.com/repos/${GITHUB_REPOSITORY}/compare/${BASE_SHA}...${HEAD_SHA}" \ | |
| | jq -r '.merge_base_commit.sha') | |
| echo "Merge base commit: $MERGE_BASE" | |
| git config --global --add safe.directory "${PWD}" | |
| git fetch --depth=1 origin ${MERGE_BASE} | |
| git fetch --depth=1 origin ${HEAD_SHA} | |
| FILES=$(git diff --name-only $MERGE_BASE $HEAD_SHA \ | |
| -- '*.cpp' '*.cc' '*.h' '*.hpp' '*.hh') | |
| echo "Changed C/C++ files:" | |
| echo "$FILES" | |
| if [ -z "$FILES" ]; then | |
| echo "No C/C++ files changed. Skipping clang-tidy." | |
| exit 0 | |
| fi | |
| run-clang-tidy \ | |
| -p=build/debug_coro \ | |
| -config-file=.clang-tidy \ | |
| -j `nproc` \ | |
| -extra-arg=-std=c++2b \ | |
| -extra-arg=-Wno-unknown-warning-option \ | |
| -quiet \ | |
| $FILES | |
| env: | |
| GITHUB_REPOSITORY: ${{ github.repository }} | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| GITHUB_EVENT_PULL_REQUEST_BASE_SHA: ${{ github.event.pull_request.base.sha }} | |
| GITHUB_EVENT_PULL_REQUEST_HEAD_SHA: ${{ github.event.pull_request.head.sha }} | |
| - name: Cppcheck | |
| run: cppcheck --project=build/debug_coro/compile_commands.json -i tests --error-exitcode=1 --check-level=exhaustive | |
| - name: Clang-format | |
| run: cmake --build build/debug_coro --target=check-format | |
| - name: Build | |
| run: cmake --build build/debug_coro -j `nproc` | |
| - name: Unit test with coroutine enabled | |
| run: ctest --test-dir build/debug_coro --output-on-failure -j 2 | |
| - name: Generate coverage file | |
| run: gcovr -v -r . --xml-pretty --xml=coverage_coro.xml --exclude 'build/*' --exclude 'tests/*' --exclude 'tools/*' --verbose | |
| - name: Upload coverage reports to Codecov | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| fail_ci_if_error: true | |
| files: coverage_coro.xml | |
| verbose: true | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| build-release-thread-mode: | |
| runs-on: ubuntu-latest | |
| container: | |
| image: zzjason/leanstore-dev:latest | |
| name: Build Release | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v3 | |
| - name: Config, build, install | |
| run: | | |
| which vcpkg; | |
| cmake --preset release_thread | |
| cmake --build build/release_thread -j `nproc` | |
| cmake --install build/release_thread | |
| - name: Package artifact | |
| run: | | |
| tar -czf leanstore-thread-mode.tar.gz dist/release_thread | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: leanstore-release-thread | |
| path: leanstore-thread-mode.tar.gz | |
| ycsb_b_basickv: | |
| runs-on: ubuntu-latest | |
| needs: [build-release-thread-mode] | |
| container: | |
| image: zzjason/leanstore-dev:latest | |
| name: Bench YCSB B on BasicKV | |
| steps: | |
| - name: Download artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: leanstore-release-thread | |
| - name: Unpack artifact | |
| run: | | |
| tar -xzf leanstore-thread-mode.tar.gz | |
| ldd ./dist/release_thread/bin/ycsb | |
| - name: YCSB data load | |
| run: | | |
| ./dist/release_thread/bin/ycsb --data_dir=/tmp/leanstore/thread \ | |
| --key_size=16 --val_size=200 --record_count=10000 --mem_gb=1 \ | |
| --target=basickv --workload=b \ | |
| --threads=2 --clients=6 \ | |
| --cmd=load | |
| - name: YCSB bench | |
| run: | | |
| ./dist/release_thread/bin/ycsb --data_dir=/tmp/leanstore/thread \ | |
| --key_size=16 --val_size=200 --record_count=10000 --mem_gb=1 \ | |
| --target=basickv --workload=b \ | |
| --threads=2 --clients=6 --run_for_seconds=30 \ | |
| --cmd=run > ycsb_b_basickv.out | |
| sed -i '1i**Bench YCSB B on BasicKV**\n```txt' ycsb_b_basickv.out | |
| echo '```' >> ycsb_b_basickv.out | |
| cat ycsb_b_basickv.out | |
| - name: Upload bench result | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ycsb_b_basickv.out | |
| path: ycsb_b_basickv.out | |
| ycsb_b_transactionkv: | |
| runs-on: ubuntu-latest | |
| needs: [build-release-thread-mode] | |
| container: | |
| image: zzjason/leanstore-dev:latest | |
| name: Bench YCSB B on TransactionKV | |
| steps: | |
| - name: Download artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: leanstore-release-thread | |
| - name: Unpack artifact | |
| run: | | |
| tar -xzf leanstore-thread-mode.tar.gz | |
| ldd ./dist/release_thread/bin/ycsb | |
| - name: YCSB data load | |
| run: | | |
| ./dist/release_thread/bin/ycsb --data_dir=/tmp/leanstore/thread \ | |
| --key_size=16 --val_size=200 --record_count=10000 --mem_gb=1 \ | |
| --target=transactionkv --workload=b \ | |
| --threads=2 --clients=6 \ | |
| --cmd=load | |
| - name: YCSB bench | |
| run: | | |
| ./dist/release_thread/bin/ycsb --data_dir=/tmp/leanstore/thread \ | |
| --key_size=16 --val_size=200 --record_count=10000 --mem_gb=1 \ | |
| --target=transactionkv --workload=b \ | |
| --threads=2 --clients=6 --run_for_seconds=30 \ | |
| --cmd=run > ycsb_b_transactionkv.out | |
| sed -i '1i**Bench YCSB B on TransactionKV**\n```txt' ycsb_b_transactionkv.out | |
| echo '```' >> ycsb_b_transactionkv.out | |
| cat ycsb_b_transactionkv.out | |
| - name: Upload bench result | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ycsb_b_transactionkv.out | |
| path: ycsb_b_transactionkv.out | |
| build-release-coro-mode: | |
| runs-on: ubuntu-latest | |
| container: | |
| image: zzjason/leanstore-dev:latest | |
| name: "[COROUTINE] Build Release" | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v3 | |
| - name: Config, build, install | |
| run: | | |
| which vcpkg; | |
| cmake --preset release_coro | |
| cmake --build build/release_coro -j `nproc` | |
| cmake --install build/release_coro | |
| - name: Package artifact | |
| run: | | |
| tar -czf leanstore-coro-mode.tar.gz dist/release_coro | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: leanstore-release-coro | |
| path: leanstore-coro-mode.tar.gz | |
| ycsb_b_coro_basickv: | |
| runs-on: ubuntu-latest | |
| needs: [build-release-coro-mode] | |
| container: | |
| image: zzjason/leanstore-dev:latest | |
| name: "[COROUTINE] Bench YCSB B on BasicKV" | |
| steps: | |
| - name: Download artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: leanstore-release-coro | |
| - name: Unpack artifact | |
| run: | | |
| tar -xzf leanstore-coro-mode.tar.gz | |
| LD_LIBRARY_PATH=./dist/release_coro/lib ldd ./dist/release_coro/bin/ycsb | |
| - name: YCSB data load | |
| run: | | |
| LD_LIBRARY_PATH=./dist/release_coro/lib ./dist/release_coro/bin/ycsb --data_dir=/tmp/leanstore/coro \ | |
| --key_size=16 --val_size=200 --record_count=10000 --mem_gb=1 \ | |
| --target=basickv --workload=b \ | |
| --threads=2 --clients=6 \ | |
| --cmd=load | |
| - name: YCSB bench | |
| run: | | |
| LD_LIBRARY_PATH=./dist/release_coro/lib ./dist/release_coro/bin/ycsb --data_dir=/tmp/leanstore/coro \ | |
| --key_size=16 --val_size=200 --record_count=10000 --mem_gb=1 \ | |
| --target=basickv --workload=b \ | |
| --threads=2 --clients=6 --run_for_seconds=30 \ | |
| --cmd=run > ycsb_b_coro_basickv.out | |
| sed -i '1i**[COROUTINE] Bench YCSB B on BasicKV**\n```txt' ycsb_b_coro_basickv.out | |
| echo '```' >> ycsb_b_coro_basickv.out | |
| cat ycsb_b_coro_basickv.out | |
| - name: Upload bench result | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ycsb_b_coro_basickv.out | |
| path: ycsb_b_coro_basickv.out | |
| ycsb_b_coro_transactionkv: | |
| runs-on: ubuntu-latest | |
| needs: [build-release-coro-mode] | |
| container: | |
| image: zzjason/leanstore-dev:latest | |
| name: "[COROUTINE] Bench YCSB B on TransactionKV" | |
| steps: | |
| - name: Download artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: leanstore-release-coro | |
| - name: Unpack artifact | |
| run: | | |
| tar -xzf leanstore-coro-mode.tar.gz | |
| LD_LIBRARY_PATH=./dist/release_coro/lib ldd ./dist/release_coro/bin/ycsb | |
| - name: YCSB data load | |
| run: | | |
| LD_LIBRARY_PATH=./dist/release_coro/lib ./dist/release_coro/bin/ycsb --data_dir=/tmp/leanstore/coro \ | |
| --key_size=16 --val_size=200 --record_count=10000 --mem_gb=1 \ | |
| --target=transactionkv --workload=b \ | |
| --threads=2 --clients=6 \ | |
| --cmd=load | |
| - name: YCSB bench | |
| run: | | |
| LD_LIBRARY_PATH=./dist/release_coro/lib ./dist/release_coro/bin/ycsb --data_dir=/tmp/leanstore/coro \ | |
| --key_size=16 --val_size=200 --record_count=10000 --mem_gb=1 \ | |
| --target=transactionkv --workload=b \ | |
| --threads=2 --clients=6 --run_for_seconds=30 \ | |
| --cmd=run > ycsb_b_coro_transactionkv.out | |
| sed -i '1i**[COROUTINE] Bench YCSB B on TransactionKV**\n```txt' ycsb_b_coro_transactionkv.out | |
| echo '```' >> ycsb_b_coro_transactionkv.out | |
| cat ycsb_b_coro_transactionkv.out | |
| - name: Upload bench result | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ycsb_b_coro_transactionkv.out | |
| path: ycsb_b_coro_transactionkv.out | |
| display-bench-results: | |
| runs-on: ubuntu-latest | |
| needs: [ycsb_b_basickv, ycsb_b_transactionkv, ycsb_b_coro_basickv, ycsb_b_coro_transactionkv] | |
| name: "Display Bench Results" | |
| steps: | |
| - name: Download ycsb_b_basickv.out | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: ycsb_b_basickv.out | |
| - name: Download ycsb_b_transactionkv.out | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: ycsb_b_transactionkv.out | |
| - name: Download ycsb_b_coro_basickv.out | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: ycsb_b_coro_basickv.out | |
| - name: Download ycsb_b_coro_transactionkv.out | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: ycsb_b_coro_transactionkv.out | |
| - name: Combine results | |
| run: | | |
| touch combined.out | |
| cat ycsb_b_basickv.out >> combined.out | |
| cat ycsb_b_coro_basickv.out >> combined.out | |
| cat ycsb_b_transactionkv.out >> combined.out | |
| cat ycsb_b_coro_transactionkv.out >> combined.out | |
| - name: Display results in comment | |
| uses: marocchino/sticky-pull-request-comment@v2 | |
| with: | |
| header: "YCSB Bench Results" | |
| path: combined.out | |
| example_coro_release: | |
| runs-on: ubuntu-latest | |
| needs: [build-release-coro-mode] | |
| container: | |
| image: zzjason/leanstore-dev:latest | |
| name: "[COROUTINE] Example C" | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v3 | |
| - name: Download artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: leanstore-release-coro | |
| - name: Unpack artifact | |
| run: | | |
| tar -xzf leanstore-coro-mode.tar.gz | |
| - name: Build and run C example | |
| run: | | |
| cd examples/c | |
| cmake -B build -S . \ | |
| -DLEANSTORE_INCLUDE_DIR=../../dist/release_coro/include \ | |
| -DLEANSTORE_LIBRARY_DIR=../../dist/release_coro/lib | |
| cmake --build build -j `nproc` | |
| ./build/kv_basic_example |