diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 4d092949a..82d688084 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -193,463 +193,53 @@ jobs: # E2E tests — only on pull_request and workflow_dispatch (not push to main) # --------------------------------------------------------------------------- - # --- Standard Python E2Es --- - - 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 - - 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: + # --- Standard Python E2Es (9 tests) --- + e2e-python: needs: determine-changes if: >- needs.determine-changes.outputs.e2e == 'true' && github.event_name != 'push' + strategy: + fail-fast: false + matrix: + include: + - name: tracer-replay + script: end_to_end_test_tracer_replay.py + expected_improvement: 10 + - name: bubble-sort-pytest-nogit + script: end_to_end_test_bubblesort_pytest.py + expected_improvement: 70 + remove_git: true + - name: bubble-sort-unittest + script: end_to_end_test_bubblesort_unittest.py + expected_improvement: 40 + - name: futurehouse-structure + script: end_to_end_test_futurehouse.py + expected_improvement: 5 + - name: topological-sort + script: end_to_end_test_topological_sort_worktree.py + expected_improvement: 5 + - name: async-optimization + script: end_to_end_test_async.py + expected_improvement: 10 + - name: benchmark-bubble-sort + script: end_to_end_test_benchmark_sort.py + expected_improvement: 5 + - name: coverage-e2e + script: end_to_end_test_coverage.py + extra_deps: black + - name: init-optimization + script: end_to_end_test_init_optimization.py + expected_improvement: 10 + name: ${{ matrix.name }} 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 @@ -685,155 +275,60 @@ jobs: - 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 extra dependencies + if: matrix.extra_deps + run: uv add ${{ matrix.extra_deps }} - - name: Install JS test project dependencies + - name: Set test configuration + if: matrix.expected_improvement 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 }} + echo "COLUMNS=110" >> "$GITHUB_ENV" + echo "EXPECTED_IMPROVEMENT_PCT=${{ matrix.expected_improvement }}" >> "$GITHUB_ENV" - - name: Validate PR - if: github.event_name == 'pull_request' + - name: Remove .git + if: matrix.remove_git 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." + 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 "No workflow file changes. Proceeding." + echo ".git directory does not exist. Nothing to remove." + exit 1 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 + run: uv run python tests/scripts/${{ matrix.script }} - js-ts-class: + # --- JS E2Es (3 tests, need Node.js + packages/) --- + e2e-js: needs: determine-changes if: >- (needs.determine-changes.outputs.e2e == 'true' || needs.determine-changes.outputs.e2e_js == 'true') && github.event_name != 'push' + strategy: + fail-fast: false + matrix: + include: + - name: js-cjs-function + script: end_to_end_test_js_cjs_function.py + js_project_dir: code_to_optimize/js/code_to_optimize_js + expected_improvement: 50 + - name: js-esm-async + script: end_to_end_test_js_esm_async.py + js_project_dir: code_to_optimize/js/code_to_optimize_js_esm + expected_improvement: 10 + - name: js-ts-class + script: end_to_end_test_js_ts_class.py + js_project_dir: code_to_optimize/js/code_to_optimize_ts + expected_improvement: 30 + name: ${{ matrix.name }} 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: @@ -843,7 +338,7 @@ jobs: COLUMNS: 110 MAX_RETRIES: 3 RETRY_DELAY: 5 - EXPECTED_IMPROVEMENT_PCT: 30 + EXPECTED_IMPROVEMENT_PCT: ${{ matrix.expected_improvement }} CODEFLASH_END_TO_END: 1 steps: - uses: actions/checkout@v4 @@ -883,7 +378,7 @@ jobs: - name: Install JS test project dependencies run: | - cd code_to_optimize/js/code_to_optimize_ts + cd ${{ matrix.js_project_dir }} npm install - name: Install uv @@ -895,16 +390,31 @@ jobs: run: uv sync - name: Run E2E test - run: uv run python tests/scripts/end_to_end_test_js_ts_class.py + run: uv run python tests/scripts/${{ matrix.script }} - # --- Java E2Es (need JDK + Maven) --- - - java-fibonacci-nogit: + # --- Java E2Es (3 tests, need JDK + Maven) --- + e2e-java: needs: determine-changes if: >- (needs.determine-changes.outputs.e2e == 'true' || needs.determine-changes.outputs.e2e_java == 'true') && github.event_name != 'push' + strategy: + fail-fast: false + matrix: + include: + - name: java-fibonacci-nogit + script: end_to_end_test_java_fibonacci.py + expected_improvement: 70 + remove_git: true + - name: java-tracer + script: end_to_end_test_java_tracer.py + expected_improvement: 10 + - name: java-void-optimization-nogit + script: end_to_end_test_java_void_optimization.py + expected_improvement: 70 + remove_git: true + name: ${{ matrix.name }} 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: @@ -914,7 +424,7 @@ jobs: COLUMNS: 110 MAX_RETRIES: 3 RETRY_DELAY: 5 - EXPECTED_IMPROVEMENT_PCT: 70 + EXPECTED_IMPROVEMENT_PCT: ${{ matrix.expected_improvement }} CODEFLASH_END_TO_END: 1 steps: - uses: actions/checkout@v4 @@ -969,6 +479,7 @@ jobs: mvn --version - name: Remove .git + if: matrix.remove_git run: | if [ -d ".git" ]; then sudo rm -rf .git @@ -979,79 +490,7 @@ jobs: 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 + run: uv run python tests/scripts/${{ matrix.script }} # --------------------------------------------------------------------------- # Gate job — the ONLY required check in the GitHub ruleset. @@ -1065,20 +504,9 @@ jobs: - 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 + - e2e-python + - e2e-js + - e2e-java runs-on: ubuntu-latest steps: - name: Verify all required jobs passed diff --git a/.github/workflows/e2e-java-void-optimization.yaml b/.github/workflows/e2e-java-void-optimization.yaml deleted file mode 100644 index 0e25a2d65..000000000 --- a/.github/workflows/e2e-java-void-optimization.yaml +++ /dev/null @@ -1,105 +0,0 @@ -name: E2E - Java Void Optimization (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_void_optimization.py' - - '.github/workflows/e2e-java-void-optimization.yaml' - - workflow_dispatch: - -concurrency: - group: ${{ github.workflow }}-${{ github.ref_name }} - cancel-in-progress: true - -jobs: - java-void-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@v6 - 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 void function - run: | - uv run python tests/scripts/end_to_end_test_java_void_optimization.py \ No newline at end of file