From 1ab6da855872821caa59a8e7f63d869ea7ded991 Mon Sep 17 00:00:00 2001 From: MaayanSidon Date: Tue, 14 Jul 2026 11:11:55 +0300 Subject: [PATCH 1/3] 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/3] 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 From c149c3cb3e51c76a685e1d94e64212c3fc192ec8 Mon Sep 17 00:00:00 2001 From: MaayanSidon Date: Wed, 12 Aug 2026 10:23:55 +0300 Subject: [PATCH 3/3] FR-25895: add full-test-suite-on-pr entrypoint Thin PR wrapper that fails fast when the branch is behind base, then calls full-test-suite. Keeps PR policy out of the suite itself. Co-authored-by: Cursor --- .github/workflows/full-test-suite-on-pr.yaml | 121 +++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 .github/workflows/full-test-suite-on-pr.yaml diff --git a/.github/workflows/full-test-suite-on-pr.yaml b/.github/workflows/full-test-suite-on-pr.yaml new file mode 100644 index 0000000..d43017f --- /dev/null +++ b/.github/workflows/full-test-suite-on-pr.yaml @@ -0,0 +1,121 @@ +name: Full Suite Test on PR (API + E2E On Venv) +# PR entrypoint: decide whether the PR may run, then call full-test-suite. +# full-test-suite itself only runs the suite (no PR policy). +# Merge-queue / workflow_dispatch callers should keep using full-test-suite.yaml. +on: + workflow_call: + inputs: + build_image: + type: boolean + required: false + description: This has no effect on this workflow any more, should be remoeved when all services will remove it + default: false + tests_tag: + type: string + required: false + description: Set the e2e-api tests branch tag + default: master + ref: + type: string + required: false + description: Set the venv branch + default: '' + react_version: + type: string + required: false + description: Set the react version + dispatch_id: + type: string + required: false + description: Dispatch id to update status (repo/sha) + secrets: + GH_REPOSITORY_ADMIN_TOKEN: + description: 'Github repository admin token' + required: true + DEV_ARGOCD_PASSWORD: + description: 'ArgoCD password' + required: true + NPM_TOKEN: + description: 'Npm token' + required: true + DOCKER_HUB_ACTION_USER: + description: 'Docker hub user' + required: true + DOCKER_HUB_ACTION_PASSWORD: + description: 'Docker hub password' + required: true + MAILOSAUR_API_KEY: + description: 'MAILOSAUR API KEY' + required: true + MAILOSAUR_SERVER_ID: + description: 'MAILOSAUR SERVER ID' + required: true + MAILOSAUR_SERVER_DOMAIN: + description: 'MAILOSAUR SERVER DOMAIN' + required: true + ZEPHYR_TOKEN: + description: '' + required: true + AZURE_APP_CLIENT_ID: + description: '' + required: true + AZURE_APP_SECRET: + description: '' + required: true + GH_FRONTEGG_BOT_APP_ID: + description: 'Frontegg Bot Creds' + required: true + GH_FRONTEGG_BOT_APP_SECRET: + description: 'Frontegg Bot Creds' + required: true + DD_API_KEY: + description: 'Datadog API Key' + required: true + +permissions: + id-token: write + contents: read + issues: read + checks: write + statuses: write + pull-requests: write + +jobs: + 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" + + run-full-test: + name: Run full test suite + 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/full-test-suite.yaml@master + with: + build_image: ${{ inputs.build_image }} + tests_tag: ${{ inputs.tests_tag }} + ref: ${{ inputs.ref }} + react_version: ${{ inputs.react_version }} + dispatch_id: ${{ inputs.dispatch_id }} + secrets: inherit