diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml new file mode 100644 index 0000000..e91cc50 --- /dev/null +++ b/.github/workflows/e2e.yml @@ -0,0 +1,68 @@ +name: E2E Test + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + workflow_dispatch: + inputs: + target_repo: + 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 + default: 'file' + +jobs: + e2e-test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.13' + + - 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 || 'llvm/llvm-project' }}.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/pre-commit/mirrors-clang-format + rev: v20.1.7 + hooks: + - id: clang-format + 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: | + cd test-repo + pre-commit install + pre-commit run --all-files