Skip to content

feat: add e2e.yml #83

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 15 commits into
base: main
Choose a base branch
from
Open
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 63 additions & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: End-to-End 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:
e2e-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Python 3.13
uses: actions/setup-python@v4
with:
python-version: '3.13'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pre-commit

Comment on lines +35 to +39
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Install the required clang-format binary
The workflow relies on clang-format (potentially version 20) being present on the runner, but nothing installs it. Without the binary every run will fail. Add an explicit install step before running pre-commit.

       - name: Install dependencies
         run: |
+          sudo apt-get update
+          sudo apt-get install -y clang-format-${{ github.event.inputs.clang_version || '20' }}
           python -m pip install --upgrade pip
           python -m pip install pre-commit
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pre-commit
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y clang-format-${{ github.event.inputs.clang_version || '20' }}
python -m pip install --upgrade pip
python -m pip install pre-commit
🤖 Prompt for AI Agents
In .github/workflows/e2e.yml around lines 35 to 39, the workflow installs pip
and pre-commit but does not install the required clang-format binary, causing
runs to fail. Add a step before installing pre-commit to explicitly install
clang-format on the runner, ensuring the correct version is available for
pre-commit hooks.

- 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.3
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
run: |
cd test-repo
pre-commit install
pre-commit run --all-files
Loading