From 70a5959e5da9c7fc48942fa4809f44b295457708 Mon Sep 17 00:00:00 2001 From: shenxianpeng Date: Fri, 4 Jul 2025 22:17:08 +0300 Subject: [PATCH 01/11] 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/11] 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/11] 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/11] 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/11] 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/11] 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/11] 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/11] 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/11] 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/11] 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/11] 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: |