From c02b4c188b4c05610b905219a6497a13f49867c9 Mon Sep 17 00:00:00 2001 From: Sascha Willems Date: Sun, 9 Nov 2025 10:24:08 +0100 Subject: [PATCH 1/2] Add clang format check Same as in the samples repo --- .github/workflows/quality-checks.yml | 41 ++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/quality-checks.yml diff --git a/.github/workflows/quality-checks.yml b/.github/workflows/quality-checks.yml new file mode 100644 index 00000000..f9ed6fcd --- /dev/null +++ b/.github/workflows/quality-checks.yml @@ -0,0 +1,41 @@ +name: Quality Checks + +on: + workflow_dispatch: + pull_request: + branches: [main] + +env: + TARGET_BRANCH: main + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} + cancel-in-progress: true + +jobs: + clang_format: + name: Clang Format Check + container: ghcr.io/khronosgroupactions/clang-tools:15.0.0 + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - run: git config --global --add safe.directory /__w/Vulkan-Tutorial/Vulkan-Tutorial + - run: git fetch origin $TARGET_BRANCH:$TARGET_BRANCH + - name: Run Clang Format diff + id: clang-diff + run: | + echo "changes=$(echo $(git diff -- '***.cpp' `***.h' -U0 --no-color $TARGET_BRANCH | python3 /usr/share/clang/clang-format-diff.py -p1 -v -sort-include))" >> $GITHUB_OUTPUT + echo "$(echo $(git diff -- '***.cpp' `***.h' -U0 --no-color $TARGET_BRANCH | python3 /usr/share/clang/clang-format-diff.py -p1 -v -sort-include))" >> clang-issues.diff + - name: Count Diff Lines + continue-on-error: true + id: count-diff + run: echo "line-count=$(echo "${{ steps.clang-diff.outputs.changes }}" | grep -c +++)" >> $GITHUB_OUTPUT + - name: 'Upload Artifact' + uses: actions/upload-artifact@v4 + with: + name: clang-issues.diff + path: clang-issues.diff + retention-days: 3 + - name: Assert + run: if test ${{ steps.count-diff.outputs.line-count }} -gt 0; then echo "${{ steps.clang-diff.outputs.changes }}"; exit 1; fi + From 80b19f18ba2a56b3e0e43809fefe49879c839ec9 Mon Sep 17 00:00:00 2001 From: Sascha Willems Date: Sun, 9 Nov 2025 10:37:14 +0100 Subject: [PATCH 2/2] Fix quotes --- .github/workflows/quality-checks.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/quality-checks.yml b/.github/workflows/quality-checks.yml index f9ed6fcd..2e8a3d72 100644 --- a/.github/workflows/quality-checks.yml +++ b/.github/workflows/quality-checks.yml @@ -24,8 +24,8 @@ jobs: - name: Run Clang Format diff id: clang-diff run: | - echo "changes=$(echo $(git diff -- '***.cpp' `***.h' -U0 --no-color $TARGET_BRANCH | python3 /usr/share/clang/clang-format-diff.py -p1 -v -sort-include))" >> $GITHUB_OUTPUT - echo "$(echo $(git diff -- '***.cpp' `***.h' -U0 --no-color $TARGET_BRANCH | python3 /usr/share/clang/clang-format-diff.py -p1 -v -sort-include))" >> clang-issues.diff + echo "changes=$(echo $(git diff -- '***.cpp' '***.h' -U0 --no-color $TARGET_BRANCH | python3 /usr/share/clang/clang-format-diff.py -p1 -v -sort-include))" >> $GITHUB_OUTPUT + echo "$(echo $(git diff -- '***.cpp' '***.h' -U0 --no-color $TARGET_BRANCH | python3 /usr/share/clang/clang-format-diff.py -p1 -v -sort-include))" >> clang-issues.diff - name: Count Diff Lines continue-on-error: true id: count-diff