From 1ab6da855872821caa59a8e7f63d869ea7ded991 Mon Sep 17 00:00:00 2001 From: MaayanSidon Date: Tue, 14 Jul 2026 11:11:55 +0300 Subject: [PATCH 1/2] FR-25895: fail fast e2e when PR branch is behind base Avoid spinning up a venv and running the full suite on PRs that are already out of date with the base branch, since those runs are usually re-done after an update anyway. Co-authored-by: Cursor --- .github/workflows/full-test-suite.yaml | 68 ++++++++++++++++++++++++-- 1 file changed, 65 insertions(+), 3 deletions(-) diff --git a/.github/workflows/full-test-suite.yaml b/.github/workflows/full-test-suite.yaml index 21d4859..1585cdf 100644 --- a/.github/workflows/full-test-suite.yaml +++ b/.github/workflows/full-test-suite.yaml @@ -81,8 +81,39 @@ permissions: pull-requests: write jobs: + # Fail fast on PRs that are behind the base branch so we don't spin up a + # venv / run e2e that will need to be re-run after an update anyway. + # Skipped for merge_group / workflow_dispatch / other non-PR callers. + check-up-to-date: + name: Check PR is up to date with base + runs-on: ubuntu-latest + if: github.event_name == 'pull_request' + steps: + - name: Checkout PR head + uses: actions/checkout@v4 + with: + fetch-depth: 0 + ref: ${{ github.event.pull_request.head.sha }} + + - name: Fail if behind base branch + env: + BASE_REF: ${{ github.base_ref }} + run: | + git fetch --no-tags origin "$BASE_REF" + if ! git merge-base --is-ancestor "origin/$BASE_REF" HEAD; then + echo "::error::PR branch is behind '$BASE_REF'. Update the branch, then re-run e2e." + git --no-pager log --oneline "HEAD..origin/$BASE_REF" | head -20 + exit 1 + fi + echo "PR is up to date with origin/$BASE_REF" + start-venv: name: Start venv + needs: [ check-up-to-date ] + if: | + always() && + !cancelled() && + (needs.check-up-to-date.result == 'success' || needs.check-up-to-date.result == 'skipped') uses: frontegg/workflows/.github/workflows/start-venv.yaml@master with: volatileEnvironment: true @@ -121,9 +152,40 @@ jobs: dispatch_id: ${{ inputs.dispatch_id }} description: 'Start tests environment ${{ steps.variables.outputs.apiUrl }}' + # Re-check once after venv is ready so we don't start e2e/API if master + # moved during venv startup. Running shards are not cancelled mid-flight. + recheck-up-to-date: + name: Recheck PR is still up to date + runs-on: ubuntu-latest + needs: [ prepare-params ] + if: | + always() && + !cancelled() && + github.event_name == 'pull_request' && + !contains(needs.*.result, 'failure') && + !contains(needs.*.result, 'cancelled') + steps: + - name: Checkout PR head + uses: actions/checkout@v4 + with: + fetch-depth: 0 + ref: ${{ github.event.pull_request.head.sha }} + + - name: Fail if behind base branch + env: + BASE_REF: ${{ github.base_ref }} + run: | + git fetch --no-tags origin "$BASE_REF" + if ! git merge-base --is-ancestor "origin/$BASE_REF" HEAD; then + echo "::error::PR fell behind '$BASE_REF' during the run. Update the branch and re-run." + git --no-pager log --oneline "HEAD..origin/$BASE_REF" | head -20 + exit 1 + fi + echo "PR is still up to date with origin/$BASE_REF" + run-e2e-test: name: Run E2E Tests on Venv - needs: [ prepare-params ] + needs: [ prepare-params, recheck-up-to-date ] if: | always() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') @@ -145,7 +207,7 @@ jobs: run-api-test: name: Run API Tests on Venv - needs: [ prepare-params ] + needs: [ prepare-params, recheck-up-to-date ] if: | always() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') @@ -167,7 +229,7 @@ jobs: update-trigger-status: name: Update trigger status runs-on: ubuntu-latest - needs: [ run-api-test, run-e2e-test, start-venv, prepare-params ] + needs: [ check-up-to-date, recheck-up-to-date, run-api-test, run-e2e-test, start-venv, prepare-params ] if: ${{ always() && inputs.dispatch_id }} steps: - id: create_bot_token From f3ea2ed4fd5aacb763524c93062885891d23a22a Mon Sep 17 00:00:00 2001 From: MaayanSidon Date: Sun, 2 Aug 2026 11:06:08 +0300 Subject: [PATCH 2/2] FR-25895: move up-to-date check out of full-test-suite full-test-suite should only run the suite. Provide a shared action so callers can decide whether a PR must be up to date before invoking it. Co-authored-by: Cursor --- .../check-pr-up-to-date/action.yaml | 33 +++++++++ .github/workflows/full-test-suite.yaml | 68 +------------------ 2 files changed, 36 insertions(+), 65 deletions(-) create mode 100644 .github/shared-actions/check-pr-up-to-date/action.yaml diff --git a/.github/shared-actions/check-pr-up-to-date/action.yaml b/.github/shared-actions/check-pr-up-to-date/action.yaml new file mode 100644 index 0000000..0329070 --- /dev/null +++ b/.github/shared-actions/check-pr-up-to-date/action.yaml @@ -0,0 +1,33 @@ +name: Check PR is up to date with base +description: > + Fails when the PR head commit is behind the given base branch. + Callers decide whether to run this before expensive jobs (e.g. full-test-suite). +inputs: + base_ref: + description: Base branch name (e.g. master) + required: true + head_sha: + description: PR head commit SHA to check + required: true + +runs: + using: composite + steps: + - name: Checkout PR head + uses: actions/checkout@v4 + with: + fetch-depth: 0 + ref: ${{ inputs.head_sha }} + + - name: Fail if behind base branch + shell: bash + env: + BASE_REF: ${{ inputs.base_ref }} + run: | + git fetch --no-tags origin "$BASE_REF" + if ! git merge-base --is-ancestor "origin/$BASE_REF" HEAD; then + echo "::error::PR branch is behind '$BASE_REF'. Update the branch, then re-run." + git --no-pager log --oneline "HEAD..origin/$BASE_REF" | head -20 + exit 1 + fi + echo "PR is up to date with origin/$BASE_REF" diff --git a/.github/workflows/full-test-suite.yaml b/.github/workflows/full-test-suite.yaml index 1585cdf..21d4859 100644 --- a/.github/workflows/full-test-suite.yaml +++ b/.github/workflows/full-test-suite.yaml @@ -81,39 +81,8 @@ permissions: pull-requests: write jobs: - # Fail fast on PRs that are behind the base branch so we don't spin up a - # venv / run e2e that will need to be re-run after an update anyway. - # Skipped for merge_group / workflow_dispatch / other non-PR callers. - check-up-to-date: - name: Check PR is up to date with base - runs-on: ubuntu-latest - if: github.event_name == 'pull_request' - steps: - - name: Checkout PR head - uses: actions/checkout@v4 - with: - fetch-depth: 0 - ref: ${{ github.event.pull_request.head.sha }} - - - name: Fail if behind base branch - env: - BASE_REF: ${{ github.base_ref }} - run: | - git fetch --no-tags origin "$BASE_REF" - if ! git merge-base --is-ancestor "origin/$BASE_REF" HEAD; then - echo "::error::PR branch is behind '$BASE_REF'. Update the branch, then re-run e2e." - git --no-pager log --oneline "HEAD..origin/$BASE_REF" | head -20 - exit 1 - fi - echo "PR is up to date with origin/$BASE_REF" - start-venv: name: Start venv - needs: [ check-up-to-date ] - if: | - always() && - !cancelled() && - (needs.check-up-to-date.result == 'success' || needs.check-up-to-date.result == 'skipped') uses: frontegg/workflows/.github/workflows/start-venv.yaml@master with: volatileEnvironment: true @@ -152,40 +121,9 @@ jobs: dispatch_id: ${{ inputs.dispatch_id }} description: 'Start tests environment ${{ steps.variables.outputs.apiUrl }}' - # Re-check once after venv is ready so we don't start e2e/API if master - # moved during venv startup. Running shards are not cancelled mid-flight. - recheck-up-to-date: - name: Recheck PR is still up to date - runs-on: ubuntu-latest - needs: [ prepare-params ] - if: | - always() && - !cancelled() && - github.event_name == 'pull_request' && - !contains(needs.*.result, 'failure') && - !contains(needs.*.result, 'cancelled') - steps: - - name: Checkout PR head - uses: actions/checkout@v4 - with: - fetch-depth: 0 - ref: ${{ github.event.pull_request.head.sha }} - - - name: Fail if behind base branch - env: - BASE_REF: ${{ github.base_ref }} - run: | - git fetch --no-tags origin "$BASE_REF" - if ! git merge-base --is-ancestor "origin/$BASE_REF" HEAD; then - echo "::error::PR fell behind '$BASE_REF' during the run. Update the branch and re-run." - git --no-pager log --oneline "HEAD..origin/$BASE_REF" | head -20 - exit 1 - fi - echo "PR is still up to date with origin/$BASE_REF" - run-e2e-test: name: Run E2E Tests on Venv - needs: [ prepare-params, recheck-up-to-date ] + needs: [ prepare-params ] if: | always() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') @@ -207,7 +145,7 @@ jobs: run-api-test: name: Run API Tests on Venv - needs: [ prepare-params, recheck-up-to-date ] + needs: [ prepare-params ] if: | always() && !contains(needs.*.result, 'failure') && !contains(needs.*.result, 'cancelled') @@ -229,7 +167,7 @@ jobs: update-trigger-status: name: Update trigger status runs-on: ubuntu-latest - needs: [ check-up-to-date, recheck-up-to-date, run-api-test, run-e2e-test, start-venv, prepare-params ] + needs: [ run-api-test, run-e2e-test, start-venv, prepare-params ] if: ${{ always() && inputs.dispatch_id }} steps: - id: create_bot_token