From 70a5959e5da9c7fc48942fa4809f44b295457708 Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Fri, 4 Jul 2025 22:17:08 +0300 Subject: [PATCH 01/17] feat: add e2e.yml --- .github/workflows/e2e.yml | 64 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 .github/workflows/e2e.yml diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml new file mode 100644 index 0000000..22ab647 --- /dev/null +++ b/.github/workflows/e2e.yml @@ -0,0 +1,64 @@ +name: Large Codebase Functional Test + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + workflow_dispatch: + inputs: + target_repo: + description: 'Target repository to test against' + required: false + default: 'python/cpython' + clang_version: + description: 'Clang version to use' + required: false + default: '20' + style: + description: 'Clang-format style' + required: false + default: 'Google' + +jobs: + test: + name: Test cpp-linter-hooks + runs-on: ubuntu-latest + + steps: + - name: Checkout cpp-linter-hooks + uses: actions/checkout@v4 + + - name: Set up Python 3.11 + uses: actions/setup-python@v4 + with: + python-version: '3.11' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + python -m pip install pre-commit + + - name: Clone target repository + run: | + git clone --depth=1 https://github.com/${{ github.event.inputs.target_repo || 'python/cpython' }}.git test-repo + + - name: Replace pre-commit configuration + run: | + cd test-repo + rm -f .pre-commit-config.yaml + cat > .pre-commit-config.yaml << 'EOF' + repos: + - repo: https://github.com/cpp-linter/cpp-linter-hooks + rev: v0.8.1 + hooks: + - id: clang-format + args: [--style=${{ github.event.inputs.style || 'Google' }}, --version=${{ github.event.inputs.clang_version || '20' }}] + files: ^(.*\.(c|cc|cpp|cxx|h|hpp|hxx))$ + EOF + + - name: Install pre-commit hooks + run: | + cd test-repo + pre-commit install + pre-commit run --all-files From 3b4fee3d17a7b5759b50b42a8281e4d6621f52e7 Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Fri, 4 Jul 2025 23:17:31 +0300 Subject: [PATCH 02/17] chore: bump version to v0.8.3 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8162b8b..0af8b7b 100644 --- a/README.md +++ b/README.md @@ -172,7 +172,7 @@ This approach ensures that only modified files are checked, further speeding up ```yaml repos: - repo: https://github.com/cpp-linter/cpp-linter-hooks - rev: v0.8.1 + rev: v0.8.3 hooks: - id: clang-format args: [--style=file, --version=18, --verbose] # Add -v or --verbose for detailed output From e0f4b6dc427e3a27037ac21142cb9f47dca83564 Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Fri, 4 Jul 2025 23:20:46 +0300 Subject: [PATCH 03/17] chore: bump version to v0.8.3 --- .github/workflows/e2e.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 22ab647..76a0e0f 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -1,4 +1,4 @@ -name: Large Codebase Functional Test +name: End-to-End Test on: push: @@ -22,17 +22,16 @@ on: jobs: test: - name: Test cpp-linter-hooks runs-on: ubuntu-latest steps: - - name: Checkout cpp-linter-hooks + - name: Checkout uses: actions/checkout@v4 - - name: Set up Python 3.11 + - name: Set up Python 3.13 uses: actions/setup-python@v4 with: - python-version: '3.11' + python-version: '3.13' - name: Install dependencies run: | @@ -50,7 +49,7 @@ jobs: cat > .pre-commit-config.yaml << 'EOF' repos: - repo: https://github.com/cpp-linter/cpp-linter-hooks - rev: v0.8.1 + rev: v0.8.3 hooks: - id: clang-format args: [--style=${{ github.event.inputs.style || 'Google' }}, --version=${{ github.event.inputs.clang_version || '20' }}] From fb063a707c11bde9697ac65cdc7b409ec3877c01 Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Fri, 4 Jul 2025 23:22:11 +0300 Subject: [PATCH 04/17] revert change of readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0af8b7b..8162b8b 100644 --- a/README.md +++ b/README.md @@ -172,7 +172,7 @@ This approach ensures that only modified files are checked, further speeding up ```yaml repos: - repo: https://github.com/cpp-linter/cpp-linter-hooks - rev: v0.8.3 + rev: v0.8.1 hooks: - id: clang-format args: [--style=file, --version=18, --verbose] # Add -v or --verbose for detailed output From a855e93b64d4d1bcfd09e1655da40504e10d9f86 Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Sat, 5 Jul 2025 09:57:19 +0300 Subject: [PATCH 05/17] update pre-commit-config.yml --- .github/workflows/e2e.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 76a0e0f..3d770ca 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -54,9 +54,10 @@ jobs: - id: clang-format args: [--style=${{ github.event.inputs.style || 'Google' }}, --version=${{ github.event.inputs.clang_version || '20' }}] files: ^(.*\.(c|cc|cpp|cxx|h|hpp|hxx))$ + exclude: Modules/_ctypes/cfield.c EOF - - name: Install pre-commit hooks + - name: Install and run hooks run: | cd test-repo pre-commit install From adcb858d9c0e3b7ec70b6a3949e7296c924c4b81 Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Sat, 5 Jul 2025 10:00:54 +0300 Subject: [PATCH 06/17] update pre-commit-config.yml --- .github/workflows/e2e.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 3d770ca..661af9a 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -21,9 +21,8 @@ on: default: 'Google' jobs: - test: + e2e-test: runs-on: ubuntu-latest - steps: - name: Checkout uses: actions/checkout@v4 @@ -57,7 +56,7 @@ jobs: exclude: Modules/_ctypes/cfield.c EOF - - name: Install and run hooks + - name: Install and run hook run: | cd test-repo pre-commit install From 6827c724dbde978ee7bfc154b3f7f984ebfbf053 Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Sun, 6 Jul 2025 01:05:45 +0300 Subject: [PATCH 07/17] update e2e.yml --- .github/workflows/e2e.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 661af9a..ae577bc 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -1,4 +1,4 @@ -name: End-to-End Test +name: E2E Test on: push: @@ -48,7 +48,7 @@ jobs: cat > .pre-commit-config.yaml << 'EOF' repos: - repo: https://github.com/cpp-linter/cpp-linter-hooks - rev: v0.8.3 + rev: v1.0.0 hooks: - id: clang-format args: [--style=${{ github.event.inputs.style || 'Google' }}, --version=${{ github.event.inputs.clang_version || '20' }}] From a8f64d9097cede35a43eeba1ff80ada38fa43ac9 Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Sun, 6 Jul 2025 20:44:35 +0300 Subject: [PATCH 08/17] updare rev to main branch --- .github/workflows/e2e.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index ae577bc..eb01d67 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -48,7 +48,7 @@ jobs: cat > .pre-commit-config.yaml << 'EOF' repos: - repo: https://github.com/cpp-linter/cpp-linter-hooks - rev: v1.0.0 + rev: main hooks: - id: clang-format args: [--style=${{ github.event.inputs.style || 'Google' }}, --version=${{ github.event.inputs.clang_version || '20' }}] From 1f44868a10a3cdd198e03779061aedd84629ab52 Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Sun, 6 Jul 2025 20:46:22 +0300 Subject: [PATCH 09/17] update setup-python to v5 --- .github/workflows/e2e.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index eb01d67..021b4d9 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -27,8 +27,8 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - name: Set up Python 3.13 - uses: actions/setup-python@v4 + - name: Set up Python + uses: actions/setup-python@v5 with: python-version: '3.13' From 46af1854ddafead43cca95666bd77354688c8462 Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Sun, 6 Jul 2025 21:21:46 +0300 Subject: [PATCH 10/17] chagne to llvm-project --- .github/workflows/e2e.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 021b4d9..8dc4073 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -10,7 +10,7 @@ on: target_repo: description: 'Target repository to test against' required: false - default: 'python/cpython' + default: 'llvm/llvm-project' clang_version: description: 'Clang version to use' required: false @@ -18,7 +18,7 @@ on: style: description: 'Clang-format style' required: false - default: 'Google' + default: 'file' jobs: e2e-test: @@ -39,7 +39,7 @@ jobs: - name: Clone target repository run: | - git clone --depth=1 https://github.com/${{ github.event.inputs.target_repo || 'python/cpython' }}.git test-repo + git clone --depth=1 https://github.com/${{ github.event.inputs.target_repo || 'llvm/llvm-project' }}.git test-repo - name: Replace pre-commit configuration run: | @@ -52,8 +52,6 @@ jobs: hooks: - id: clang-format args: [--style=${{ github.event.inputs.style || 'Google' }}, --version=${{ github.event.inputs.clang_version || '20' }}] - files: ^(.*\.(c|cc|cpp|cxx|h|hpp|hxx))$ - exclude: Modules/_ctypes/cfield.c EOF - name: Install and run hook From a599c9f6c11ca9c5f500bd3ccb2caad2a34b27c2 Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Sun, 6 Jul 2025 22:56:22 +0300 Subject: [PATCH 11/17] change to other hooks for testing --- .github/workflows/e2e.yml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 8dc4073..e91cc50 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -47,12 +47,19 @@ jobs: rm -f .pre-commit-config.yaml cat > .pre-commit-config.yaml << 'EOF' repos: - - repo: https://github.com/cpp-linter/cpp-linter-hooks - rev: main + - repo: https://github.com/pre-commit/mirrors-clang-format + rev: v20.1.7 hooks: - id: clang-format - args: [--style=${{ github.event.inputs.style || 'Google' }}, --version=${{ github.event.inputs.clang_version || '20' }}] EOF + # cat > .pre-commit-config.yaml << 'EOF' + # repos: + # - repo: https://github.com/cpp-linter/cpp-linter-hooks + # rev: main + # hooks: + # - id: clang-format + # args: [--style=${{ github.event.inputs.style || 'Google' }}, --version=${{ github.event.inputs.clang_version || '20' }}] + # EOF - name: Install and run hook run: | From edcb8ff62f4a7baf311f0b6c7fe9e9614178c3ae Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Wed, 16 Jul 2025 16:59:15 +0300 Subject: [PATCH 12/17] Update e2e.yml --- .github/workflows/e2e.yml | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index e91cc50..80b21b0 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -11,10 +11,6 @@ on: description: 'Target repository to test against' required: false default: 'llvm/llvm-project' - clang_version: - description: 'Clang version to use' - required: false - default: '20' style: description: 'Clang-format style' required: false @@ -23,8 +19,14 @@ on: jobs: e2e-test: runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + clang_version: [13, 14, 15, 16, 17, 18, 19, 20] + + name: Clang ${{ matrix.clang_version }} steps: - - name: Checkout + - name: Checkout workflow repo uses: actions/checkout@v4 - name: Set up Python @@ -32,7 +34,7 @@ jobs: with: python-version: '3.13' - - name: Install dependencies + - name: Install Python dependencies run: | python -m pip install --upgrade pip python -m pip install pre-commit @@ -41,27 +43,23 @@ jobs: run: | git clone --depth=1 https://github.com/${{ github.event.inputs.target_repo || 'llvm/llvm-project' }}.git test-repo - - name: Replace pre-commit configuration + - name: Generate .pre-commit-config.yaml run: | cd test-repo rm -f .pre-commit-config.yaml - cat > .pre-commit-config.yaml << 'EOF' + cat > .pre-commit-config.yaml << EOF repos: - - repo: https://github.com/pre-commit/mirrors-clang-format - rev: v20.1.7 + - repo: https://github.com/cpp-linter/cpp-linter-hooks + rev: main hooks: - id: clang-format + args: [ + --style=${{ github.event.inputs.style || 'file' }}, + --version=${{ matrix.clang_version }} + ] EOF - # cat > .pre-commit-config.yaml << 'EOF' - # repos: - # - repo: https://github.com/cpp-linter/cpp-linter-hooks - # rev: main - # hooks: - # - id: clang-format - # args: [--style=${{ github.event.inputs.style || 'Google' }}, --version=${{ github.event.inputs.clang_version || '20' }}] - # EOF - - name: Install and run hook + - name: Install and run cpp-linter clang-format hook run: | cd test-repo pre-commit install From 295bba05f5106c852f381f7fbe6798ccdb8bef23 Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Wed, 16 Jul 2025 17:06:29 +0300 Subject: [PATCH 13/17] Update e2e.yml --- .github/workflows/e2e.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 80b21b0..4623658 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -22,9 +22,9 @@ jobs: strategy: fail-fast: false matrix: - clang_version: [13, 14, 15, 16, 17, 18, 19, 20] + clang_version: [16, 17, 18, 19, 20] - name: Clang ${{ matrix.clang_version }} + name: Test clang ${{ matrix.clang_version }} steps: - name: Checkout workflow repo uses: actions/checkout@v4 @@ -59,8 +59,8 @@ jobs: ] EOF - - name: Install and run cpp-linter clang-format hook + - name: Install and run cpp-linter-hooks run: | cd test-repo pre-commit install - pre-commit run --all-files + pre-commit run --all-files --show-diff-on-failure --verbose From 843fb3799764711426fedcd9ab5b96cba25c901e Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Wed, 16 Jul 2025 17:07:54 +0300 Subject: [PATCH 14/17] Update e2e.yml --- .github/workflows/e2e.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 4623658..08872e3 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -1,8 +1,6 @@ name: E2E Test on: - push: - branches: [ main ] pull_request: branches: [ main ] workflow_dispatch: From d9939be5e71ab8f67960f9b2729af7583bf968bc Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Wed, 16 Jul 2025 17:12:49 +0300 Subject: [PATCH 15/17] Update e2e.yml --- .github/workflows/e2e.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 08872e3..5dae8c9 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -61,4 +61,7 @@ jobs: run: | cd test-repo pre-commit install - pre-commit run --all-files --show-diff-on-failure --verbose + # Run clang-format in smaller chunks + for dir in $(find . -type d -name '*'); do + pre-commit run --files $(find "$dir" -name '*.cpp' -o -name '*.h' | head -n 1000) + done From 114e7d96159d88b070e63f38cfbb3e6f000eac85 Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Wed, 16 Jul 2025 21:57:13 +0300 Subject: [PATCH 16/17] Update e2e.yml --- .github/workflows/e2e.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 5dae8c9..74ee6f4 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -41,7 +41,7 @@ jobs: run: | git clone --depth=1 https://github.com/${{ github.event.inputs.target_repo || 'llvm/llvm-project' }}.git test-repo - - name: Generate .pre-commit-config.yaml + - name: Create .pre-commit-config.yaml run: | cd test-repo rm -f .pre-commit-config.yaml @@ -61,7 +61,4 @@ jobs: run: | cd test-repo pre-commit install - # Run clang-format in smaller chunks - for dir in $(find . -type d -name '*'); do - pre-commit run --files $(find "$dir" -name '*.cpp' -o -name '*.h' | head -n 1000) - done + pre-commit run --all-files || true From 36d3400216b7e3211643c8dab833b0c928644fdb Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Wed, 16 Jul 2025 22:28:15 +0300 Subject: [PATCH 17/17] Update e2e.yml --- .github/workflows/e2e.yml | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 74ee6f4..fae8f7b 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -9,10 +9,6 @@ on: description: 'Target repository to test against' required: false default: 'llvm/llvm-project' - style: - description: 'Clang-format style' - required: false - default: 'file' jobs: e2e-test: @@ -52,7 +48,7 @@ jobs: hooks: - id: clang-format args: [ - --style=${{ github.event.inputs.style || 'file' }}, + --style=LLVM, --version=${{ matrix.clang_version }} ] EOF @@ -61,4 +57,4 @@ jobs: run: | cd test-repo pre-commit install - pre-commit run --all-files || true + pre-commit run --all-files