diff --git a/.github/workflows/clang_tidy.yaml b/.github/workflows/clang_tidy.yaml new file mode 100644 index 0000000..51549d6 --- /dev/null +++ b/.github/workflows/clang_tidy.yaml @@ -0,0 +1,53 @@ +name: Clang Tidy Linting + +on: + push: + workflow_dispatch: + +permissions: + contents: read + packages: read + +jobs: + clang-tidy-linting: + runs-on: ubuntu-latest + + container: + image: ghcr.io/hardcode3/bitbishop-ubuntu:latest + credentials: + username: ${{ github.actor }} + password: ${{ secrets.github_token }} + + steps: + - uses: actions/checkout@v4 + + - name: Install clang-tidy + run: | + apt-get update + apt-get install -y clang-tidy + + - name: Configure (clang_debug) + run: cmake --preset clang_debug + + - name: Run clang-tidy + shell: bash + run: | + set +e + cmake --build --preset clang_debug --target clang-tidy 2>&1 | tee clang_tidy_output.txt + CLANG_TIDY_EXIT_CODE=${PIPESTATUS[0]} # Capture CMake exit code, not tee + set -e + + if [ $CLANG_TIDY_EXIT_CODE -eq 0 ]; then + echo "
🟢 Clang Tidy Results (click to expand)" >> $GITHUB_STEP_SUMMARY + else + echo "## 🔴 Clang Tidy Results" >> $GITHUB_STEP_SUMMARY + fi + echo '' >> $GITHUB_STEP_SUMMARY + echo '```' >> $GITHUB_STEP_SUMMARY + cat clang_tidy_output.txt >> $GITHUB_STEP_SUMMARY + echo '```' >> $GITHUB_STEP_SUMMARY + if [ $CLANG_TIDY_EXIT_CODE -eq 0 ]; then + echo "
" >> $GITHUB_STEP_SUMMARY + fi + + exit $CLANG_TIDY_EXIT_CODE