From 5877864fc873f91928360d2d99e1233fd40de14d Mon Sep 17 00:00:00 2001 From: Kevin Turcios Date: Thu, 9 Apr 2026 05:43:16 -0500 Subject: [PATCH 1/3] ci: consolidate required checks into single ci.yaml with gate job Replace 7 individual required-check workflows (unit-tests, mypy, 5 E2E tests) with a single ci.yaml following the astral-sh/ruff gate pattern: - determine-changes job uses native git diff (no third-party deps) - Each test job skipped at job level when paths don't match - Single required-checks-passed gate job accepts success + skipped - E2E security preserved: environment gating, author allowlists This fixes the long-standing issue where workflow-level path filters leave required checks "Pending" on PRs that don't touch code paths, blocking merge without admin override. Estimated savings: ~$1.05/skipped PR ($0.64 unit-tests + $0.01 type-check + $0.40 E2E), ~$50-100/yr in compute, plus eliminating all admin-merge workarounds. --- .github/workflows/ci.yaml | 477 ++++++++++++++++++ .../e2e-bubblesort-pytest-nogit.yaml | 92 ---- .../workflows/e2e-bubblesort-unittest.yaml | 76 --- .../workflows/e2e-futurehouse-structure.yaml | 76 --- .github/workflows/e2e-topological-sort.yaml | 101 ---- .github/workflows/e2e-tracer-replay.yaml | 76 --- .github/workflows/mypy.yml | 43 -- .github/workflows/unit-tests.yaml | 85 ---- 8 files changed, 477 insertions(+), 549 deletions(-) create mode 100644 .github/workflows/ci.yaml delete mode 100644 .github/workflows/e2e-bubblesort-pytest-nogit.yaml delete mode 100644 .github/workflows/e2e-bubblesort-unittest.yaml delete mode 100644 .github/workflows/e2e-futurehouse-structure.yaml delete mode 100644 .github/workflows/e2e-topological-sort.yaml delete mode 100644 .github/workflows/e2e-tracer-replay.yaml delete mode 100644 .github/workflows/mypy.yml delete mode 100644 .github/workflows/unit-tests.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 000000000..144477bd4 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,477 @@ +name: CI + +on: + push: + branches: [main] + paths: + - 'codeflash/**' + - 'codeflash-benchmark/**' + - 'codeflash-java-runtime/**' + - 'tests/**' + - 'packages/**' + - 'pyproject.toml' + - 'uv.lock' + - 'mypy_allowlist.txt' + pull_request: + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref_name }} + cancel-in-progress: true + +jobs: + # --------------------------------------------------------------------------- + # Change detection — decides which downstream jobs actually run. + # On push/workflow_dispatch every flag is true so all jobs execute. + # On pull_request we diff against the merge base (same approach as astral-sh/ruff). + # --------------------------------------------------------------------------- + determine-changes: + runs-on: ubuntu-latest + permissions: + contents: read + outputs: + unit_tests: ${{ github.event_name != 'pull_request' || steps.check.outputs.unit_tests == 'true' }} + type_check: ${{ github.event_name != 'pull_request' || steps.check.outputs.type_check == 'true' }} + e2e: ${{ github.event_name != 'pull_request' || steps.check.outputs.e2e == 'true' }} + steps: + - uses: actions/checkout@v4 + if: github.event_name == 'pull_request' + with: + fetch-depth: 0 + + - name: Determine merge base + if: github.event_name == 'pull_request' + id: merge_base + run: | + sha=$(git merge-base HEAD "origin/${{ github.event.pull_request.base.ref }}") + echo "sha=${sha}" >> "$GITHUB_OUTPUT" + + - name: Check changed paths + if: github.event_name == 'pull_request' + id: check + run: | + check_paths() { + local name="$1"; shift + if ! git diff --quiet "$MERGE_BASE...HEAD" -- "$@" 2>/dev/null; then + echo "${name}=true" >> "$GITHUB_OUTPUT" + else + echo "${name}=false" >> "$GITHUB_OUTPUT" + fi + } + + # Unit tests: code + test infra + java + packages + build config + check_paths unit_tests \ + 'codeflash/' 'codeflash-benchmark/' 'codeflash-java-runtime/' \ + 'tests/' 'packages/' 'pyproject.toml' 'uv.lock' \ + '.github/workflows/ci.yaml' + + # Type checking: code + build config + mypy config + check_paths type_check \ + 'codeflash/' 'pyproject.toml' 'uv.lock' 'mypy_allowlist.txt' \ + '.github/workflows/ci.yaml' + + # E2E tests: code + tests + build config + this workflow + check_paths e2e \ + 'codeflash/' 'tests/' 'pyproject.toml' 'uv.lock' \ + '.github/workflows/ci.yaml' + env: + MERGE_BASE: ${{ steps.merge_base.outputs.sha }} + + # --------------------------------------------------------------------------- + # Unit tests — 6 Linux + 1 Windows matrix + # --------------------------------------------------------------------------- + unit-tests: + needs: determine-changes + if: needs.determine-changes.outputs.unit_tests == 'true' + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu-latest + python-version: "3.9" + - os: ubuntu-latest + python-version: "3.10" + - os: ubuntu-latest + python-version: "3.11" + - os: ubuntu-latest + python-version: "3.12" + - os: ubuntu-latest + python-version: "3.13" + - os: ubuntu-latest + python-version: "3.14" + - os: windows-latest + python-version: "3.13" + continue-on-error: true + runs-on: ${{ matrix.os }} + env: + PYTHONIOENCODING: utf-8 + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Set up JDK 11 + uses: actions/setup-java@v4 + with: + java-version: '11' + distribution: 'temurin' + cache: maven + + - name: Build codeflash-runtime JAR + run: | + cd codeflash-java-runtime + mvn clean package -q -DskipTests + mvn install -q -DskipTests + + - name: Install uv + uses: astral-sh/setup-uv@v8.0.0 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + run: uv sync + + - name: Install test-only dependencies (Python 3.9 and 3.13) + if: matrix.python-version == '3.9' || matrix.python-version == '3.13' + run: uv sync --group tests + + - name: Unit tests + run: uv run pytest tests/ + + # --------------------------------------------------------------------------- + # Mypy type checking + # --------------------------------------------------------------------------- + type-check: + needs: determine-changes + if: needs.determine-changes.outputs.type_check == 'true' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Install uv + uses: astral-sh/setup-uv@v8.0.0 + + - name: Install dependencies + run: | + uv venv --seed + uv sync + + - name: Run mypy + run: uv run mypy --non-interactive --config-file pyproject.toml @mypy_allowlist.txt + + # --------------------------------------------------------------------------- + # E2E tests — only on pull_request and workflow_dispatch (not push to main) + # --------------------------------------------------------------------------- + tracer-replay: + needs: determine-changes + if: >- + needs.determine-changes.outputs.e2e == 'true' + && github.event_name != 'push' + environment: ${{ (github.event_name == 'workflow_dispatch' || (contains(toJSON(github.event.pull_request.files.*.filename), '.github/workflows/') && github.event.pull_request.user.login != 'misrasaurabh1' && github.event.pull_request.user.login != 'KRRT7')) && 'external-trusted-contributors' || '' }} + runs-on: ubuntu-latest + env: + CODEFLASH_AIS_SERVER: prod + POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }} + CODEFLASH_API_KEY: ${{ secrets.CODEFLASH_API_KEY }} + COLUMNS: 110 + MAX_RETRIES: 3 + RETRY_DELAY: 5 + EXPECTED_IMPROVEMENT_PCT: 10 + CODEFLASH_END_TO_END: 1 + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.ref || '' }} + repository: ${{ github.event.pull_request.head.repo.full_name || '' }} + fetch-depth: 0 + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Validate PR + if: github.event_name == 'pull_request' + run: | + if git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.event.pull_request.head.sha }}" | grep -q "^.github/workflows/"; then + echo "Workflow changes detected." + AUTHOR="${{ github.event.pull_request.user.login }}" + if [[ "$AUTHOR" == "misrasaurabh1" || "$AUTHOR" == "KRRT7" ]]; then + echo "Authorized user ($AUTHOR). Proceeding." + elif [[ "${{ github.event.pull_request.state }}" == "open" ]]; then + echo "PR is open. Protection rules in place. Proceeding." + else + echo "Unauthorized user ($AUTHOR). Exiting." + exit 1 + fi + else + echo "No workflow file changes. Proceeding." + fi + + - name: Install uv + uses: astral-sh/setup-uv@v8.0.0 + with: + python-version: 3.11.6 + + - name: Install dependencies + run: uv sync + + - name: Run E2E test + run: uv run python tests/scripts/end_to_end_test_tracer_replay.py + + bubble-sort-pytest-nogit: + needs: determine-changes + if: >- + needs.determine-changes.outputs.e2e == 'true' + && github.event_name != 'push' + environment: ${{ (github.event_name == 'workflow_dispatch' || (contains(toJSON(github.event.pull_request.files.*.filename), '.github/workflows/') && github.event.pull_request.user.login != 'misrasaurabh1' && github.event.pull_request.user.login != 'KRRT7')) && 'external-trusted-contributors' || '' }} + runs-on: ubuntu-latest + env: + CODEFLASH_AIS_SERVER: prod + POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }} + CODEFLASH_API_KEY: ${{ secrets.CODEFLASH_API_KEY }} + COLUMNS: 110 + MAX_RETRIES: 3 + RETRY_DELAY: 5 + EXPECTED_IMPROVEMENT_PCT: 70 + CODEFLASH_END_TO_END: 1 + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.ref || '' }} + repository: ${{ github.event.pull_request.head.repo.full_name || '' }} + fetch-depth: 0 + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Validate PR + if: github.event_name == 'pull_request' + run: | + if git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.event.pull_request.head.sha }}" | grep -q "^.github/workflows/"; then + echo "Workflow changes detected." + AUTHOR="${{ github.event.pull_request.user.login }}" + if [[ "$AUTHOR" == "misrasaurabh1" || "$AUTHOR" == "KRRT7" ]]; then + echo "Authorized user ($AUTHOR). Proceeding." + elif [[ "${{ github.event.pull_request.state }}" == "open" ]]; then + echo "PR is open. Protection rules in place. Proceeding." + else + echo "Unauthorized user ($AUTHOR). Exiting." + exit 1 + fi + else + echo "No workflow file changes. Proceeding." + fi + + - name: Install uv + uses: astral-sh/setup-uv@v8.0.0 + with: + python-version: 3.11.6 + + - name: Install dependencies + run: uv sync + + - name: Remove .git + run: | + if [ -d ".git" ]; then + echo ".git directory exists!" + sudo rm -rf .git + if [ -d ".git" ]; then + echo ".git directory still exists after removal attempt!" + exit 1 + else + echo ".git directory successfully removed." + fi + else + echo ".git directory does not exist. Nothing to remove." + exit 1 + fi + + - name: Run E2E test + run: uv run python tests/scripts/end_to_end_test_bubblesort_pytest.py + + bubble-sort-unittest: + needs: determine-changes + if: >- + needs.determine-changes.outputs.e2e == 'true' + && github.event_name != 'push' + environment: ${{ (github.event_name == 'workflow_dispatch' || (contains(toJSON(github.event.pull_request.files.*.filename), '.github/workflows/') && github.event.pull_request.user.login != 'misrasaurabh1' && github.event.pull_request.user.login != 'KRRT7')) && 'external-trusted-contributors' || '' }} + runs-on: ubuntu-latest + env: + CODEFLASH_AIS_SERVER: prod + POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }} + CODEFLASH_API_KEY: ${{ secrets.CODEFLASH_API_KEY }} + COLUMNS: 110 + MAX_RETRIES: 3 + RETRY_DELAY: 5 + EXPECTED_IMPROVEMENT_PCT: 40 + CODEFLASH_END_TO_END: 1 + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.ref || '' }} + repository: ${{ github.event.pull_request.head.repo.full_name || '' }} + fetch-depth: 0 + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Validate PR + if: github.event_name == 'pull_request' + run: | + if git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.event.pull_request.head.sha }}" | grep -q "^.github/workflows/"; then + echo "Workflow changes detected." + AUTHOR="${{ github.event.pull_request.user.login }}" + if [[ "$AUTHOR" == "misrasaurabh1" || "$AUTHOR" == "KRRT7" ]]; then + echo "Authorized user ($AUTHOR). Proceeding." + elif [[ "${{ github.event.pull_request.state }}" == "open" ]]; then + echo "PR is open. Protection rules in place. Proceeding." + else + echo "Unauthorized user ($AUTHOR). Exiting." + exit 1 + fi + else + echo "No workflow file changes. Proceeding." + fi + + - name: Install uv + uses: astral-sh/setup-uv@v8.0.0 + with: + python-version: 3.11.6 + + - name: Install dependencies + run: uv sync + + - name: Run E2E test + run: uv run python tests/scripts/end_to_end_test_bubblesort_unittest.py + + futurehouse-structure: + needs: determine-changes + if: >- + needs.determine-changes.outputs.e2e == 'true' + && github.event_name != 'push' + environment: ${{ (github.event_name == 'workflow_dispatch' || (contains(toJSON(github.event.pull_request.files.*.filename), '.github/workflows/') && github.event.pull_request.user.login != 'misrasaurabh1' && github.event.pull_request.user.login != 'KRRT7')) && 'external-trusted-contributors' || '' }} + runs-on: ubuntu-latest + env: + CODEFLASH_AIS_SERVER: prod + POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }} + CODEFLASH_API_KEY: ${{ secrets.CODEFLASH_API_KEY }} + COLUMNS: 110 + MAX_RETRIES: 3 + RETRY_DELAY: 5 + EXPECTED_IMPROVEMENT_PCT: 5 + CODEFLASH_END_TO_END: 1 + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.ref || '' }} + repository: ${{ github.event.pull_request.head.repo.full_name || '' }} + fetch-depth: 0 + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Validate PR + if: github.event_name == 'pull_request' + run: | + if git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.event.pull_request.head.sha }}" | grep -q "^.github/workflows/"; then + echo "Workflow changes detected." + AUTHOR="${{ github.event.pull_request.user.login }}" + if [[ "$AUTHOR" == "misrasaurabh1" || "$AUTHOR" == "KRRT7" ]]; then + echo "Authorized user ($AUTHOR). Proceeding." + elif [[ "${{ github.event.pull_request.state }}" == "open" ]]; then + echo "PR is open. Protection rules in place. Proceeding." + else + echo "Unauthorized user ($AUTHOR). Exiting." + exit 1 + fi + else + echo "No workflow file changes. Proceeding." + fi + + - name: Install uv + uses: astral-sh/setup-uv@v8.0.0 + with: + python-version: 3.11.6 + + - name: Install dependencies + run: uv sync + + - name: Run E2E test + run: uv run python tests/scripts/end_to_end_test_futurehouse.py + + topological-sort: + needs: determine-changes + if: >- + needs.determine-changes.outputs.e2e == 'true' + && github.event_name != 'push' + environment: ${{ (github.event_name == 'workflow_dispatch' || (contains(toJSON(github.event.pull_request.files.*.filename), '.github/workflows/') && github.event.pull_request.user.login != 'misrasaurabh1' && github.event.pull_request.user.login != 'KRRT7')) && 'external-trusted-contributors' || '' }} + runs-on: ubuntu-latest + env: + CODEFLASH_AIS_SERVER: prod + POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }} + CODEFLASH_API_KEY: ${{ secrets.CODEFLASH_API_KEY }} + COLUMNS: 110 + MAX_RETRIES: 3 + RETRY_DELAY: 5 + EXPECTED_IMPROVEMENT_PCT: 5 + CODEFLASH_END_TO_END: 1 + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.ref || '' }} + repository: ${{ github.event.pull_request.head.repo.full_name || '' }} + fetch-depth: 0 + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Validate PR + if: github.event_name == 'pull_request' + run: | + if git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.event.pull_request.head.sha }}" | grep -q "^.github/workflows/"; then + echo "Workflow changes detected." + AUTHOR="${{ github.event.pull_request.user.login }}" + if [[ "$AUTHOR" == "misrasaurabh1" || "$AUTHOR" == "KRRT7" ]]; then + echo "Authorized user ($AUTHOR). Proceeding." + elif [[ "${{ github.event.pull_request.state }}" == "open" ]]; then + echo "PR is open. Protection rules in place. Proceeding." + else + echo "Unauthorized user ($AUTHOR). Exiting." + exit 1 + fi + else + echo "No workflow file changes. Proceeding." + fi + + - name: Install uv + uses: astral-sh/setup-uv@v8.0.0 + with: + python-version: 3.11.6 + + - name: Install dependencies + run: uv sync + + - name: Run E2E test + run: uv run python tests/scripts/end_to_end_test_topological_sort_worktree.py + + # --------------------------------------------------------------------------- + # Gate job — the ONLY required check in the GitHub ruleset. + # Accepts "success" and "skipped" (job skipped by change detection). + # Rejects "failure" and "cancelled". + # --------------------------------------------------------------------------- + required-checks-passed: + name: required checks passed + if: always() + needs: + - unit-tests + - type-check + - tracer-replay + - bubble-sort-pytest-nogit + - bubble-sort-unittest + - futurehouse-structure + - topological-sort + runs-on: ubuntu-latest + steps: + - name: Verify all required jobs passed + run: | + failing=$(echo "$NEEDS_JSON" | jq -r 'to_entries[] | select(.value.result != "success" and .value.result != "skipped") | "\(.key): \(.value.result)"') + if [ -n "$failing" ]; then + echo "Required jobs failed or were cancelled:" + echo "$failing" + exit 1 + fi + env: + NEEDS_JSON: ${{ toJSON(needs) }} diff --git a/.github/workflows/e2e-bubblesort-pytest-nogit.yaml b/.github/workflows/e2e-bubblesort-pytest-nogit.yaml deleted file mode 100644 index 10bf43dac..000000000 --- a/.github/workflows/e2e-bubblesort-pytest-nogit.yaml +++ /dev/null @@ -1,92 +0,0 @@ -name: E2E - Bubble Sort Pytest (No Git) - -on: - pull_request: - paths: - - 'codeflash/**' - - 'tests/**' - - 'pyproject.toml' - - 'uv.lock' - - '.github/workflows/e2e-*.yaml' - - workflow_dispatch: - -concurrency: - group: ${{ github.workflow }}-${{ github.ref_name }} - cancel-in-progress: true - -jobs: - bubble-sort-optimization-pytest-no-git: - # Dynamically determine if environment is needed only when workflow files change and contributor is external - environment: ${{ (github.event_name == 'workflow_dispatch' || (contains(toJSON(github.event.pull_request.files.*.filename), '.github/workflows/') && github.event.pull_request.user.login != 'misrasaurabh1' && github.event.pull_request.user.login != 'KRRT7')) && 'external-trusted-contributors' || '' }} - - runs-on: ubuntu-latest - env: - CODEFLASH_AIS_SERVER: prod - POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }} - CODEFLASH_API_KEY: ${{ secrets.CODEFLASH_API_KEY }} - COLUMNS: 110 - MAX_RETRIES: 3 - RETRY_DELAY: 5 - EXPECTED_IMPROVEMENT_PCT: 70 - CODEFLASH_END_TO_END: 1 - steps: - - name: 🛎️ Checkout - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.ref }} - repository: ${{ github.event.pull_request.head.repo.full_name }} - fetch-depth: 0 - token: ${{ secrets.GITHUB_TOKEN }} - - name: Validate PR - run: | - # Check for any workflow changes - if git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.event.pull_request.head.sha }}" | grep -q "^.github/workflows/"; then - echo "⚠️ Workflow changes detected." - - # Get the PR author - AUTHOR="${{ github.event.pull_request.user.login }}" - echo "PR Author: $AUTHOR" - - # Allowlist check - if [[ "$AUTHOR" == "misrasaurabh1" || "$AUTHOR" == "KRRT7" ]]; then - echo "✅ Authorized user ($AUTHOR). Proceeding." - elif [[ "${{ github.event.pull_request.state }}" == "open" ]]; then - echo "✅ PR triggered by 'pull_request_target' and is open. Assuming protection rules are in place. Proceeding." - else - echo "⛔ Unauthorized user ($AUTHOR) attempting to modify workflows. Exiting." - exit 1 - fi - else - echo "✅ No workflow file changes detected. Proceeding." - fi - - - name: Set up Python 3.11 for CLI - uses: astral-sh/setup-uv@v8.0.0 - with: - python-version: 3.11.6 - - - name: Install dependencies (CLI) - run: | - uv sync - - - name: Remove .git - run: | - if [ -d ".git" ]; then - echo ".git directory exists!" - sudo rm -rf .git - if [ -d ".git" ]; then - echo ".git directory still exists after removal attempt!" - exit 1 - else - echo ".git directory successfully removed." - fi - else - echo ".git directory does not exist. Nothing to remove." - exit 1 - fi - - - name: Run Codeflash to optimize code - id: optimize_code - run: | - uv run python tests/scripts/end_to_end_test_bubblesort_pytest.py diff --git a/.github/workflows/e2e-bubblesort-unittest.yaml b/.github/workflows/e2e-bubblesort-unittest.yaml deleted file mode 100644 index 7fa012b44..000000000 --- a/.github/workflows/e2e-bubblesort-unittest.yaml +++ /dev/null @@ -1,76 +0,0 @@ -name: E2E - Bubble Sort Unittest - -on: - pull_request: - paths: - - 'codeflash/**' - - 'tests/**' - - 'pyproject.toml' - - 'uv.lock' - - '.github/workflows/e2e-*.yaml' - - workflow_dispatch: - -concurrency: - group: ${{ github.workflow }}-${{ github.ref_name }} - cancel-in-progress: true - -jobs: - bubble-sort-optimization-unittest: - # Dynamically determine if environment is needed only when workflow files change and contributor is external - environment: ${{ (github.event_name == 'workflow_dispatch' || (contains(toJSON(github.event.pull_request.files.*.filename), '.github/workflows/') && github.event.pull_request.user.login != 'misrasaurabh1' && github.event.pull_request.user.login != 'KRRT7')) && 'external-trusted-contributors' || '' }} - - runs-on: ubuntu-latest - env: - CODEFLASH_AIS_SERVER: prod - POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }} - CODEFLASH_API_KEY: ${{ secrets.CODEFLASH_API_KEY }} - COLUMNS: 110 - MAX_RETRIES: 3 - RETRY_DELAY: 5 - EXPECTED_IMPROVEMENT_PCT: 40 - CODEFLASH_END_TO_END: 1 - steps: - - name: 🛎️ Checkout - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.ref }} - repository: ${{ github.event.pull_request.head.repo.full_name }} - fetch-depth: 0 - token: ${{ secrets.GITHUB_TOKEN }} - - name: Validate PR - run: | - # Check for any workflow changes - if git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.event.pull_request.head.sha }}" | grep -q "^.github/workflows/"; then - echo "⚠️ Workflow changes detected." - - # Get the PR author - AUTHOR="${{ github.event.pull_request.user.login }}" - echo "PR Author: $AUTHOR" - - # Allowlist check - if [[ "$AUTHOR" == "misrasaurabh1" || "$AUTHOR" == "KRRT7" ]]; then - echo "✅ Authorized user ($AUTHOR). Proceeding." - elif [[ "${{ github.event.pull_request.state }}" == "open" ]]; then - echo "✅ PR triggered by 'pull_request_target' and is open. Assuming protection rules are in place. Proceeding." - else - echo "⛔ Unauthorized user ($AUTHOR) attempting to modify workflows. Exiting." - exit 1 - fi - else - echo "✅ No workflow file changes detected. Proceeding." - fi - - - name: Set up Python 3.11 for CLI - uses: astral-sh/setup-uv@v8.0.0 - with: - python-version: 3.11.6 - - - name: Install dependencies (CLI) - run: | - uv sync - - - name: Run Codeflash to optimize code - id: optimize_code - run: | - uv run python tests/scripts/end_to_end_test_bubblesort_unittest.py \ No newline at end of file diff --git a/.github/workflows/e2e-futurehouse-structure.yaml b/.github/workflows/e2e-futurehouse-structure.yaml deleted file mode 100644 index dc67cd07c..000000000 --- a/.github/workflows/e2e-futurehouse-structure.yaml +++ /dev/null @@ -1,76 +0,0 @@ -name: E2E - Futurehouse Structure - -on: - pull_request: - paths: - - 'codeflash/**' - - 'tests/**' - - 'pyproject.toml' - - 'uv.lock' - - '.github/workflows/e2e-*.yaml' - - workflow_dispatch: - -concurrency: - group: ${{ github.workflow }}-${{ github.ref_name }} - cancel-in-progress: true - -jobs: - futurehouse-structure: - # Dynamically determine if environment is needed only when workflow files change and contributor is external - environment: ${{ (github.event_name == 'workflow_dispatch' || (contains(toJSON(github.event.pull_request.files.*.filename), '.github/workflows/') && github.event.pull_request.user.login != 'misrasaurabh1' && github.event.pull_request.user.login != 'KRRT7')) && 'external-trusted-contributors' || '' }} - - runs-on: ubuntu-latest - env: - CODEFLASH_AIS_SERVER: prod - POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }} - CODEFLASH_API_KEY: ${{ secrets.CODEFLASH_API_KEY }} - COLUMNS: 110 - MAX_RETRIES: 3 - RETRY_DELAY: 5 - EXPECTED_IMPROVEMENT_PCT: 5 - CODEFLASH_END_TO_END: 1 - steps: - - name: 🛎️ Checkout - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.ref }} - repository: ${{ github.event.pull_request.head.repo.full_name }} - fetch-depth: 0 - token: ${{ secrets.GITHUB_TOKEN }} - - name: Validate PR - run: | - # Check for any workflow changes - if git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.event.pull_request.head.sha }}" | grep -q "^.github/workflows/"; then - echo "⚠️ Workflow changes detected." - - # Get the PR author - AUTHOR="${{ github.event.pull_request.user.login }}" - echo "PR Author: $AUTHOR" - - # Allowlist check - if [[ "$AUTHOR" == "misrasaurabh1" || "$AUTHOR" == "KRRT7" ]]; then - echo "✅ Authorized user ($AUTHOR). Proceeding." - elif [[ "${{ github.event.pull_request.state }}" == "open" ]]; then - echo "✅ PR triggered by 'pull_request_target' and is open. Assuming protection rules are in place. Proceeding." - else - echo "⛔ Unauthorized user ($AUTHOR) attempting to modify workflows. Exiting." - exit 1 - fi - else - echo "✅ No workflow file changes detected. Proceeding." - fi - - - name: Set up Python 3.11 for CLI - uses: astral-sh/setup-uv@v8.0.0 - with: - python-version: 3.11.6 - - - name: Install dependencies (CLI) - run: | - uv sync - - - name: Run Codeflash to optimize code - id: optimize_code - run: | - uv run python tests/scripts/end_to_end_test_futurehouse.py diff --git a/.github/workflows/e2e-topological-sort.yaml b/.github/workflows/e2e-topological-sort.yaml deleted file mode 100644 index 945e338f7..000000000 --- a/.github/workflows/e2e-topological-sort.yaml +++ /dev/null @@ -1,101 +0,0 @@ -name: E2E - Topological Sort (Worktree) - -on: - pull_request: - paths: - - 'codeflash/**' - - 'tests/**' - - 'pyproject.toml' - - 'uv.lock' - - '.github/workflows/e2e-*.yaml' - - workflow_dispatch: - -concurrency: - group: ${{ github.workflow }}-${{ github.ref_name }} - cancel-in-progress: true - -jobs: - topological-sort-worktree-optimization: - # Dynamically determine if environment is needed only when workflow files change and contributor is external - environment: ${{ (github.event_name == 'workflow_dispatch' || (contains(toJSON(github.event.pull_request.files.*.filename), '.github/workflows/') && github.event.pull_request.user.login != 'misrasaurabh1' && github.event.pull_request.user.login != 'KRRT7')) && 'external-trusted-contributors' || '' }} - runs-on: ubuntu-latest - env: - CODEFLASH_AIS_SERVER: prod - POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }} - CODEFLASH_API_KEY: ${{ secrets.CODEFLASH_API_KEY }} - COLUMNS: 110 - MAX_RETRIES: 3 - RETRY_DELAY: 5 - EXPECTED_IMPROVEMENT_PCT: 5 - CODEFLASH_END_TO_END: 1 - steps: - - name: 🛎️ Checkout - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.ref }} - repository: ${{ github.event.pull_request.head.repo.full_name }} - fetch-depth: 0 - token: ${{ secrets.GITHUB_TOKEN }} - - name: Debug Environment Decision - run: | - # Construct the condition result manually for debugging - EVENT_NAME="${{ github.event_name }}" - FILES_CHANGED="${{ toJSON(github.event.pull_request.files.*.filename) }}" - PR_AUTHOR="${{ github.event.pull_request.user.login }}" - - echo "Event Name: $EVENT_NAME" - echo "Files Changed: $FILES_CHANGED" - echo "PR Author: $PR_AUTHOR" - - # Check workflow file changes - if [[ "$FILES_CHANGED" == *".github/workflows/"* ]]; then - echo "Workflow files changed: YES" - else - echo "Workflow files changed: NO" - fi - - # Check author conditions - if [[ "$PR_AUTHOR" != "misrasaurabh1" && "$PR_AUTHOR" != "KRRT7" ]]; then - echo "Author needs approval: YES" - else - echo "Author needs approval: NO" - fi - - # Selected environment - echo "Selected Environment: ${{ (github.event_name == 'workflow_dispatch' || (contains(toJSON(github.event.pull_request.files.*.filename), '.github/workflows/') && github.event.pull_request.user.login != 'misrasaurabh1' && github.event.pull_request.user.login != 'KRRT7')) && 'external-trusted-contributors' || '' }}" - - - name: Validate PR for workflow changes - run: | - # Check for any workflow changes - if git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.event.pull_request.head.sha }}" | grep -q "^.github/workflows/"; then - echo "⚠️ Workflow changes detected." - # Get the PR author - AUTHOR="${{ github.event.pull_request.user.login }}" - echo "PR Author: $AUTHOR" - # Allowlist check - if [[ "$AUTHOR" == "misrasaurabh1" || "$AUTHOR" == "KRRT7" ]]; then - echo "✅ Authorized user ($AUTHOR). Proceeding." - elif [[ "${{ github.event.pull_request.state }}" == "open" ]]; then - echo "✅ PR is open. Assuming protection rules are in place. Proceeding." - else - echo "⛔ Unauthorized user ($AUTHOR) attempting to modify workflows. Exiting." - exit 1 - fi - else - echo "✅ No workflow file changes detected. Proceeding." - fi - - - name: Set up Python 3.11 for CLI - uses: astral-sh/setup-uv@v8.0.0 - with: - python-version: 3.11.6 - - - name: Install dependencies (CLI) - run: | - uv sync - - - name: Run Codeflash to optimize code - id: optimize_code - run: | - uv run python tests/scripts/end_to_end_test_topological_sort_worktree.py diff --git a/.github/workflows/e2e-tracer-replay.yaml b/.github/workflows/e2e-tracer-replay.yaml deleted file mode 100644 index 56a038ddb..000000000 --- a/.github/workflows/e2e-tracer-replay.yaml +++ /dev/null @@ -1,76 +0,0 @@ -name: E2E - Tracer Replay - -on: - pull_request: - paths: - - 'codeflash/**' - - 'tests/**' - - 'pyproject.toml' - - 'uv.lock' - - '.github/workflows/e2e-*.yaml' - workflow_dispatch: - -concurrency: - group: ${{ github.workflow }}-${{ github.ref_name }} - cancel-in-progress: true - -jobs: - tracer-replay: - # Dynamically determine if environment is needed only when workflow files change and contributor is external - environment: ${{ (github.event_name == 'workflow_dispatch' || (contains(toJSON(github.event.pull_request.files.*.filename), '.github/workflows/') && github.event.pull_request.user.login != 'misrasaurabh1' && github.event.pull_request.user.login != 'KRRT7')) && 'external-trusted-contributors' || '' }} - - runs-on: ubuntu-latest - env: - CODEFLASH_AIS_SERVER: prod - POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }} - CODEFLASH_API_KEY: ${{ secrets.CODEFLASH_API_KEY }} - COLUMNS: 110 - MAX_RETRIES: 3 - RETRY_DELAY: 5 - EXPECTED_IMPROVEMENT_PCT: 10 - CODEFLASH_END_TO_END: 1 - steps: - - name: 🛎️ Checkout - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.ref }} - repository: ${{ github.event.pull_request.head.repo.full_name }} - fetch-depth: 0 - token: ${{ secrets.GITHUB_TOKEN }} - - name: Validate PR - run: | - # Check for any workflow changes - if git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.event.pull_request.head.sha }}" | grep -q "^.github/workflows/"; then - echo "⚠️ Workflow changes detected." - - # Get the PR author - AUTHOR="${{ github.event.pull_request.user.login }}" - echo "PR Author: $AUTHOR" - - # Allowlist check - if [[ "$AUTHOR" == "misrasaurabh1" || "$AUTHOR" == "KRRT7" ]]; then - echo "✅ Authorized user ($AUTHOR). Proceeding." - elif [[ "${{ github.event.pull_request.state }}" == "open" ]]; then - echo "✅ PR triggered by 'pull_request_target' and is open. Assuming protection rules are in place. Proceeding." - else - echo "⛔ Unauthorized user ($AUTHOR) attempting to modify workflows. Exiting." - exit 1 - fi - else - echo "✅ No workflow file changes detected. Proceeding." - fi - - - - name: Set up Python 3.11 for CLI - uses: astral-sh/setup-uv@v8.0.0 - with: - python-version: 3.11.6 - - - name: Install dependencies (CLI) - run: | - uv sync - - - name: Run Codeflash to optimize code - id: optimize_code - run: | - uv run python tests/scripts/end_to_end_test_tracer_replay.py diff --git a/.github/workflows/mypy.yml b/.github/workflows/mypy.yml deleted file mode 100644 index a3f950105..000000000 --- a/.github/workflows/mypy.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: Mypy Type Checking for CLI - -on: - push: - branches: - - main - paths: - - 'codeflash/**' - - 'pyproject.toml' - - 'uv.lock' - - 'mypy_allowlist.txt' - pull_request: - paths: - - 'codeflash/**' - - 'pyproject.toml' - - 'uv.lock' - - 'mypy_allowlist.txt' - -concurrency: - group: ${{ github.workflow }}-${{ github.ref_name }} - cancel-in-progress: true - -jobs: - type-check-cli: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 - with: - fetch-depth: 0 - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Install uv - uses: astral-sh/setup-uv@v8.0.0 - - - name: sync uv - run: | - uv venv --seed - uv sync - - - - name: Run mypy on allowlist - run: uv run mypy --non-interactive --config-file pyproject.toml @mypy_allowlist.txt diff --git a/.github/workflows/unit-tests.yaml b/.github/workflows/unit-tests.yaml deleted file mode 100644 index 1ff8553c1..000000000 --- a/.github/workflows/unit-tests.yaml +++ /dev/null @@ -1,85 +0,0 @@ -name: unit-tests - -on: - push: - branches: [main] - paths: - - 'codeflash/**' - - 'codeflash-benchmark/**' - - 'codeflash-java-runtime/**' - - 'tests/**' - - 'packages/**' - - 'pyproject.toml' - - 'uv.lock' - pull_request: - paths: - - 'codeflash/**' - - 'codeflash-benchmark/**' - - 'codeflash-java-runtime/**' - - 'tests/**' - - 'packages/**' - - 'pyproject.toml' - - 'uv.lock' - workflow_dispatch: - -concurrency: - group: ${{ github.workflow }}-${{ github.ref_name }} - cancel-in-progress: true - -jobs: - unit-tests: - strategy: - fail-fast: false - matrix: - include: - - os: ubuntu-latest - python-version: "3.9" - - os: ubuntu-latest - python-version: "3.10" - - os: ubuntu-latest - python-version: "3.11" - - os: ubuntu-latest - python-version: "3.12" - - os: ubuntu-latest - python-version: "3.13" - - os: ubuntu-latest - python-version: "3.14" - - os: windows-latest - python-version: "3.13" - continue-on-error: true - runs-on: ${{ matrix.os }} - env: - PYTHONIOENCODING: utf-8 - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Set up JDK 11 - uses: actions/setup-java@v4 - with: - java-version: '11' - distribution: 'temurin' - cache: maven - - - name: Build codeflash-runtime JAR - run: | - cd codeflash-java-runtime - mvn clean package -q -DskipTests - mvn install -q -DskipTests - - - name: Install uv - uses: astral-sh/setup-uv@v8.0.0 - with: - python-version: ${{ matrix.python-version }} - - - name: install dependencies - run: uv sync - - - name: Install test-only dependencies (Python 3.9 and 3.13) - if: matrix.python-version == '3.9' || matrix.python-version == '3.13' - run: uv sync --group tests - - - name: Unit tests - run: uv run pytest tests/ From 7e40e944b16751bf03c7566082a96396565d0534 Mon Sep 17 00:00:00 2001 From: Kevin Turcios Date: Thu, 9 Apr 2026 05:47:02 -0500 Subject: [PATCH 2/3] ci: remove self-reference from change detection paths MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ci.yaml was in all three check_paths calls, so creating/modifying the workflow itself triggered all test jobs. Workflow-only PRs should skip tests — the gate job still validates the pattern. --- .github/workflows/ci.yaml | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 144477bd4..cc877139f 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -62,18 +62,15 @@ jobs: # Unit tests: code + test infra + java + packages + build config check_paths unit_tests \ 'codeflash/' 'codeflash-benchmark/' 'codeflash-java-runtime/' \ - 'tests/' 'packages/' 'pyproject.toml' 'uv.lock' \ - '.github/workflows/ci.yaml' + 'tests/' 'packages/' 'pyproject.toml' 'uv.lock' # Type checking: code + build config + mypy config check_paths type_check \ - 'codeflash/' 'pyproject.toml' 'uv.lock' 'mypy_allowlist.txt' \ - '.github/workflows/ci.yaml' + 'codeflash/' 'pyproject.toml' 'uv.lock' 'mypy_allowlist.txt' - # E2E tests: code + tests + build config + this workflow + # E2E tests: code + tests + build config check_paths e2e \ - 'codeflash/' 'tests/' 'pyproject.toml' 'uv.lock' \ - '.github/workflows/ci.yaml' + 'codeflash/' 'tests/' 'pyproject.toml' 'uv.lock' env: MERGE_BASE: ${{ steps.merge_base.outputs.sha }} From d941f3645f5253531ebbb537ea66c55b07eed856 Mon Sep 17 00:00:00 2001 From: Kevin Turcios Date: Thu, 9 Apr 2026 06:35:55 -0500 Subject: [PATCH 3/3] ci: consolidate remaining 10 workflows into ci.yaml Add all non-required-check E2E workflows and prek lint to the consolidated ci.yaml: - 4 standard Python E2Es (async, benchmark, coverage, init) - 3 JS E2Es (cjs-function, esm-async, ts-class) - 2 Java E2Es (fibonacci-nogit, tracer) - prek lint New change detection outputs: - e2e_js: triggers JS E2Es when packages/ changes - e2e_java: triggers Java E2Es when java runtime/fixtures change Total: 17 jobs + determine-changes + gate = 19 jobs in one file. Down from 22 workflow files to 7 (remaining are non-test: claude, codeflash self-optimize, label-workflow-changes, publish, java-e2e). Additional savings per irrelevant PR: ~$0.80 (10 jobs x ~$0.08). Total per skipped PR: ~$1.85. --- .github/workflows/ci.yaml | 619 ++++++++++++++++++ .github/workflows/e2e-async.yaml | 77 --- .../workflows/e2e-bubblesort-benchmark.yaml | 76 --- .../workflows/e2e-coverage-optimization.yaml | 75 --- .github/workflows/e2e-init-optimization.yaml | 75 --- .../workflows/e2e-java-fibonacci-nogit.yaml | 105 --- .github/workflows/e2e-java-tracer.yaml | 90 --- .github/workflows/e2e-js-cjs-function.yaml | 93 --- .github/workflows/e2e-js-esm-async.yaml | 93 --- .github/workflows/e2e-js-ts-class.yaml | 93 --- .github/workflows/prek.yaml | 25 - 11 files changed, 619 insertions(+), 802 deletions(-) delete mode 100644 .github/workflows/e2e-async.yaml delete mode 100644 .github/workflows/e2e-bubblesort-benchmark.yaml delete mode 100644 .github/workflows/e2e-coverage-optimization.yaml delete mode 100644 .github/workflows/e2e-init-optimization.yaml delete mode 100644 .github/workflows/e2e-java-fibonacci-nogit.yaml delete mode 100644 .github/workflows/e2e-java-tracer.yaml delete mode 100644 .github/workflows/e2e-js-cjs-function.yaml delete mode 100644 .github/workflows/e2e-js-esm-async.yaml delete mode 100644 .github/workflows/e2e-js-ts-class.yaml delete mode 100644 .github/workflows/prek.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index cc877139f..4d092949a 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -33,6 +33,8 @@ jobs: unit_tests: ${{ github.event_name != 'pull_request' || steps.check.outputs.unit_tests == 'true' }} type_check: ${{ github.event_name != 'pull_request' || steps.check.outputs.type_check == 'true' }} e2e: ${{ github.event_name != 'pull_request' || steps.check.outputs.e2e == 'true' }} + e2e_js: ${{ github.event_name != 'pull_request' || steps.check.outputs.e2e_js == 'true' }} + e2e_java: ${{ github.event_name != 'pull_request' || steps.check.outputs.e2e_java == 'true' }} steps: - uses: actions/checkout@v4 if: github.event_name == 'pull_request' @@ -71,6 +73,14 @@ jobs: # E2E tests: code + tests + build config check_paths e2e \ 'codeflash/' 'tests/' 'pyproject.toml' 'uv.lock' + + # JS E2E tests: JS packages changed + check_paths e2e_js \ + 'packages/' + + # Java E2E tests: java runtime or java test fixtures changed + check_paths e2e_java \ + 'codeflash-java-runtime/' 'code_to_optimize/java/' env: MERGE_BASE: ${{ steps.merge_base.outputs.sha }} @@ -160,9 +170,31 @@ jobs: - name: Run mypy run: uv run mypy --non-interactive --config-file pyproject.toml @mypy_allowlist.txt + # --------------------------------------------------------------------------- + # Lint (prek) — pull_request only + # --------------------------------------------------------------------------- + prek: + needs: determine-changes + if: >- + github.event_name == 'pull_request' + && (needs.determine-changes.outputs.e2e == 'true' + || needs.determine-changes.outputs.e2e_js == 'true') + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - uses: astral-sh/setup-uv@v8.0.0 + - uses: j178/prek-action@v1 + with: + extra-args: '--from-ref origin/${{ github.base_ref }} --to-ref ${{ github.sha }}' + # --------------------------------------------------------------------------- # E2E tests — only on pull_request and workflow_dispatch (not push to main) # --------------------------------------------------------------------------- + + # --- Standard Python E2Es --- + tracer-replay: needs: determine-changes if: >- @@ -444,6 +476,583 @@ jobs: - name: Run E2E test run: uv run python tests/scripts/end_to_end_test_topological_sort_worktree.py + async-optimization: + needs: determine-changes + if: >- + needs.determine-changes.outputs.e2e == 'true' + && github.event_name != 'push' + environment: ${{ (github.event_name == 'workflow_dispatch' || (contains(toJSON(github.event.pull_request.files.*.filename), '.github/workflows/') && github.event.pull_request.user.login != 'misrasaurabh1' && github.event.pull_request.user.login != 'KRRT7')) && 'external-trusted-contributors' || '' }} + runs-on: ubuntu-latest + env: + CODEFLASH_AIS_SERVER: prod + POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }} + CODEFLASH_API_KEY: ${{ secrets.CODEFLASH_API_KEY }} + COLUMNS: 110 + MAX_RETRIES: 3 + RETRY_DELAY: 5 + EXPECTED_IMPROVEMENT_PCT: 10 + CODEFLASH_END_TO_END: 1 + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.ref || '' }} + repository: ${{ github.event.pull_request.head.repo.full_name || '' }} + fetch-depth: 0 + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Validate PR + if: github.event_name == 'pull_request' + run: | + if git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.event.pull_request.head.sha }}" | grep -q "^.github/workflows/"; then + echo "Workflow changes detected." + AUTHOR="${{ github.event.pull_request.user.login }}" + if [[ "$AUTHOR" == "misrasaurabh1" || "$AUTHOR" == "KRRT7" ]]; then + echo "Authorized user ($AUTHOR). Proceeding." + elif [[ "${{ github.event.pull_request.state }}" == "open" ]]; then + echo "PR is open. Protection rules in place. Proceeding." + else + echo "Unauthorized user ($AUTHOR). Exiting." + exit 1 + fi + else + echo "No workflow file changes. Proceeding." + fi + + - name: Install uv + uses: astral-sh/setup-uv@v8.0.0 + with: + python-version: 3.11.6 + + - name: Install dependencies + run: uv sync + + - name: Run E2E test + run: uv run python tests/scripts/end_to_end_test_async.py + + benchmark-bubble-sort: + needs: determine-changes + if: >- + needs.determine-changes.outputs.e2e == 'true' + && github.event_name != 'push' + environment: ${{ (github.event_name == 'workflow_dispatch' || (contains(toJSON(github.event.pull_request.files.*.filename), '.github/workflows/') && github.event.pull_request.user.login != 'misrasaurabh1' && github.event.pull_request.user.login != 'KRRT7')) && 'external-trusted-contributors' || '' }} + runs-on: ubuntu-latest + env: + CODEFLASH_AIS_SERVER: prod + POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }} + CODEFLASH_API_KEY: ${{ secrets.CODEFLASH_API_KEY }} + COLUMNS: 110 + MAX_RETRIES: 3 + RETRY_DELAY: 5 + EXPECTED_IMPROVEMENT_PCT: 5 + CODEFLASH_END_TO_END: 1 + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.ref || '' }} + repository: ${{ github.event.pull_request.head.repo.full_name || '' }} + fetch-depth: 0 + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Validate PR + if: github.event_name == 'pull_request' + run: | + if git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.event.pull_request.head.sha }}" | grep -q "^.github/workflows/"; then + echo "Workflow changes detected." + AUTHOR="${{ github.event.pull_request.user.login }}" + if [[ "$AUTHOR" == "misrasaurabh1" || "$AUTHOR" == "KRRT7" ]]; then + echo "Authorized user ($AUTHOR). Proceeding." + elif [[ "${{ github.event.pull_request.state }}" == "open" ]]; then + echo "PR is open. Protection rules in place. Proceeding." + else + echo "Unauthorized user ($AUTHOR). Exiting." + exit 1 + fi + else + echo "No workflow file changes. Proceeding." + fi + + - name: Install uv + uses: astral-sh/setup-uv@v8.0.0 + with: + python-version: 3.11.6 + + - name: Install dependencies + run: uv sync + + - name: Run E2E test + run: uv run python tests/scripts/end_to_end_test_benchmark_sort.py + + coverage-e2e: + needs: determine-changes + if: >- + needs.determine-changes.outputs.e2e == 'true' + && github.event_name != 'push' + environment: ${{ (github.event_name == 'workflow_dispatch' || (contains(toJSON(github.event.pull_request.files.*.filename), '.github/workflows/') && github.event.pull_request.user.login != 'misrasaurabh1' && github.event.pull_request.user.login != 'KRRT7')) && 'external-trusted-contributors' || '' }} + runs-on: ubuntu-latest + env: + CODEFLASH_AIS_SERVER: prod + POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }} + CODEFLASH_API_KEY: ${{ secrets.CODEFLASH_API_KEY }} + MAX_RETRIES: 3 + RETRY_DELAY: 5 + CODEFLASH_END_TO_END: 1 + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.ref || '' }} + repository: ${{ github.event.pull_request.head.repo.full_name || '' }} + fetch-depth: 0 + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Validate PR + if: github.event_name == 'pull_request' + run: | + if git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.event.pull_request.head.sha }}" | grep -q "^.github/workflows/"; then + echo "Workflow changes detected." + AUTHOR="${{ github.event.pull_request.user.login }}" + if [[ "$AUTHOR" == "misrasaurabh1" || "$AUTHOR" == "KRRT7" ]]; then + echo "Authorized user ($AUTHOR). Proceeding." + elif [[ "${{ github.event.pull_request.state }}" == "open" ]]; then + echo "PR is open. Protection rules in place. Proceeding." + else + echo "Unauthorized user ($AUTHOR). Exiting." + exit 1 + fi + else + echo "No workflow file changes. Proceeding." + fi + + - name: Install uv + uses: astral-sh/setup-uv@v8.0.0 + with: + python-version: 3.11.6 + + - name: Install dependencies + run: | + uv sync + uv add black + + - name: Run E2E test + run: uv run python tests/scripts/end_to_end_test_coverage.py + + init-optimization: + needs: determine-changes + if: >- + needs.determine-changes.outputs.e2e == 'true' + && github.event_name != 'push' + environment: ${{ (github.event_name == 'workflow_dispatch' || (contains(toJSON(github.event.pull_request.files.*.filename), '.github/workflows/') && github.event.pull_request.user.login != 'misrasaurabh1' && github.event.pull_request.user.login != 'KRRT7')) && 'external-trusted-contributors' || '' }} + runs-on: ubuntu-latest + env: + CODEFLASH_AIS_SERVER: prod + POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }} + CODEFLASH_API_KEY: ${{ secrets.CODEFLASH_API_KEY }} + COLUMNS: 110 + MAX_RETRIES: 3 + RETRY_DELAY: 5 + EXPECTED_IMPROVEMENT_PCT: 10 + CODEFLASH_END_TO_END: 1 + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.ref || '' }} + repository: ${{ github.event.pull_request.head.repo.full_name || '' }} + fetch-depth: 0 + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Validate PR + if: github.event_name == 'pull_request' + run: | + if git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.event.pull_request.head.sha }}" | grep -q "^.github/workflows/"; then + echo "Workflow changes detected." + AUTHOR="${{ github.event.pull_request.user.login }}" + if [[ "$AUTHOR" == "misrasaurabh1" || "$AUTHOR" == "KRRT7" ]]; then + echo "Authorized user ($AUTHOR). Proceeding." + elif [[ "${{ github.event.pull_request.state }}" == "open" ]]; then + echo "PR is open. Protection rules in place. Proceeding." + else + echo "Unauthorized user ($AUTHOR). Exiting." + exit 1 + fi + else + echo "No workflow file changes. Proceeding." + fi + + - name: Install uv + uses: astral-sh/setup-uv@v8.0.0 + with: + python-version: 3.11.6 + + - name: Install dependencies + run: uv sync + + - name: Run E2E test + run: uv run python tests/scripts/end_to_end_test_init_optimization.py + + # --- JS E2Es (need Node.js + packages/) --- + + js-cjs-function: + needs: determine-changes + if: >- + (needs.determine-changes.outputs.e2e == 'true' + || needs.determine-changes.outputs.e2e_js == 'true') + && github.event_name != 'push' + environment: ${{ (github.event_name == 'workflow_dispatch' || (contains(toJSON(github.event.pull_request.files.*.filename), '.github/workflows/') && github.event.pull_request.user.login != 'misrasaurabh1' && github.event.pull_request.user.login != 'KRRT7')) && 'external-trusted-contributors' || '' }} + runs-on: ubuntu-latest + env: + CODEFLASH_AIS_SERVER: prod + POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }} + CODEFLASH_API_KEY: ${{ secrets.CODEFLASH_API_KEY }} + COLUMNS: 110 + MAX_RETRIES: 3 + RETRY_DELAY: 5 + EXPECTED_IMPROVEMENT_PCT: 50 + CODEFLASH_END_TO_END: 1 + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.ref || '' }} + repository: ${{ github.event.pull_request.head.repo.full_name || '' }} + fetch-depth: 0 + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Validate PR + if: github.event_name == 'pull_request' + run: | + if git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.event.pull_request.head.sha }}" | grep -q "^.github/workflows/"; then + echo "Workflow changes detected." + AUTHOR="${{ github.event.pull_request.user.login }}" + if [[ "$AUTHOR" == "misrasaurabh1" || "$AUTHOR" == "KRRT7" ]]; then + echo "Authorized user ($AUTHOR). Proceeding." + elif [[ "${{ github.event.pull_request.state }}" == "open" ]]; then + echo "PR is open. Protection rules in place. Proceeding." + else + echo "Unauthorized user ($AUTHOR). Exiting." + exit 1 + fi + else + echo "No workflow file changes. Proceeding." + fi + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Install codeflash npm package dependencies + run: | + cd packages/codeflash + npm install + + - name: Install JS test project dependencies + run: | + cd code_to_optimize/js/code_to_optimize_js + npm install + + - name: Install uv + uses: astral-sh/setup-uv@v8.0.0 + with: + python-version: 3.11.6 + + - name: Install dependencies + run: uv sync + + - name: Run E2E test + run: uv run python tests/scripts/end_to_end_test_js_cjs_function.py + + js-esm-async: + needs: determine-changes + if: >- + (needs.determine-changes.outputs.e2e == 'true' + || needs.determine-changes.outputs.e2e_js == 'true') + && github.event_name != 'push' + environment: ${{ (github.event_name == 'workflow_dispatch' || (contains(toJSON(github.event.pull_request.files.*.filename), '.github/workflows/') && github.event.pull_request.user.login != 'misrasaurabh1' && github.event.pull_request.user.login != 'KRRT7')) && 'external-trusted-contributors' || '' }} + runs-on: ubuntu-latest + env: + CODEFLASH_AIS_SERVER: prod + POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }} + CODEFLASH_API_KEY: ${{ secrets.CODEFLASH_API_KEY }} + COLUMNS: 110 + MAX_RETRIES: 3 + RETRY_DELAY: 5 + EXPECTED_IMPROVEMENT_PCT: 10 + CODEFLASH_END_TO_END: 1 + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.ref || '' }} + repository: ${{ github.event.pull_request.head.repo.full_name || '' }} + fetch-depth: 0 + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Validate PR + if: github.event_name == 'pull_request' + run: | + if git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.event.pull_request.head.sha }}" | grep -q "^.github/workflows/"; then + echo "Workflow changes detected." + AUTHOR="${{ github.event.pull_request.user.login }}" + if [[ "$AUTHOR" == "misrasaurabh1" || "$AUTHOR" == "KRRT7" ]]; then + echo "Authorized user ($AUTHOR). Proceeding." + elif [[ "${{ github.event.pull_request.state }}" == "open" ]]; then + echo "PR is open. Protection rules in place. Proceeding." + else + echo "Unauthorized user ($AUTHOR). Exiting." + exit 1 + fi + else + echo "No workflow file changes. Proceeding." + fi + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Install codeflash npm package dependencies + run: | + cd packages/codeflash + npm install + + - name: Install JS test project dependencies + run: | + cd code_to_optimize/js/code_to_optimize_js_esm + npm install + + - name: Install uv + uses: astral-sh/setup-uv@v8.0.0 + with: + python-version: 3.11.6 + + - name: Install dependencies + run: uv sync + + - name: Run E2E test + run: uv run python tests/scripts/end_to_end_test_js_esm_async.py + + js-ts-class: + needs: determine-changes + if: >- + (needs.determine-changes.outputs.e2e == 'true' + || needs.determine-changes.outputs.e2e_js == 'true') + && github.event_name != 'push' + environment: ${{ (github.event_name == 'workflow_dispatch' || (contains(toJSON(github.event.pull_request.files.*.filename), '.github/workflows/') && github.event.pull_request.user.login != 'misrasaurabh1' && github.event.pull_request.user.login != 'KRRT7')) && 'external-trusted-contributors' || '' }} + runs-on: ubuntu-latest + env: + CODEFLASH_AIS_SERVER: prod + POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }} + CODEFLASH_API_KEY: ${{ secrets.CODEFLASH_API_KEY }} + COLUMNS: 110 + MAX_RETRIES: 3 + RETRY_DELAY: 5 + EXPECTED_IMPROVEMENT_PCT: 30 + CODEFLASH_END_TO_END: 1 + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.ref || '' }} + repository: ${{ github.event.pull_request.head.repo.full_name || '' }} + fetch-depth: 0 + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Validate PR + if: github.event_name == 'pull_request' + run: | + if git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.event.pull_request.head.sha }}" | grep -q "^.github/workflows/"; then + echo "Workflow changes detected." + AUTHOR="${{ github.event.pull_request.user.login }}" + if [[ "$AUTHOR" == "misrasaurabh1" || "$AUTHOR" == "KRRT7" ]]; then + echo "Authorized user ($AUTHOR). Proceeding." + elif [[ "${{ github.event.pull_request.state }}" == "open" ]]; then + echo "PR is open. Protection rules in place. Proceeding." + else + echo "Unauthorized user ($AUTHOR). Exiting." + exit 1 + fi + else + echo "No workflow file changes. Proceeding." + fi + + - name: Set up Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: Install codeflash npm package dependencies + run: | + cd packages/codeflash + npm install + + - name: Install JS test project dependencies + run: | + cd code_to_optimize/js/code_to_optimize_ts + npm install + + - name: Install uv + uses: astral-sh/setup-uv@v8.0.0 + with: + python-version: 3.11.6 + + - name: Install dependencies + run: uv sync + + - name: Run E2E test + run: uv run python tests/scripts/end_to_end_test_js_ts_class.py + + # --- Java E2Es (need JDK + Maven) --- + + java-fibonacci-nogit: + needs: determine-changes + if: >- + (needs.determine-changes.outputs.e2e == 'true' + || needs.determine-changes.outputs.e2e_java == 'true') + && github.event_name != 'push' + environment: ${{ (github.event_name == 'workflow_dispatch' || (contains(toJSON(github.event.pull_request.files.*.filename), '.github/workflows/') && github.event.pull_request.user.login != 'misrasaurabh1' && github.event.pull_request.user.login != 'KRRT7')) && 'external-trusted-contributors' || '' }} + runs-on: ubuntu-latest + env: + CODEFLASH_AIS_SERVER: prod + POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }} + CODEFLASH_API_KEY: ${{ secrets.CODEFLASH_API_KEY }} + COLUMNS: 110 + MAX_RETRIES: 3 + RETRY_DELAY: 5 + EXPECTED_IMPROVEMENT_PCT: 70 + CODEFLASH_END_TO_END: 1 + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.ref || '' }} + repository: ${{ github.event.pull_request.head.repo.full_name || '' }} + fetch-depth: 0 + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Validate PR + if: github.event_name == 'pull_request' + run: | + if git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.event.pull_request.head.sha }}" | grep -q "^.github/workflows/"; then + echo "Workflow changes detected." + AUTHOR="${{ github.event.pull_request.user.login }}" + if [[ "$AUTHOR" == "misrasaurabh1" || "$AUTHOR" == "KRRT7" ]]; then + echo "Authorized user ($AUTHOR). Proceeding." + elif [[ "${{ github.event.pull_request.state }}" == "open" ]]; then + echo "PR is open. Protection rules in place. Proceeding." + else + echo "Unauthorized user ($AUTHOR). Exiting." + exit 1 + fi + else + echo "No workflow file changes. Proceeding." + fi + + - name: Set up JDK 11 + uses: actions/setup-java@v4 + with: + java-version: '11' + distribution: 'temurin' + cache: maven + + - name: Install uv + uses: astral-sh/setup-uv@v8.0.0 + with: + python-version: 3.11.6 + + - name: Install dependencies + run: uv sync + + - name: Build codeflash-runtime JAR + run: | + cd codeflash-java-runtime + mvn clean package -q -DskipTests + mvn install -q -DskipTests + + - name: Verify Java installation + run: | + java -version + mvn --version + + - name: Remove .git + run: | + if [ -d ".git" ]; then + sudo rm -rf .git + echo ".git directory removed." + else + echo ".git directory does not exist." + exit 1 + fi + + - name: Run E2E test + run: uv run python tests/scripts/end_to_end_test_java_fibonacci.py + + java-tracer: + needs: determine-changes + if: >- + (needs.determine-changes.outputs.e2e == 'true' + || needs.determine-changes.outputs.e2e_java == 'true') + && github.event_name != 'push' + environment: ${{ (github.event_name == 'workflow_dispatch' || (contains(toJSON(github.event.pull_request.files.*.filename), '.github/workflows/') && github.event.pull_request.user.login != 'misrasaurabh1' && github.event.pull_request.user.login != 'KRRT7')) && 'external-trusted-contributors' || '' }} + runs-on: ubuntu-latest + env: + CODEFLASH_AIS_SERVER: prod + POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }} + CODEFLASH_API_KEY: ${{ secrets.CODEFLASH_API_KEY }} + COLUMNS: 110 + MAX_RETRIES: 3 + RETRY_DELAY: 5 + EXPECTED_IMPROVEMENT_PCT: 10 + CODEFLASH_END_TO_END: 1 + steps: + - uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.ref || '' }} + repository: ${{ github.event.pull_request.head.repo.full_name || '' }} + fetch-depth: 0 + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Validate PR + if: github.event_name == 'pull_request' + run: | + if git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.event.pull_request.head.sha }}" | grep -q "^.github/workflows/"; then + echo "Workflow changes detected." + AUTHOR="${{ github.event.pull_request.user.login }}" + if [[ "$AUTHOR" == "misrasaurabh1" || "$AUTHOR" == "KRRT7" ]]; then + echo "Authorized user ($AUTHOR). Proceeding." + elif [[ "${{ github.event.pull_request.state }}" == "open" ]]; then + echo "PR is open. Protection rules in place. Proceeding." + else + echo "Unauthorized user ($AUTHOR). Exiting." + exit 1 + fi + else + echo "No workflow file changes. Proceeding." + fi + + - name: Set up JDK 11 + uses: actions/setup-java@v4 + with: + java-version: '11' + distribution: 'temurin' + cache: maven + + - name: Install uv + uses: astral-sh/setup-uv@v8.0.0 + with: + python-version: 3.11.6 + + - name: Install dependencies + run: uv sync + + - name: Build codeflash-runtime JAR + run: | + cd codeflash-java-runtime + mvn clean package -q -DskipTests + mvn install -q -DskipTests + + - name: Verify Java installation + run: | + java -version + mvn --version + + - name: Run E2E test + run: uv run python tests/scripts/end_to_end_test_java_tracer.py + # --------------------------------------------------------------------------- # Gate job — the ONLY required check in the GitHub ruleset. # Accepts "success" and "skipped" (job skipped by change detection). @@ -455,11 +1064,21 @@ jobs: needs: - unit-tests - type-check + - prek - tracer-replay - bubble-sort-pytest-nogit - bubble-sort-unittest - futurehouse-structure - topological-sort + - async-optimization + - benchmark-bubble-sort + - coverage-e2e + - init-optimization + - js-cjs-function + - js-esm-async + - js-ts-class + - java-fibonacci-nogit + - java-tracer runs-on: ubuntu-latest steps: - name: Verify all required jobs passed diff --git a/.github/workflows/e2e-async.yaml b/.github/workflows/e2e-async.yaml deleted file mode 100644 index f091ffdaf..000000000 --- a/.github/workflows/e2e-async.yaml +++ /dev/null @@ -1,77 +0,0 @@ -name: E2E - Async - -on: - pull_request: - paths: - - 'codeflash/**' - - 'tests/**' - - 'pyproject.toml' - - 'uv.lock' - - '.github/workflows/e2e-*.yaml' - - workflow_dispatch: - -concurrency: - group: ${{ github.workflow }}-${{ github.ref_name }} - cancel-in-progress: true - -jobs: - async-optimization: - # Dynamically determine if environment is needed only when workflow files change and contributor is external - environment: ${{ (github.event_name == 'workflow_dispatch' || (contains(toJSON(github.event.pull_request.files.*.filename), '.github/workflows/') && github.event.pull_request.user.login != 'misrasaurabh1' && github.event.pull_request.user.login != 'KRRT7')) && 'external-trusted-contributors' || '' }} - - runs-on: ubuntu-latest - env: - CODEFLASH_AIS_SERVER: prod - POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }} - CODEFLASH_API_KEY: ${{ secrets.CODEFLASH_API_KEY }} - COLUMNS: 110 - MAX_RETRIES: 3 - RETRY_DELAY: 5 - EXPECTED_IMPROVEMENT_PCT: 10 - CODEFLASH_END_TO_END: 1 - steps: - - name: 🛎️ Checkout - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.ref }} - repository: ${{ github.event.pull_request.head.repo.full_name }} - fetch-depth: 0 - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Validate PR - run: | - # Check for any workflow changes - if git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.event.pull_request.head.sha }}" | grep -q "^.github/workflows/"; then - echo "⚠️ Workflow changes detected." - - # Get the PR author - AUTHOR="${{ github.event.pull_request.user.login }}" - echo "PR Author: $AUTHOR" - - # Allowlist check - if [[ "$AUTHOR" == "misrasaurabh1" || "$AUTHOR" == "KRRT7" ]]; then - echo "✅ Authorized user ($AUTHOR). Proceeding." - elif [[ "${{ github.event.pull_request.state }}" == "open" ]]; then - echo "✅ PR triggered by 'pull_request_target' and is open. Assuming protection rules are in place. Proceeding." - else - echo "⛔ Unauthorized user ($AUTHOR) attempting to modify workflows. Exiting." - exit 1 - fi - else - echo "✅ No workflow file changes detected. Proceeding." - fi - - - name: Set up Python 3.11 for CLI - uses: astral-sh/setup-uv@v8.0.0 - with: - python-version: 3.11.6 - - - name: Install dependencies (CLI) - run: | - uv sync - - - name: Run Codeflash to optimize async code - id: optimize_async_code - run: | - uv run python tests/scripts/end_to_end_test_async.py \ No newline at end of file diff --git a/.github/workflows/e2e-bubblesort-benchmark.yaml b/.github/workflows/e2e-bubblesort-benchmark.yaml deleted file mode 100644 index 406a67bd0..000000000 --- a/.github/workflows/e2e-bubblesort-benchmark.yaml +++ /dev/null @@ -1,76 +0,0 @@ -name: E2E - Bubble Sort Benchmark - -on: - pull_request: - paths: - - 'codeflash/**' - - 'tests/**' - - 'pyproject.toml' - - 'uv.lock' - - '.github/workflows/e2e-*.yaml' - - workflow_dispatch: - -concurrency: - group: ${{ github.workflow }}-${{ github.ref_name }} - cancel-in-progress: true - -jobs: - benchmark-bubble-sort-optimization: - # Dynamically determine if environment is needed only when workflow files change and contributor is external - environment: ${{ (github.event_name == 'workflow_dispatch' || (contains(toJSON(github.event.pull_request.files.*.filename), '.github/workflows/') && github.event.pull_request.user.login != 'misrasaurabh1' && github.event.pull_request.user.login != 'KRRT7')) && 'external-trusted-contributors' || '' }} - - runs-on: ubuntu-latest - env: - CODEFLASH_AIS_SERVER: prod - POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }} - CODEFLASH_API_KEY: ${{ secrets.CODEFLASH_API_KEY }} - COLUMNS: 110 - MAX_RETRIES: 3 - RETRY_DELAY: 5 - EXPECTED_IMPROVEMENT_PCT: 5 - CODEFLASH_END_TO_END: 1 - steps: - - name: 🛎️ Checkout - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.ref }} - repository: ${{ github.event.pull_request.head.repo.full_name }} - fetch-depth: 0 - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Validate PR - run: | - # Check for any workflow changes - if git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.event.pull_request.head.sha }}" | grep -q "^.github/workflows/"; then - echo "⚠️ Workflow changes detected." - - # Get the PR author - AUTHOR="${{ github.event.pull_request.user.login }}" - echo "PR Author: $AUTHOR" - - # Allowlist check - if [[ "$AUTHOR" == "misrasaurabh1" || "$AUTHOR" == "KRRT7" ]]; then - echo "✅ Authorized user ($AUTHOR). Proceeding." - elif [[ "${{ github.event.pull_request.state }}" == "open" ]]; then - echo "✅ PR triggered by 'pull_request_target' and is open. Assuming protection rules are in place. Proceeding." - else - echo "⛔ Unauthorized user ($AUTHOR) attempting to modify workflows. Exiting." - exit 1 - fi - else - echo "✅ No workflow file changes detected. Proceeding." - fi - - - name: Set up Python 3.11 for CLI - uses: astral-sh/setup-uv@v8.0.0 - with: - python-version: 3.11.6 - - - name: Install dependencies (CLI) - run: | - uv sync - - name: Run Codeflash to optimize code - id: optimize_code_with_benchmarks - run: | - uv run python tests/scripts/end_to_end_test_benchmark_sort.py \ No newline at end of file diff --git a/.github/workflows/e2e-coverage-optimization.yaml b/.github/workflows/e2e-coverage-optimization.yaml deleted file mode 100644 index e4df7d0b2..000000000 --- a/.github/workflows/e2e-coverage-optimization.yaml +++ /dev/null @@ -1,75 +0,0 @@ -name: Coverage E2E - -on: - pull_request: - paths: - - 'codeflash/**' - - 'tests/**' - - 'pyproject.toml' - - 'uv.lock' - - '.github/workflows/e2e-*.yaml' - - workflow_dispatch: - -concurrency: - group: ${{ github.workflow }}-${{ github.ref_name }} - cancel-in-progress: true - -jobs: - end-to-end-test-coverage: - # Dynamically determine if environment is needed only when workflow files change and contributor is external - environment: ${{ (github.event_name == 'workflow_dispatch' || (contains(toJSON(github.event.pull_request.files.*.filename), '.github/workflows/') && github.event.pull_request.user.login != 'misrasaurabh1' && github.event.pull_request.user.login != 'KRRT7')) && 'external-trusted-contributors' || '' }} - - runs-on: ubuntu-latest - env: - CODEFLASH_AIS_SERVER: prod - POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }} - CODEFLASH_API_KEY: ${{ secrets.CODEFLASH_API_KEY }} - MAX_RETRIES: 3 - RETRY_DELAY: 5 - CODEFLASH_END_TO_END: 1 - steps: - - name: 🛎️ Checkout - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.ref }} - repository: ${{ github.event.pull_request.head.repo.full_name }} - fetch-depth: 0 - token: ${{ secrets.GITHUB_TOKEN }} - - name: Validate PR - run: | - # Check for any workflow changes - if git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.event.pull_request.head.sha }}" | grep -q "^.github/workflows/"; then - echo "⚠️ Workflow changes detected." - - # Get the PR author - AUTHOR="${{ github.event.pull_request.user.login }}" - echo "PR Author: $AUTHOR" - - # Allowlist check - if [[ "$AUTHOR" == "misrasaurabh1" || "$AUTHOR" == "KRRT7" ]]; then - echo "✅ Authorized user ($AUTHOR). Proceeding." - elif [[ "${{ github.event.pull_request.state }}" == "open" ]]; then - echo "✅ PR triggered by 'pull_request_target' and is open. Assuming protection rules are in place. Proceeding." - else - echo "⛔ Unauthorized user ($AUTHOR) attempting to modify workflows. Exiting." - exit 1 - fi - else - echo "✅ No workflow file changes detected. Proceeding." - fi - - - name: Set up Python 3.11 for CLI - uses: astral-sh/setup-uv@v8.0.0 - with: - python-version: 3.11.6 - - - name: Install dependencies (CLI) - run: | - uv sync - uv add black # my-best-repo in end_to_end_test_coverage.py is configured to use black - - - name: Run Codeflash to optimize code - id: optimize_code - run: | - uv run python tests/scripts/end_to_end_test_coverage.py diff --git a/.github/workflows/e2e-init-optimization.yaml b/.github/workflows/e2e-init-optimization.yaml deleted file mode 100644 index 2e76c64bc..000000000 --- a/.github/workflows/e2e-init-optimization.yaml +++ /dev/null @@ -1,75 +0,0 @@ -name: E2E - Init Optimization - -on: - pull_request: - paths: - - 'codeflash/**' - - 'tests/**' - - 'pyproject.toml' - - 'uv.lock' - - '.github/workflows/e2e-*.yaml' - workflow_dispatch: - -concurrency: - group: ${{ github.workflow }}-${{ github.ref_name }} - cancel-in-progress: true - -jobs: - init-optimization: - # Dynamically determine if environment is needed only when workflow files change and contributor is external - environment: ${{ (github.event_name == 'workflow_dispatch' || (contains(toJSON(github.event.pull_request.files.*.filename), '.github/workflows/') && github.event.pull_request.user.login != 'misrasaurabh1' && github.event.pull_request.user.login != 'KRRT7')) && 'external-trusted-contributors' || '' }} - - runs-on: ubuntu-latest - env: - CODEFLASH_AIS_SERVER: prod - POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }} - CODEFLASH_API_KEY: ${{ secrets.CODEFLASH_API_KEY }} - COLUMNS: 110 - MAX_RETRIES: 3 - RETRY_DELAY: 5 - EXPECTED_IMPROVEMENT_PCT: 10 - CODEFLASH_END_TO_END: 1 - steps: - - name: 🛎️ Checkout - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.ref }} - repository: ${{ github.event.pull_request.head.repo.full_name }} - fetch-depth: 0 - token: ${{ secrets.GITHUB_TOKEN }} - - name: Validate PR - run: | - # Check for any workflow changes - if git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.event.pull_request.head.sha }}" | grep -q "^.github/workflows/"; then - echo "⚠️ Workflow changes detected." - - # Get the PR author - AUTHOR="${{ github.event.pull_request.user.login }}" - echo "PR Author: $AUTHOR" - - # Allowlist check - if [[ "$AUTHOR" == "misrasaurabh1" || "$AUTHOR" == "KRRT7" ]]; then - echo "✅ Authorized user ($AUTHOR). Proceeding." - elif [[ "${{ github.event.pull_request.state }}" == "open" ]]; then - echo "✅ PR triggered by 'pull_request_target' and is open. Assuming protection rules are in place. Proceeding." - else - echo "⛔ Unauthorized user ($AUTHOR) attempting to modify workflows. Exiting." - exit 1 - fi - else - echo "✅ No workflow file changes detected. Proceeding." - fi - - - name: Set up Python 3.11 for CLI - uses: astral-sh/setup-uv@v8.0.0 - with: - python-version: 3.11.6 - - - name: Install dependencies (CLI) - run: | - uv sync - - - name: Run Codeflash to optimize code - id: optimize_code - run: | - uv run python tests/scripts/end_to_end_test_init_optimization.py diff --git a/.github/workflows/e2e-java-fibonacci-nogit.yaml b/.github/workflows/e2e-java-fibonacci-nogit.yaml deleted file mode 100644 index bab4f9a34..000000000 --- a/.github/workflows/e2e-java-fibonacci-nogit.yaml +++ /dev/null @@ -1,105 +0,0 @@ -name: E2E - Java Fibonacci (No Git) - -on: - pull_request: - paths: - - 'codeflash/languages/java/**' - - 'codeflash/languages/base.py' - - 'codeflash/languages/registry.py' - - 'codeflash/optimization/**' - - 'codeflash/verification/**' - - 'code_to_optimize/java/**' - - 'codeflash-java-runtime/**' - - 'tests/scripts/end_to_end_test_java_fibonacci.py' - - '.github/workflows/e2e-java-fibonacci-nogit.yaml' - - workflow_dispatch: - -concurrency: - group: ${{ github.workflow }}-${{ github.ref_name }} - cancel-in-progress: true - -jobs: - java-fibonacci-optimization-no-git: - environment: ${{ (github.event_name == 'workflow_dispatch' || (contains(toJSON(github.event.pull_request.files.*.filename), '.github/workflows/') && github.event.pull_request.user.login != 'misrasaurabh1' && github.event.pull_request.user.login != 'KRRT7')) && 'external-trusted-contributors' || '' }} - - runs-on: ubuntu-latest - env: - CODEFLASH_AIS_SERVER: prod - POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }} - CODEFLASH_API_KEY: ${{ secrets.CODEFLASH_API_KEY }} - COLUMNS: 110 - MAX_RETRIES: 3 - RETRY_DELAY: 5 - EXPECTED_IMPROVEMENT_PCT: 70 - CODEFLASH_END_TO_END: 1 - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.ref }} - repository: ${{ github.event.pull_request.head.repo.full_name }} - fetch-depth: 0 - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Validate PR - env: - PR_AUTHOR: ${{ github.event.pull_request.user.login }} - PR_STATE: ${{ github.event.pull_request.state }} - BASE_SHA: ${{ github.event.pull_request.base.sha }} - HEAD_SHA: ${{ github.event.pull_request.head.sha }} - run: | - if git diff --name-only "$BASE_SHA" "$HEAD_SHA" | grep -q "^.github/workflows/"; then - echo "⚠️ Workflow changes detected." - echo "PR Author: $PR_AUTHOR" - if [[ "$PR_AUTHOR" == "misrasaurabh1" || "$PR_AUTHOR" == "KRRT7" ]]; then - echo "✅ Authorized user ($PR_AUTHOR). Proceeding." - elif [[ "$PR_STATE" == "open" ]]; then - echo "✅ PR is open. Proceeding." - else - echo "⛔ Unauthorized user ($PR_AUTHOR) attempting to modify workflows. Exiting." - exit 1 - fi - else - echo "✅ No workflow file changes detected. Proceeding." - fi - - - name: Set up JDK 11 - uses: actions/setup-java@v4 - with: - java-version: '11' - distribution: 'temurin' - cache: maven - - - name: Set up Python 3.11 for CLI - uses: astral-sh/setup-uv@v8.0.0 - with: - python-version: 3.11.6 - - - name: Install dependencies (CLI) - run: uv sync - - - name: Build codeflash-runtime JAR - run: | - cd codeflash-java-runtime - mvn clean package -q -DskipTests - mvn install -q -DskipTests - - - name: Verify Java installation - run: | - java -version - mvn --version - - - name: Remove .git - run: | - if [ -d ".git" ]; then - sudo rm -rf .git - echo ".git directory removed." - else - echo ".git directory does not exist." - exit 1 - fi - - - name: Run Codeflash to optimize Fibonacci - run: | - uv run python tests/scripts/end_to_end_test_java_fibonacci.py diff --git a/.github/workflows/e2e-java-tracer.yaml b/.github/workflows/e2e-java-tracer.yaml deleted file mode 100644 index cfefaa8fa..000000000 --- a/.github/workflows/e2e-java-tracer.yaml +++ /dev/null @@ -1,90 +0,0 @@ -name: E2E - Java Tracer - -on: - pull_request: - paths: - - 'codeflash/**' - - 'codeflash-java-runtime/**' - - 'tests/**' - - '.github/workflows/e2e-java-tracer.yaml' - - workflow_dispatch: - -concurrency: - group: ${{ github.workflow }}-${{ github.ref_name }} - cancel-in-progress: true - -jobs: - java-tracer-e2e: - environment: ${{ (github.event_name == 'workflow_dispatch' || (contains(toJSON(github.event.pull_request.files.*.filename), '.github/workflows/') && github.event.pull_request.user.login != 'misrasaurabh1' && github.event.pull_request.user.login != 'KRRT7')) && 'external-trusted-contributors' || '' }} - - runs-on: ubuntu-latest - env: - CODEFLASH_AIS_SERVER: prod - POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }} - CODEFLASH_API_KEY: ${{ secrets.CODEFLASH_API_KEY }} - COLUMNS: 110 - MAX_RETRIES: 3 - RETRY_DELAY: 5 - EXPECTED_IMPROVEMENT_PCT: 10 - CODEFLASH_END_TO_END: 1 - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.ref }} - repository: ${{ github.event.pull_request.head.repo.full_name }} - fetch-depth: 0 - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Validate PR - env: - PR_AUTHOR: ${{ github.event.pull_request.user.login }} - PR_STATE: ${{ github.event.pull_request.state }} - BASE_SHA: ${{ github.event.pull_request.base.sha }} - HEAD_SHA: ${{ github.event.pull_request.head.sha }} - run: | - if git diff --name-only "$BASE_SHA" "$HEAD_SHA" | grep -q "^.github/workflows/"; then - echo "⚠️ Workflow changes detected." - echo "PR Author: $PR_AUTHOR" - if [[ "$PR_AUTHOR" == "misrasaurabh1" || "$PR_AUTHOR" == "KRRT7" ]]; then - echo "✅ Authorized user ($PR_AUTHOR). Proceeding." - elif [[ "$PR_STATE" == "open" ]]; then - echo "✅ PR is open. Proceeding." - else - echo "⛔ Unauthorized user ($PR_AUTHOR) attempting to modify workflows. Exiting." - exit 1 - fi - else - echo "✅ No workflow file changes detected. Proceeding." - fi - - - name: Set up JDK 11 - uses: actions/setup-java@v4 - with: - java-version: '11' - distribution: 'temurin' - cache: maven - - - name: Set up Python 3.11 for CLI - uses: astral-sh/setup-uv@v8.0.0 - with: - python-version: 3.11.6 - - - name: Install dependencies (CLI) - run: uv sync - - - name: Build codeflash-runtime JAR - run: | - cd codeflash-java-runtime - mvn clean package -q -DskipTests - mvn install -q -DskipTests - - - name: Verify Java installation - run: | - java -version - mvn --version - - - name: Run Java tracer e2e test - run: | - uv run python tests/scripts/end_to_end_test_java_tracer.py diff --git a/.github/workflows/e2e-js-cjs-function.yaml b/.github/workflows/e2e-js-cjs-function.yaml deleted file mode 100644 index e25e1c89b..000000000 --- a/.github/workflows/e2e-js-cjs-function.yaml +++ /dev/null @@ -1,93 +0,0 @@ -name: E2E - JS CommonJS Function - -on: - pull_request: - paths: - - 'codeflash/**' - - 'packages/**' - - 'tests/**' - - 'pyproject.toml' - - 'uv.lock' - - '.github/workflows/e2e-*.yaml' - - workflow_dispatch: - -concurrency: - group: ${{ github.workflow }}-${{ github.ref_name }} - cancel-in-progress: true - -jobs: - js-cjs-function-optimization: - # Dynamically determine if environment is needed only when workflow files change and contributor is external - environment: ${{ (github.event_name == 'workflow_dispatch' || (contains(toJSON(github.event.pull_request.files.*.filename), '.github/workflows/') && github.event.pull_request.user.login != 'misrasaurabh1' && github.event.pull_request.user.login != 'KRRT7')) && 'external-trusted-contributors' || '' }} - - runs-on: ubuntu-latest - env: - CODEFLASH_AIS_SERVER: prod - POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }} - CODEFLASH_API_KEY: ${{ secrets.CODEFLASH_API_KEY }} - COLUMNS: 110 - MAX_RETRIES: 3 - RETRY_DELAY: 5 - EXPECTED_IMPROVEMENT_PCT: 50 - CODEFLASH_END_TO_END: 1 - steps: - - name: 🛎️ Checkout - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.ref }} - repository: ${{ github.event.pull_request.head.repo.full_name }} - fetch-depth: 0 - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Validate PR - run: | - # Check for any workflow changes - if git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.event.pull_request.head.sha }}" | grep -q "^.github/workflows/"; then - echo "⚠️ Workflow changes detected." - - # Get the PR author - AUTHOR="${{ github.event.pull_request.user.login }}" - echo "PR Author: $AUTHOR" - - # Allowlist check - if [[ "$AUTHOR" == "misrasaurabh1" || "$AUTHOR" == "KRRT7" ]]; then - echo "✅ Authorized user ($AUTHOR). Proceeding." - elif [[ "${{ github.event.pull_request.state }}" == "open" ]]; then - echo "✅ PR triggered by 'pull_request_target' and is open. Assuming protection rules are in place. Proceeding." - else - echo "⛔ Unauthorized user ($AUTHOR) attempting to modify workflows. Exiting." - exit 1 - fi - else - echo "✅ No workflow file changes detected. Proceeding." - fi - - - name: Set up Node.js - uses: actions/setup-node@v4 - with: - node-version: '20' - - - name: Install codeflash npm package dependencies - run: | - cd packages/codeflash - npm install - - - name: Install JS test project dependencies - run: | - cd code_to_optimize/js/code_to_optimize_js - npm install - - - name: Set up Python 3.11 for CLI - uses: astral-sh/setup-uv@v8.0.0 - with: - python-version: 3.11.6 - - - name: Install dependencies (CLI) - run: | - uv sync - - - name: Run Codeflash to optimize JS CommonJS function - id: optimize_code - run: | - uv run python tests/scripts/end_to_end_test_js_cjs_function.py diff --git a/.github/workflows/e2e-js-esm-async.yaml b/.github/workflows/e2e-js-esm-async.yaml deleted file mode 100644 index 8590108ea..000000000 --- a/.github/workflows/e2e-js-esm-async.yaml +++ /dev/null @@ -1,93 +0,0 @@ -name: E2E - JS ESM Async - -on: - pull_request: - paths: - - 'codeflash/**' - - 'packages/**' - - 'tests/**' - - 'pyproject.toml' - - 'uv.lock' - - '.github/workflows/e2e-*.yaml' - - workflow_dispatch: - -concurrency: - group: ${{ github.workflow }}-${{ github.ref_name }} - cancel-in-progress: true - -jobs: - js-esm-async-optimization: - # Dynamically determine if environment is needed only when workflow files change and contributor is external - environment: ${{ (github.event_name == 'workflow_dispatch' || (contains(toJSON(github.event.pull_request.files.*.filename), '.github/workflows/') && github.event.pull_request.user.login != 'misrasaurabh1' && github.event.pull_request.user.login != 'KRRT7')) && 'external-trusted-contributors' || '' }} - - runs-on: ubuntu-latest - env: - CODEFLASH_AIS_SERVER: prod - POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }} - CODEFLASH_API_KEY: ${{ secrets.CODEFLASH_API_KEY }} - COLUMNS: 110 - MAX_RETRIES: 3 - RETRY_DELAY: 5 - EXPECTED_IMPROVEMENT_PCT: 10 - CODEFLASH_END_TO_END: 1 - steps: - - name: 🛎️ Checkout - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.ref }} - repository: ${{ github.event.pull_request.head.repo.full_name }} - fetch-depth: 0 - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Validate PR - run: | - # Check for any workflow changes - if git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.event.pull_request.head.sha }}" | grep -q "^.github/workflows/"; then - echo "⚠️ Workflow changes detected." - - # Get the PR author - AUTHOR="${{ github.event.pull_request.user.login }}" - echo "PR Author: $AUTHOR" - - # Allowlist check - if [[ "$AUTHOR" == "misrasaurabh1" || "$AUTHOR" == "KRRT7" ]]; then - echo "✅ Authorized user ($AUTHOR). Proceeding." - elif [[ "${{ github.event.pull_request.state }}" == "open" ]]; then - echo "✅ PR triggered by 'pull_request_target' and is open. Assuming protection rules are in place. Proceeding." - else - echo "⛔ Unauthorized user ($AUTHOR) attempting to modify workflows. Exiting." - exit 1 - fi - else - echo "✅ No workflow file changes detected. Proceeding." - fi - - - name: Set up Node.js - uses: actions/setup-node@v4 - with: - node-version: '20' - - - name: Install codeflash npm package dependencies - run: | - cd packages/codeflash - npm install - - - name: Install JS test project dependencies - run: | - cd code_to_optimize/js/code_to_optimize_js_esm - npm install - - - name: Set up Python 3.11 for CLI - uses: astral-sh/setup-uv@v8.0.0 - with: - python-version: 3.11.6 - - - name: Install dependencies (CLI) - run: | - uv sync - - - name: Run Codeflash to optimize ESM async function - id: optimize_code - run: | - uv run python tests/scripts/end_to_end_test_js_esm_async.py diff --git a/.github/workflows/e2e-js-ts-class.yaml b/.github/workflows/e2e-js-ts-class.yaml deleted file mode 100644 index a34d8d0c0..000000000 --- a/.github/workflows/e2e-js-ts-class.yaml +++ /dev/null @@ -1,93 +0,0 @@ -name: E2E - JS TypeScript Class - -on: - pull_request: - paths: - - 'codeflash/**' - - 'packages/**' - - 'tests/**' - - 'pyproject.toml' - - 'uv.lock' - - '.github/workflows/e2e-*.yaml' - - workflow_dispatch: - -concurrency: - group: ${{ github.workflow }}-${{ github.ref_name }} - cancel-in-progress: true - -jobs: - js-ts-class-optimization: - # Dynamically determine if environment is needed only when workflow files change and contributor is external - environment: ${{ (github.event_name == 'workflow_dispatch' || (contains(toJSON(github.event.pull_request.files.*.filename), '.github/workflows/') && github.event.pull_request.user.login != 'misrasaurabh1' && github.event.pull_request.user.login != 'KRRT7')) && 'external-trusted-contributors' || '' }} - - runs-on: ubuntu-latest - env: - CODEFLASH_AIS_SERVER: prod - POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }} - CODEFLASH_API_KEY: ${{ secrets.CODEFLASH_API_KEY }} - COLUMNS: 110 - MAX_RETRIES: 3 - RETRY_DELAY: 5 - EXPECTED_IMPROVEMENT_PCT: 30 - CODEFLASH_END_TO_END: 1 - steps: - - name: 🛎️ Checkout - uses: actions/checkout@v4 - with: - ref: ${{ github.event.pull_request.head.ref }} - repository: ${{ github.event.pull_request.head.repo.full_name }} - fetch-depth: 0 - token: ${{ secrets.GITHUB_TOKEN }} - - - name: Validate PR - run: | - # Check for any workflow changes - if git diff --name-only "${{ github.event.pull_request.base.sha }}" "${{ github.event.pull_request.head.sha }}" | grep -q "^.github/workflows/"; then - echo "⚠️ Workflow changes detected." - - # Get the PR author - AUTHOR="${{ github.event.pull_request.user.login }}" - echo "PR Author: $AUTHOR" - - # Allowlist check - if [[ "$AUTHOR" == "misrasaurabh1" || "$AUTHOR" == "KRRT7" ]]; then - echo "✅ Authorized user ($AUTHOR). Proceeding." - elif [[ "${{ github.event.pull_request.state }}" == "open" ]]; then - echo "✅ PR triggered by 'pull_request_target' and is open. Assuming protection rules are in place. Proceeding." - else - echo "⛔ Unauthorized user ($AUTHOR) attempting to modify workflows. Exiting." - exit 1 - fi - else - echo "✅ No workflow file changes detected. Proceeding." - fi - - - name: Set up Node.js - uses: actions/setup-node@v4 - with: - node-version: '20' - - - name: Install codeflash npm package dependencies - run: | - cd packages/codeflash - npm install - - - name: Install JS test project dependencies - run: | - cd code_to_optimize/js/code_to_optimize_ts - npm install - - - name: Set up Python 3.11 for CLI - uses: astral-sh/setup-uv@v8.0.0 - with: - python-version: 3.11.6 - - - name: Install dependencies (CLI) - run: | - uv sync - - - name: Run Codeflash to optimize TypeScript class method - id: optimize_code - run: | - uv run python tests/scripts/end_to_end_test_js_ts_class.py diff --git a/.github/workflows/prek.yaml b/.github/workflows/prek.yaml deleted file mode 100644 index abaad1457..000000000 --- a/.github/workflows/prek.yaml +++ /dev/null @@ -1,25 +0,0 @@ -name: Lint -on: - pull_request: - paths: - - 'codeflash/**' - - 'tests/**' - - 'packages/**' - - 'pyproject.toml' - - 'uv.lock' - -concurrency: - group: ${{ github.workflow }}-${{ github.ref_name }} - cancel-in-progress: true - -jobs: - prek: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - uses: astral-sh/setup-uv@v8.0.0 - - uses: j178/prek-action@v1 - with: - extra-args: '--from-ref origin/${{ github.base_ref }} --to-ref ${{ github.sha }}'