From 48bc2ab6efc6677781e458a5b24888a9ad440bfa Mon Sep 17 00:00:00 2001 From: Devashish Chandra Date: Fri, 27 Nov 2026 17:38:40 +0530 Subject: [PATCH 1/2] ci(e2e): run the Docker-free lane from the E2E Tests parent workflow docker-free-e2e.yml becomes a reusable workflow that e2e-tests.yml calls next to docker-unified.yml. Its own push and pull_request triggers and the docker-free:pytests label gate are removed; workflow_dispatch stays for running the lane alone (full tier, 9 batches, smart testing off). - e2e-tests.yml: setup decides run_pytest, smoke_tier and smoke_changed_tests (copies of docker-unified's PR logic, commented on both sides). The docker_free job calls the lane on pull requests, forks included, when the Docker lane runs pytest, and on every push to master while the lane runs next to the Docker lane. - docker-free-e2e.yml: takes classify_pr's outputs plus smoke_tier and smoke_changed_tests. A new smoke_test_matrix job resolves the smart testing mode and plans batches with SMOKE_BACKEND=local on the lane's own weights (artifact pytest-smoke-plan-local), with the same fallbacks as docker-unified (9 batches full tier, 3 for p0). The lane posts its own sticky smart testing comment and pins its PostHog failure events to "Docker-free E2E". - render_comment.py: compose --lane gives a lane its own comment marker. send_smart_selection_to_posthog.py: events carry a lane property (docker, docker-free). - post-workflow-actions.yml: the Docker build success message for an E2E Tests push now follows the run's docker / * jobs, and Docker Build, Scan, Test pushes from older release branches still notify. The escape check compares Docker-lane results only. - update-test-weights.yml reads Docker-free results from e2e-tests.yml; validate_post_workflow_list.py allows "Docker-free E2E" (dispatch runs); ci-optimization's pytest-workflow filter covers the lane. - smoke-test/README.md describes both lanes, labels and dispatch. Co-Authored-By: Claude Opus 5.5 --- .github/actions/ci-optimization/action.yml | 2 + .../send_smart_selection_to_posthog.py | 2 + .../test_send_smart_selection_to_posthog.py | 7 +- .../scripts/validate_post_workflow_list.py | 2 + .github/smart-testing/render_comment.py | 16 +- .../smart-testing/test/test_render_comment.py | 8 + .github/workflows/docker-free-e2e.yml | 423 +++++++++++++++--- .github/workflows/docker-unified.yml | 6 + .github/workflows/e2e-tests.yml | 96 +++- .github/workflows/post-workflow-actions.yml | 65 ++- .github/workflows/update-test-weights.yml | 11 +- AGENTS.md | 2 +- smoke-test/README.md | 37 +- 13 files changed, 590 insertions(+), 87 deletions(-) diff --git a/.github/actions/ci-optimization/action.yml b/.github/actions/ci-optimization/action.yml index e9de0a8e52a3b..1f973c5c5665a 100644 --- a/.github/actions/ci-optimization/action.yml +++ b/.github/actions/ci-optimization/action.yml @@ -152,6 +152,8 @@ runs: pytest-workflow: - ".github/workflows/e2e-tests.yml" - ".github/workflows/docker-unified.yml" + - ".github/workflows/docker-free-e2e.yml" + - ".github/actions/docker-free-stack/**" - ".github/actions/ci-optimization/**" - ".github/actions/smoke-test-retry/**" - ".github/actions/restore-dependency-caches/**" diff --git a/.github/scripts/send_smart_selection_to_posthog.py b/.github/scripts/send_smart_selection_to_posthog.py index 49aad7f0a11bd..d8f4f93f81419 100644 --- a/.github/scripts/send_smart_selection_to_posthog.py +++ b/.github/scripts/send_smart_selection_to_posthog.py @@ -79,6 +79,8 @@ def get(name: str) -> str: "head_sha": get("HEAD_SHA"), "pr_number": _number(get("PR_NUMBER"), int), "framework": get("TEST_FRAMEWORK"), + # Which e2e lane planned it (docker, docker-free); empty when unset. + "lane": get("TEST_LANE"), "mode": get("SMART_MODE"), "confidence": get("SMART_CONFIDENCE"), "failsafe_reason": failsafe_reason, diff --git a/.github/scripts/test/test_send_smart_selection_to_posthog.py b/.github/scripts/test/test_send_smart_selection_to_posthog.py index 70aa096fcfa24..dfeb0bd97a106 100644 --- a/.github/scripts/test/test_send_smart_selection_to_posthog.py +++ b/.github/scripts/test/test_send_smart_selection_to_posthog.py @@ -10,6 +10,7 @@ BASE_ENV = { "TEST_FRAMEWORK": "pytest", + "TEST_LANE": "docker-free", "GITHUB_REPOSITORY": "org/repo", "GITHUB_RUN_ID": "123", "GITHUB_RUN_ATTEMPT": "2", @@ -41,7 +42,7 @@ def test_properties_from_successful_plan() -> None: props = sender.build_properties(BASE_ENV, PLAN) - assert props["framework"] == "pytest" + assert props["framework"] == "pytest" and props["lane"] == "docker-free" assert props["tests_selected"] == 40 and props["tests_total"] == 400 assert props["modules_selected"] == 3 and props["modules_total"] == 30 assert props["batch_count"] == 2 and props["plan_ok"] is True @@ -81,9 +82,11 @@ def test_missing_classifier_outputs_default_to_empty() -> None: env = { k: v for k, v in BASE_ENV.items() - if k not in ("FAILSAFE_REASON", "PROPOSED_TAGS", "CLASSIFIER_DURATION_S") + if k + not in ("FAILSAFE_REASON", "PROPOSED_TAGS", "CLASSIFIER_DURATION_S", "TEST_LANE") } props = sender.build_properties(env, None) + assert props["lane"] == "" assert props["failsafe_reason"] == "" assert props["proposed_tags"] == "" assert props["classifier_duration_s"] is None diff --git a/.github/scripts/validate_post_workflow_list.py b/.github/scripts/validate_post_workflow_list.py index 117595b9ca241..76cdfe4f944d8 100755 --- a/.github/scripts/validate_post_workflow_list.py +++ b/.github/scripts/validate_post_workflow_list.py @@ -35,6 +35,8 @@ ALLOWED_NON_PR_WORKFLOWS = { # docker-unified.yml: release and dispatch runs; PRs and pushes go through E2E Tests. "Docker Build, Scan, Test", + # docker-free-e2e.yml: dispatch runs; PRs and pushes go through E2E Tests. + "Docker-free E2E", "Nightly Docker Test", "Release Tests", "Release Validation", diff --git a/.github/smart-testing/render_comment.py b/.github/smart-testing/render_comment.py index 07ed8a759f931..76651c91ec194 100644 --- a/.github/smart-testing/render_comment.py +++ b/.github/smart-testing/render_comment.py @@ -10,6 +10,9 @@ * ``compose``: run by ``comment_smart_testing`` with the pytest section and the Playwright tier plan (either may be absent) to write the whole comment to ``COMMENT_FILE``, which that job upserts onto the PR, found by ``MARKER``. + +Another lane (docker-free-e2e.yml) runs both steps too; ``compose --lane`` gives +its comment its own marker (``lane_marker``) so each lane keeps one comment. """ import argparse @@ -28,6 +31,12 @@ ) MARKER = "" + + +def lane_marker(lane: Optional[str]) -> str: + """The Docker lane keeps the plain MARKER; any other lane gets its own.""" + return f"" if lane else MARKER + REASONING_MAX_CHARS = 300 MAX_LISTED_SCOPES = 100 @@ -273,11 +282,13 @@ def compose( pytest_section: str, playwright_plan: Optional[Dict[str, Any]], env: Mapping[str, str], + lane: Optional[str] = None, ) -> str: sections = [pytest_section] if pytest_section.strip() else [] if playwright_plan: sections.append(render_playwright_section(playwright_plan)) - body = [MARKER, "## Smart test selection", ""] + title = "## Smart test selection" + (f" ({lane} lane)" if lane else "") + body = [lane_marker(lane), title, ""] body.append( "\n".join(sections) if sections @@ -310,6 +321,7 @@ def main() -> None: compose_parser = sub.add_parser("compose") compose_parser.add_argument("--pytest-section") compose_parser.add_argument("--playwright-plan") + compose_parser.add_argument("--lane", help="Lane name for its own comment marker") args = parser.parse_args() if args.command == "pytest": @@ -320,7 +332,7 @@ def main() -> None: f.write(body) else: plan = load_plan(args.playwright_plan) - body = compose(read_text(args.pytest_section), plan, os.environ) + body = compose(read_text(args.pytest_section), plan, os.environ, args.lane) out = os.environ.get("COMMENT_FILE") if out: diff --git a/.github/smart-testing/test/test_render_comment.py b/.github/smart-testing/test/test_render_comment.py index ab40410648727..4a609422d324f 100644 --- a/.github/smart-testing/test/test_render_comment.py +++ b/.github/smart-testing/test/test_render_comment.py @@ -241,6 +241,14 @@ def test_compose_handles_missing_sections() -> None: assert "No test selection was computed" in neither +def test_lane_comment_has_its_own_marker() -> None: + lane = render.compose("### pytest smoke tests\n", None, {}, lane="docker-free") + assert lane.startswith(render.lane_marker("docker-free")) + # The Docker lane's upsert finds its comment by MARKER; it must not match this one. + assert render.MARKER not in lane + assert "(docker-free lane)" in lane + + def test_playwright_baseline_only_plan_has_no_table() -> None: plan = {**P0_PLAN, "specs": [P0_PLAN["specs"][1]]} body = render.render_playwright_section(plan) diff --git a/.github/workflows/docker-free-e2e.yml b/.github/workflows/docker-free-e2e.yml index 88b0c7fba5ff8..fb2b565f7ca72 100644 --- a/.github/workflows/docker-free-e2e.yml +++ b/.github/workflows/docker-free-e2e.yml @@ -1,23 +1,57 @@ name: "Docker-free E2E" # End-to-end tests on the Docker-free stack (`datahub-dev.sh start --local`); the pytest -# smoke suite for now, Playwright later. The pytest job is shaped like pytest_tests in -# docker-unified.yml so it can become a reusable workflow. +# smoke suite for now, Playwright later. A lane of e2e-tests.yml, which calls it on +# pull requests when the Docker lane runs pytest, and on pushes to master. The +# jobs are shaped like docker-unified.yml's smoke_test_matrix and pytest_tests. # -# Pull requests run it only with the docker-free:pytests label. Test failures fail the run, -# on pull requests and on master. +# Test failures fail the run, on pull requests and on master. on: - push: - branches: - - master - pull_request: - types: [opened, synchronize, reopened, labeled] + workflow_call: + inputs: + # classify_pr's outputs in e2e-tests.yml; same names as docker-unified.yml's + # inputs. Empty means no classification: smart testing falls back as there. + playwright_mode: + type: string + default: "" + smart_tags: + type: string + default: "" + confidence: + type: string + default: "" + failsafe_reason: + type: string + default: "" + reasoning: + type: string + default: "" + changed_files: + type: string + default: "" + proposed_tags: + type: string + default: "" + model: + type: string + default: "" + classifier_duration_s: + type: string + default: "" + # p0 or full, as docker-unified's setup output; empty means full. + smoke_tier: + type: string + default: "" + # Test modules this PR touches, as docker-unified's setup output. + smoke_changed_tests: + type: string + default: "" + # Runs the lane alone: full tier, 9 fixed batches, smart testing off. + workflow_dispatch: -concurrency: - # Adding an unrelated label gets its own group, so it does not cancel a running lane. - group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}${{ github.event.action == 'labeled' && github.event.label.name != 'docker-free:pytests' && format('-{0}', github.run_id) || '' }} - cancel-in-progress: ${{ github.event_name == 'pull_request' }} +# No concurrency group: under workflow_call, github.workflow is the caller's name, so a +# group here would share e2e-tests.yml's. The caller cancels superseded PR runs. permissions: contents: read @@ -26,22 +60,11 @@ permissions: jobs: build: name: Build stack - # Forks get no secrets. A labeled event runs only for this lane's label. - if: >- - github.event_name == 'push' || - (github.event.pull_request.head.repo.full_name == github.repository && - (github.event.action != 'labeled' || github.event.label.name == 'docker-free:pytests') && - contains(github.event.pull_request.labels.*.name, 'docker-free:pytests')) # 4 vCPU / 16 GB, as Build all images in docker-unified; yarnBuild needs 16 GB. # GitHub-hosted (same size) where the repository has no Depot project. runs-on: ${{ vars.DEPOT_PROJECT_ID != '' && 'depot-ubuntu-24.04-4' || 'ubuntu-24.04' }} timeout-minutes: 60 outputs: - pytest_matrix: ${{ steps.set-matrix.outputs.pytest_matrix }} - smoke_tier: ${{ steps.set-matrix.outputs.smoke_tier }} - smart_testing_mode: ${{ steps.set-matrix.outputs.smart_testing_mode }} - smart_tags: ${{ steps.set-matrix.outputs.smart_tags }} - batch_plan: ${{ steps.set-matrix.outputs.batch_plan }} uv_cache_key: ${{ steps.cache-keys.outputs.uv_cache_key }} uv_cache_key_prefix: ${{ steps.cache-keys.outputs.uv_cache_key_prefix }} yarn_cache_key: ${{ steps.cache-keys.outputs.yarn_cache_key }} @@ -67,29 +90,6 @@ jobs: echo "yarn_cache_key_prefix=docker-unified-${{ runner.os }}-yarn-" } >> "$GITHUB_OUTPUT" - - name: Set matrix - id: set-matrix - env: - # Smart testing stays off for this lane. Turning it on means adding the plan - # step from smoke_test_matrix (plan_pytest_batches.sh with SMOKE_BACKEND=local) - # and emitting its batch_count; the batch job already reads these outputs. - SMART_TESTING_MODE: "off" - # docker-unified.yml packs the full suite into 5 batches; tests run about - # twice as long on this stack, and each batch boots its own stack. - FULL_BATCH_COUNT: "9" - run: | - items="" - for ((i=0;i> "$GITHUB_OUTPUT" - - name: Set up toolchain uses: ./.github/actions/setup-toolchain with: @@ -135,16 +135,313 @@ jobs: retention-days: 1 overwrite: true + # This lane's copy of smoke_test_matrix in docker-unified.yml: the tier, the batch + # matrix and, under smart testing, a batch plan packed on this stack's weights + # (SMOKE_BACKEND=local). e2e-tests.yml calls the lane only when pytest runs, so there + # is no run_pytest gate here. Keep the mode rules and fallbacks in step with it. + smoke_test_matrix: + runs-on: ${{ vars.DEPOT_PROJECT_ID != '' && 'depot-ubuntu-24.04-small' || 'ubuntu-24.04' }} + timeout-minutes: 30 + outputs: + pytest_matrix: ${{ steps.set-matrix.outputs.pytest_matrix }} + smoke_tier: ${{ steps.set-matrix.outputs.smoke_tier }} + smart_testing_mode: ${{ steps.resolve-mode.outputs.mode }} + smart_tags: ${{ steps.set-matrix.outputs.smart_tags }} + # Selection context for the pytest failure events sent to PostHog. + smart_selection: ${{ steps.plan.outcome == 'success' && steps.plan.outputs.selection || '' }} + smart_confidence: ${{ inputs.confidence }} + # 'true' when pytest_tests must download pytest-smoke-plan-local and run only + # the scopes planned for its batch. + batch_plan: ${{ steps.set-matrix.outputs.batch_plan }} + steps: + - name: Resolve smart testing mode + id: resolve-mode + # mode: off | shadow | active (repo var SMART_TESTING_MODE), same-repo PRs only. + # Dispatch and push run with it off, and so does a PR with the run-all-tests or + # run-all-tests:pytest label. + run: | + mode=off + if [[ "${{ github.event_name }}" == 'pull_request' \ + && "${{ github.event.pull_request.head.repo.full_name == github.repository }}" == 'true' \ + && "${{ contains(github.event.pull_request.labels.*.name, 'run-all-tests') }}" != 'true' \ + && "${{ contains(github.event.pull_request.labels.*.name, 'run-all-tests:pytest') }}" != 'true' ]]; then + mode="${{ vars.SMART_TESTING_MODE || 'shadow' }}" + fi + echo "Smart testing mode=$mode" + echo "mode=$mode" >> "$GITHUB_OUTPUT" + + - name: Check out the repo + if: ${{ steps.resolve-mode.outputs.mode != 'off' }} + uses: acryldata/sane-checkout-action@186e92cc5948a9c3e1cc7a96eaff9f776f3fc8e3 # v7 + + - name: Compute dependency cache keys + id: cache-keys + if: ${{ steps.resolve-mode.outputs.mode != 'off' }} + # Same keys as the build job's step of this name (the docker-unified buckets). + run: | + { + echo "uv_cache_key=docker-unified-${{ runner.os }}-uv-${{ hashFiles( + './datahub-actions/pyproject.toml', + './datahub-actions/setup.py', + './smoke-test/requirements.txt', + './smoke-test/pyproject.toml', + './metadata-ingestion/pyproject.toml', + './metadata-ingestion/setup.py') }}" + echo "uv_cache_key_prefix=docker-unified-${{ runner.os }}-uv-" + echo "yarn_cache_key=docker-unified-${{ runner.os }}-yarn-${{ hashFiles('./datahub-web-react/yarn.lock') }}" + echo "yarn_cache_key_prefix=docker-unified-${{ runner.os }}-yarn-" + } >> "$GITHUB_OUTPUT" + + - name: Set up toolchain + uses: ./.github/actions/setup-toolchain + if: ${{ steps.resolve-mode.outputs.mode != 'off' }} + + - name: Restore dependency caches + uses: ./.github/actions/restore-dependency-caches + if: ${{ steps.resolve-mode.outputs.mode != 'off' }} + with: + uv_cache_key: ${{ steps.cache-keys.outputs.uv_cache_key }} + uv_cache_key_prefix: ${{ steps.cache-keys.outputs.uv_cache_key_prefix }} + yarn_cache_key: ${{ steps.cache-keys.outputs.yarn_cache_key }} + yarn_cache_key_prefix: ${{ steps.cache-keys.outputs.yarn_cache_key_prefix }} + restore_yarn: "false" + + - name: Install dependencies + if: ${{ steps.resolve-mode.outputs.mode != 'off' }} + run: ./metadata-ingestion/scripts/install_deps.sh + + # Collecting the suite imports datahub.metadata, which needs codegen. + - name: Generate metadata model classes + if: ${{ steps.resolve-mode.outputs.mode != 'off' }} + env: + DEPOT_TOKEN: "${{ secrets.DEPOT_TOKEN }}" + run: ./gradlew :metadata-ingestion:codegen + + - name: Plan pytest batches + id: plan + if: ${{ steps.resolve-mode.outputs.mode != 'off' }} + # A failed plan never blocks: set-matrix falls back to the fixed p0 matrix + # (active) or just skips the shadow summary. + continue-on-error: true + env: + RUN_QUICKSTART: "false" + TEST_STRATEGY: plan + # Packs on pytest_test_weights_docker_free.json and deselects what this stack + # lacks. Must match pytest_tests, which refuses another lane's plan. + SMOKE_BACKEND: local + SMOKE_SMART_TAGS: ${{ inputs.smart_tags }} + SMOKE_CHANGED_TESTS: ${{ inputs.smoke_changed_tests }} + SMOKE_DUMP_BATCH_PLAN: ${{ github.workspace }}/pytest-smoke-plan/pytest-smoke-plan.json + SMOKE_PLAN_SMART_MODE: ${{ steps.resolve-mode.outputs.mode }} + # Must match pytest_tests: batch weighting models this many workers. + PYTEST_XDIST_WORKERS: "3" + # Fewest batches (up to this cap, the full-suite count) whose predicted pytest + # time meets 8 min, or the slowest single scope when that alone is longer. + PLAN_MAX_BATCHES: "9" + run: .github/smart-testing/plan_pytest_batches.sh + + - name: Upload batch plan + if: ${{ steps.resolve-mode.outputs.mode != 'off' && steps.plan.outcome == 'success' }} + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + # The Docker lane's plan in the same run is pytest-smoke-plan. + name: pytest-smoke-plan-local + path: pytest-smoke-plan/pytest-smoke-plan.json + retention-days: 7 + + - name: Set Matrix + id: set-matrix + env: + MODE: ${{ steps.resolve-mode.outputs.mode }} + PLAN_OUTCOME: ${{ steps.plan.outcome }} + PLAN_TIER: ${{ steps.plan.outputs.smoke_tier }} + PLAN_SELECTION: ${{ steps.plan.outputs.selection }} + PLAN_FILE: pytest-smoke-plan/pytest-smoke-plan.json + SMART_TAGS: ${{ inputs.smart_tags }} + DEFAULT_TIER: ${{ inputs.smoke_tier || 'full' }} + # Fixed matrices for runs the planner does not size. docker-unified.yml packs + # the full suite into 5 batches; tests run about twice as long on this stack, + # and each batch boots its own stack. On this lane's weights (2026-11-27) the + # p0 tier predicts ~2.7 min a batch at 3, about what a full batch predicts at 9. + P0_BATCH_COUNT: "3" + FULL_BATCH_COUNT: "9" + run: | + emit_matrix() { + local count=$1 items="" + batches=$count + for ((i=0;i> "$GITHUB_OUTPUT" + } + + tier=$DEFAULT_TIER + tags=$SMART_TAGS + batch_plan=false + batches=0 + selection=$DEFAULT_TIER + + if [[ "$MODE" == 'active' && "$PLAN_OUTCOME" == 'success' ]]; then + # Zero planned batches gives an empty matrix: pytest_tests skips. + tier=$PLAN_TIER + selection=$PLAN_SELECTION + batch_plan=true + emit_matrix "$(jq -r '.batch_count' "$PLAN_FILE")" + elif [[ "$MODE" == 'active' ]]; then + echo "::warning::Smart testing plan failed; falling back to the fixed p0 matrix" + tier=p0 + selection=p0 + tags='' + emit_matrix "$P0_BATCH_COUNT" + elif [[ "$tier" == 'p0' ]]; then + emit_matrix "$P0_BATCH_COUNT" + else + emit_matrix "$FULL_BATCH_COUNT" + fi + + { + echo "smoke_tier=$tier" + echo "smart_tags=$tags" + echo "batch_plan=$batch_plan" + echo "selection=$selection" + } >> "$GITHUB_OUTPUT" + echo "Final: mode=$MODE running selection=$selection (tier=$tier) in $batches batch(es), batch_plan=$batch_plan" + if [[ "$MODE" == 'shadow' && "$PLAN_OUTCOME" == 'success' ]]; then + echo "Shadow: active mode would run selection=$PLAN_SELECTION (tier=$PLAN_TIER) in $(jq -r '.batch_count' "$PLAN_FILE") planned batch(es)" + fi + + - name: Render smart testing PR comment + # Never blocks: the comment is explanatory only. + if: ${{ always() && steps.resolve-mode.outputs.mode != 'off' }} + continue-on-error: true + env: + SMART_MODE: ${{ steps.resolve-mode.outputs.mode }} + SMART_CONFIDENCE: ${{ inputs.confidence }} + FAILSAFE_REASON: ${{ inputs.failsafe_reason }} + SMART_TAGS: ${{ inputs.smart_tags }} + SMART_REASONING: ${{ inputs.reasoning }} + CHANGED_FILES: ${{ inputs.changed_files }} + SMART_SELECTION: ${{ steps.plan.outcome == 'success' && steps.plan.outputs.selection || '' }} + SELECTION_APPLIED: ${{ steps.set-matrix.outputs.selection }} + PLAN_OUTCOME: ${{ steps.plan.outcome }} + PLAN_FILE: pytest-smoke-plan/pytest-smoke-plan.json + COMMENT_FILE: smart-testing-comment/pytest-section.md + run: python3 .github/smart-testing/render_comment.py pytest + + - name: Upload smart testing comment + if: ${{ always() && hashFiles('smart-testing-comment/pytest-section.md') != '' }} + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + continue-on-error: true + with: + # The Docker lane's section in the same run is smart-testing-comment. + name: smart-testing-comment-local + path: smart-testing-comment/pytest-section.md + retention-days: 7 + + - name: Send smart selection telemetry to PostHog + # One ci_smart_selection event per attempt for this lane. Telemetry only. + if: ${{ always() && steps.resolve-mode.outputs.mode != 'off' }} + continue-on-error: true + env: + POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }} + POSTHOG_HOST: ${{ secrets.POSTHOG_HOST }} + TEST_FRAMEWORK: pytest + TEST_LANE: docker-free + HEAD_BRANCH: ${{ github.head_ref }} + BASE_BRANCH: ${{ github.base_ref }} + HEAD_SHA: ${{ github.event.pull_request.head.sha }} + PR_NUMBER: ${{ github.event.pull_request.number }} + SMART_MODE: ${{ steps.resolve-mode.outputs.mode }} + SMART_CONFIDENCE: ${{ inputs.confidence }} + FAILSAFE_REASON: ${{ inputs.failsafe_reason }} + SMART_TAGS: ${{ inputs.smart_tags }} + PROPOSED_TAGS: ${{ inputs.proposed_tags }} + SMART_MODEL: ${{ inputs.model }} + CLASSIFIER_DURATION_S: ${{ inputs.classifier_duration_s }} + SMART_SELECTION: ${{ steps.plan.outcome == 'success' && steps.plan.outputs.selection || '' }} + SELECTION_APPLIED: ${{ steps.set-matrix.outputs.selection }} + PLAN_OUTCOME: ${{ steps.plan.outcome }} + PLAN_FILE: pytest-smoke-plan/pytest-smoke-plan.json + run: python3 .github/scripts/send_smart_selection_to_posthog.py + + # Separate from the planning job so it keeps its read-only token. Its own sticky + # comment (lane marker), next to the Docker lane's. + comment_smart_testing: + name: Comment smart test selection + runs-on: ubuntu-24.04 + needs: [smoke_test_matrix] + if: | + always() && github.event_name == 'pull_request' && + github.event.pull_request.head.repo.full_name == github.repository && + needs.smoke_test_matrix.outputs.smart_testing_mode != '' && needs.smoke_test_matrix.outputs.smart_testing_mode != 'off' + permissions: + contents: read + pull-requests: write + actions: read + steps: + - name: Check out the comment renderer + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + sparse-checkout: .github/smart-testing + + - name: Download pytest section + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + continue-on-error: true + with: + name: smart-testing-comment-local + path: smart-testing-comment + + - name: Compose comment + id: compose + continue-on-error: true + env: + HEAD_SHA: ${{ github.event.pull_request.head.sha }} + RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} + COMMENT_FILE: smart-testing-comment/comment.md + run: | + SHORT_SHA=${HEAD_SHA:0:7} python3 .github/smart-testing/render_comment.py compose \ + --lane docker-free \ + --pytest-section smart-testing-comment/pytest-section.md + cat "$COMMENT_FILE" >> "$GITHUB_STEP_SUMMARY" + + - name: Upsert smart testing PR comment + if: ${{ steps.compose.outcome == 'success' }} + continue-on-error: true + uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 + with: + script: | + const fs = require('fs'); + // render_comment.py lane_marker('docker-free'); differs from the Docker lane's. + const marker = ''; + const body = fs.readFileSync('smart-testing-comment/comment.md', 'utf8'); + const { owner, repo } = context.repo; + const issue_number = context.payload.pull_request.number; + const comments = await github.paginate(github.rest.issues.listComments, { + owner, + repo, + issue_number, + }); + const existing = comments.find( + (c) => c.user?.type === 'Bot' && c.body?.includes(marker), + ); + if (existing) { + await github.rest.issues.updateComment({ owner, repo, comment_id: existing.id, body }); + } else { + await github.rest.issues.createComment({ owner, repo, issue_number, body }); + } + pytest_tests: name: Docker-free Pytest Smoke Tests (Batch ${{ matrix.batch }}/${{ matrix.batch_count }}) - needs: build + needs: [build, smoke_test_matrix] + # An active plan with zero batches gives an empty matrix. + if: ${{ needs.smoke_test_matrix.outputs.pytest_matrix != '{"include":[]}' }} # 4 vCPU / 16 GB, as pytest_tests in docker-unified: 3 xdist workers, GMS (2 GB # heap), OpenSearch and the frontend preview. runs-on: ${{ vars.DEPOT_PROJECT_ID != '' && 'depot-ubuntu-24.04-4' || 'ubuntu-24.04' }} timeout-minutes: 90 strategy: fail-fast: false - matrix: ${{ fromJson(needs.build.outputs.pytest_matrix) }} + matrix: ${{ fromJson(needs.smoke_test_matrix.outputs.pytest_matrix) }} steps: - name: Check out the repo uses: acryldata/sane-checkout-action@186e92cc5948a9c3e1cc7a96eaff9f776f3fc8e3 # v7 @@ -203,6 +500,13 @@ jobs: DEPOT_TOKEN: "${{ secrets.DEPOT_TOKEN }}" run: ./gradlew :metadata-ingestion:install + - name: Download batch plan + if: ${{ needs.smoke_test_matrix.outputs.batch_plan == 'true' && steps.retry-check.outputs.parse_result != 'all_passed' }} + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + name: pytest-smoke-plan-local + path: pytest-smoke-plan + - name: Smoke test id: smoke if: steps.retry-check.outputs.parse_result != 'all_passed' @@ -216,11 +520,12 @@ jobs: SMOKE_BACKEND: local BATCH_COUNT: ${{ matrix.batch_count }} BATCH_NUMBER: ${{ matrix.batch }} - SMOKE_TIER: ${{ needs.build.outputs.smoke_tier }} - # Smart testing plumbing, as in pytest_tests; off for this lane (see Set matrix). - SMOKE_SMART_TESTING: ${{ needs.build.outputs.smart_testing_mode }} - SMOKE_SMART_TAGS: ${{ needs.build.outputs.smart_tags }} - SMOKE_BATCH_PLAN: ${{ needs.build.outputs.batch_plan == 'true' && format('{0}/pytest-smoke-plan/pytest-smoke-plan.json', github.workspace) || '' }} + SMOKE_TIER: ${{ needs.smoke_test_matrix.outputs.smoke_tier }} + SMOKE_CHANGED_TESTS: ${{ inputs.smoke_changed_tests }} + # Smart test selection, as in pytest_tests (see smoke_test_matrix). + SMOKE_SMART_TESTING: ${{ needs.smoke_test_matrix.outputs.smart_testing_mode }} + SMOKE_SMART_TAGS: ${{ needs.smoke_test_matrix.outputs.smart_tags }} + SMOKE_BATCH_PLAN: ${{ needs.smoke_test_matrix.outputs.batch_plan == 'true' && format('{0}/pytest-smoke-plan/pytest-smoke-plan.json', github.workspace) || '' }} PYTEST_XDIST_WORKERS: "3" FILTERED_TESTS: ${{ steps.retry-check.outputs.filtered_tests_file || '' }} # See pytest_tests: a retry runs a smaller set, so it takes the stronger wait. @@ -279,7 +584,9 @@ jobs: POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }} POSTHOG_HOST: ${{ secrets.POSTHOG_HOST }} GH_HEAD_REF: ${{ github.head_ref || github.ref_name }} - SMART_MODE: ${{ needs.build.outputs.smart_testing_mode }} + SMART_MODE: ${{ needs.smoke_test_matrix.outputs.smart_testing_mode }} + SMART_SELECTION: ${{ needs.smoke_test_matrix.outputs.smart_selection }} + SMART_CONFIDENCE: ${{ needs.smoke_test_matrix.outputs.smart_confidence }} run: | if [ -z "$POSTHOG_API_KEY" ]; then echo "POSTHOG_API_KEY not configured, skipping test failure metrics" @@ -295,7 +602,7 @@ jobs: --posthog-api-key "$POSTHOG_API_KEY" \ --posthog-host "${POSTHOG_HOST:-https://app.posthog.com}" \ --repository "${{ github.repository }}" \ - --workflow-name "${{ github.workflow }}" \ + --workflow-name "Docker-free E2E" \ --branch "${GH_HEAD_REF}" \ --run-id "${{ github.run_id }}" \ --run-attempt "${{ github.run_attempt }}" \ @@ -303,7 +610,9 @@ jobs: --batch-label "docker-free" \ --batch-count "${{ strategy.job-total }}" \ --test-strategy "pytests" \ - --smart-mode "$SMART_MODE" + --smart-mode "$SMART_MODE" \ + --smart-selection "$SMART_SELECTION" \ + --smart-confidence "$SMART_CONFIDENCE" rm -rf "$TEMP_DIR" diff --git a/.github/workflows/docker-unified.yml b/.github/workflows/docker-unified.yml index 4e1a064a4d7ef..1caa4a8a91f55 100644 --- a/.github/workflows/docker-unified.yml +++ b/.github/workflows/docker-unified.yml @@ -161,6 +161,8 @@ jobs: # # This is the default tier only: smoke_test_matrix owns the final tier # (its smoke_tier output) and replaces it under active smart testing. + # e2e-tests.yml's setup copies this and smoke_changed_tests for the + # Docker-free lane; keep them in step. smoke_tier: >- ${{ (github.event_name == 'pull_request' @@ -657,6 +659,8 @@ jobs: mode="${{ vars.SMART_TESTING_MODE || 'shadow' }}" fi + # e2e-tests.yml's setup copies this run_pytest (PR values) to start the + # Docker-free lane; keep them in step. run_pytest=false if [[ "${{ needs.setup.outputs.backend_change }}" == 'true' || "${{ needs.setup.outputs.smoke_test_change }}" == 'true' || "${{ needs.setup.outputs.publish }}" == 'true' ]]; then run_pytest=true @@ -881,6 +885,7 @@ jobs: POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }} POSTHOG_HOST: ${{ secrets.POSTHOG_HOST }} TEST_FRAMEWORK: pytest + TEST_LANE: docker HEAD_BRANCH: ${{ github.head_ref }} BASE_BRANCH: ${{ github.base_ref }} # The PR head, not github.sha (the merge ref): the post-merge check @@ -1907,6 +1912,7 @@ jobs: POSTHOG_API_KEY: ${{ secrets.POSTHOG_API_KEY }} POSTHOG_HOST: ${{ secrets.POSTHOG_HOST }} TEST_FRAMEWORK: playwright + TEST_LANE: docker HEAD_BRANCH: ${{ github.head_ref }} BASE_BRANCH: ${{ github.base_ref }} HEAD_SHA: ${{ github.event.pull_request.head.sha }} diff --git a/.github/workflows/e2e-tests.yml b/.github/workflows/e2e-tests.yml index 580556e4df522..2d1d382ae4af8 100644 --- a/.github/workflows/e2e-tests.yml +++ b/.github/workflows/e2e-tests.yml @@ -1,7 +1,8 @@ # Parent of the end-to-end test lanes. Owns the pull_request and push # triggers, classifies the PR once for smart testing, and calls each lane as a -# reusable workflow. Release and manual runs still start docker-unified.yml -# directly. +# reusable workflow: docker (docker-unified.yml) and docker-free +# (docker-free-e2e.yml). Release and manual runs still start docker-unified.yml +# directly; manual runs of the Docker-free lane start docker-free-e2e.yml. name: E2E Tests on: push: @@ -15,6 +16,8 @@ on: - "!.github/**" - ".github/workflows/e2e-tests.yml" - ".github/workflows/docker-unified.yml" + - ".github/workflows/docker-free-e2e.yml" + - ".github/actions/docker-free-stack" - ".github/scripts/send_failed_tests_to_posthog.py" - ".github/scripts/send_smart_selection_to_posthog.py" # Smart-testing classifier, selection and batch planning (pytest wiring). @@ -46,6 +49,8 @@ on: - "!.github/**" - ".github/workflows/e2e-tests.yml" - ".github/workflows/docker-unified.yml" + - ".github/workflows/docker-free-e2e.yml" + - ".github/actions/docker-free-stack" - ".github/scripts/send_failed_tests_to_posthog.py" - ".github/scripts/send_smart_selection_to_posthog.py" # Smart-testing classifier, selection and batch planning (pytest wiring). @@ -81,7 +86,8 @@ permissions: contents: read jobs: - # Only what classify_pr reads. Each lane computes its own change flags. + # What classify_pr reads, and whether the Docker-free lane runs. Each lane + # computes its own change flags. setup: runs-on: depot-ubuntu-24.04-small if: ${{ github.event_name == 'pull_request' }} @@ -93,6 +99,18 @@ jobs: # True when docker-unified's setup builds a non-empty Playwright matrix on a PR. playwright_change: ${{ steps.ci-optimize.outputs.backend-change == 'true' || steps.ci-optimize.outputs.frontend-change == 'true' || steps.ci-optimize.outputs.playwright-change == 'true' }} test_runner_type_small: ${{ env.IS_FORK == 'true' && 'ubuntu-24.04' || 'depot-ubuntu-24.04-small' }} + # Copies of docker-unified.yml's run_pytest (smoke_test_matrix), smoke_tier and + # smoke_changed_tests (setup), PR values only: the Docker-free lane runs when the + # Docker lane runs pytest, at the same tier. Keep them in step. + run_pytest: ${{ steps.pytest.outputs.run_pytest }} + smoke_tier: >- + ${{ + (vars.PYTEST_P0_SMOKE == 'true' + && !contains(github.event.pull_request.labels.*.name, 'run-all-tests') + && !contains(github.event.pull_request.labels.*.name, 'run-all-tests:pytest')) + && 'p0' || 'full' + }} + smoke_changed_tests: ${{ steps.pytest.outputs.changed_tests }} steps: - name: Check out the repo uses: acryldata/sane-checkout-action@186e92cc5948a9c3e1cc7a96eaff9f776f3fc8e3 # v7 @@ -102,6 +120,49 @@ jobs: - uses: ./.github/actions/ci-optimization id: ci-optimize + - name: Decide pytest + id: pytest + env: + BACKEND_CHANGE: ${{ steps.ci-optimize.outputs.backend-change }} + SMOKE_TEST_CHANGE: ${{ steps.ci-optimize.outputs.smoke-test-change }} + CONNECTOR_SOURCE_ONLY: ${{ steps.ci-optimize.outputs.connector-source-only }} + INGESTION_ONLY: ${{ steps.ci-optimize.outputs.ingestion-only }} + PYTEST_WORKFLOW_CHANGE: ${{ steps.ci-optimize.outputs.pytest-workflow-change }} + CHANGED_FILES: ${{ steps.ci-optimize.outputs.changed-files }} + # smoke_test_matrix's pytest smart mode; only 'active' matters here. + SMART_MODE: >- + ${{ + (env.IS_FORK != 'true' + && !contains(github.event.pull_request.labels.*.name, 'run-all-tests') + && !contains(github.event.pull_request.labels.*.name, 'run-all-tests:pytest')) + && (vars.SMART_TESTING_MODE || 'shadow') || 'off' + }} + run: | + run_pytest=false + if [[ "$BACKEND_CHANGE" == 'true' || "$SMOKE_TEST_CHANGE" == 'true' ]]; then + run_pytest=true + elif [[ "$CONNECTOR_SOURCE_ONLY" == 'true' ]]; then + : + elif [[ "$INGESTION_ONLY" == 'true' ]]; then + run_pytest=true + fi + if [[ "$PYTEST_WORKFLOW_CHANGE" == 'true' && "$SMART_MODE" == 'active' ]]; then + run_pytest=true + fi + + files="" + if [[ -n "${CHANGED_FILES:-}" ]] && jq -e 'type == "array"' <<<"$CHANGED_FILES" >/dev/null 2>&1; then + files=$(jq -r '.[]' <<<"$CHANGED_FILES") + fi + changed=$(printf '%s\n' "$files" \ + | grep -E '^smoke-test/tests/e2e/(.*/)?(test_.*|.*_test)\.py$' || true) + + echo "run_pytest=$run_pytest smart_mode=$SMART_MODE changed_tests=$(printf '%s' "$changed" | tr '\n' ' ')" + { + echo "run_pytest=$run_pytest" + echo "changed_tests=$(printf '%s' "$changed" | tr '\n' ' ')" + } >> "$GITHUB_OUTPUT" + # Classifies the PR into taxonomy tags (smart testing) once, for both suites: # smoke_test_matrix plans pytest batches from them and playwright_plan the # Playwright tier. Every step is continue-on-error because pytest_tests gates on @@ -269,3 +330,32 @@ jobs: model: ${{ needs.classify_pr.outputs.model }} classifier_duration_s: ${{ needs.classify_pr.outputs.classifier_duration_s }} secrets: inherit + + # The Docker-free lane: on PRs (forks too) when the Docker lane runs pytest, and on + # every push to master while it runs next to the Docker lane (a stability window, + # to be narrowed later). Fork PRs get no repository variables or secrets, so the + # lane falls back to GitHub-hosted runners, no Depot cache and smart testing off. + docker_free: + needs: [setup, classify_pr] + if: >- + ${{ !cancelled() && ( + (github.event_name == 'push' && github.ref == 'refs/heads/master') || + (github.event_name == 'pull_request' && needs.setup.outputs.run_pytest == 'true')) }} + permissions: + contents: read + actions: read + pull-requests: write + uses: ./.github/workflows/docker-free-e2e.yml + with: + playwright_mode: ${{ needs.classify_pr.outputs.playwright_mode }} + smart_tags: ${{ needs.classify_pr.outputs.smart_tags }} + confidence: ${{ needs.classify_pr.outputs.confidence }} + failsafe_reason: ${{ needs.classify_pr.outputs.failsafe_reason }} + reasoning: ${{ needs.classify_pr.outputs.reasoning }} + changed_files: ${{ needs.classify_pr.outputs.changed_files }} + proposed_tags: ${{ needs.classify_pr.outputs.proposed_tags }} + model: ${{ needs.classify_pr.outputs.model }} + classifier_duration_s: ${{ needs.classify_pr.outputs.classifier_duration_s }} + smoke_tier: ${{ needs.setup.outputs.smoke_tier }} + smoke_changed_tests: ${{ needs.setup.outputs.smoke_changed_tests }} + secrets: inherit diff --git a/.github/workflows/post-workflow-actions.yml b/.github/workflows/post-workflow-actions.yml index 49b3e5b049a0a..d451631e9e6eb 100644 --- a/.github/workflows/post-workflow-actions.yml +++ b/.github/workflows/post-workflow-actions.yml @@ -211,17 +211,63 @@ jobs: thread_ts_file: ${{ github.event.workflow_run.event != 'schedule' && '.slack-thread-ts.json' || '' }} channel: ${{ vars.BUILD_STATUS_NOTIFICATION_SLACK_CHANNEL }} - # Notify Slack when the Docker build succeeds: E2E Tests on a post-commit - # push, Docker Build, Scan, Test on a release. + # Whether the Docker lane of an E2E Tests push run passed. The run also holds + # the Docker-free lane, so its conclusion can't say that. A run that fails only + # in the Docker-free lane still reports the Docker build as successful. + docker-lane-result: + name: Docker lane result + if: >- + github.event_name == 'workflow_run' + && github.event.workflow_run.name == 'E2E Tests' + && github.event.workflow_run.event == 'push' + && contains(fromJSON('["success","failure"]'), github.event.workflow_run.conclusion) + runs-on: ubuntu-24.04 + permissions: + actions: read + outputs: + success: ${{ steps.check.outputs.success }} + steps: + - name: Check the run's docker / * jobs + id: check + env: + GH_TOKEN: ${{ github.token }} + REPOSITORY: ${{ github.repository }} + RUN_ID: ${{ github.event.workflow_run.id }} + RUN_ATTEMPT: ${{ github.event.workflow_run.run_attempt }} + run: | + conclusions=$(gh api --paginate \ + "repos/$REPOSITORY/actions/runs/$RUN_ID/attempts/$RUN_ATTEMPT/jobs?per_page=100" \ + --jq '.jobs[] | select(.name | startswith("docker / ")) | .conclusion') + total=$(grep -c . <<<"$conclusions" || true) + bad=$(grep -cvxE 'success|skipped' <<<"$conclusions" || true) + echo "docker / * jobs: $total, not success or skipped: $bad" + success=false + if (( total > 0 && bad == 0 )); then + success=true + fi + echo "success=$success" >> "$GITHUB_OUTPUT" + + # Notify Slack when the Docker build succeeds: the Docker lane of an E2E Tests + # post-commit push, or Docker Build, Scan, Test on a release (or a push from a + # release branch cut before E2E Tests existed). # Posts a standalone message (not threaded) so it's visible as a positive signal # separate from any failure thread on the same commit. notify-slack-docker-success: name: Notify Slack on Docker build success + needs: [docker-lane-result] + # An E2E Tests run that failed on attempt 1 waits for retry-on-failure's + # rerun, so a Docker-free failure does not notify twice. if: >- - github.event_name == 'workflow_run' - && github.event.workflow_run.conclusion == 'success' - && ((github.event.workflow_run.name == 'E2E Tests' && github.event.workflow_run.event == 'push') - || (github.event.workflow_run.name == 'Docker Build, Scan, Test' && github.event.workflow_run.event == 'release')) + always() + && github.event_name == 'workflow_run' + && ((github.event.workflow_run.name == 'E2E Tests' + && github.event.workflow_run.event == 'push' + && needs.docker-lane-result.outputs.success == 'true' + && (github.event.workflow_run.conclusion == 'success' + || github.event.workflow_run.run_attempt > 1)) + || (github.event.workflow_run.name == 'Docker Build, Scan, Test' + && github.event.workflow_run.conclusion == 'success' + && contains(fromJSON('["push","release"]'), github.event.workflow_run.event))) uses: ./.github/workflows/notify-slack-status.yml secrets: inherit with: @@ -298,13 +344,14 @@ jobs: } >> "$GITHUB_OUTPUT" # The pattern avoids the parentheses in "Test Results (smoke tests) - # pytests N"; only the pytest batch artifacts contain "pytests ". + # pytests N" (? matches them) and leaves out the Docker-free lane's + # "Test Results (docker-free smoke tests) pytests N" in the same run. - name: Download post-merge pytest results if: steps.resolve.outputs.pr_run_id != '' continue-on-error: true uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 with: - pattern: "*pytests *" + pattern: "Test Results ?smoke tests? pytests *" path: post-merge-junit run-id: ${{ steps.resolve.outputs.run_id }} github-token: ${{ github.token }} @@ -325,7 +372,7 @@ jobs: continue-on-error: true uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 with: - pattern: "*pytests *" + pattern: "Test Results ?smoke tests? pytests *" path: pr-junit run-id: ${{ steps.resolve.outputs.pr_run_id }} github-token: ${{ github.token }} diff --git a/.github/workflows/update-test-weights.yml b/.github/workflows/update-test-weights.yml index e38fd7380ed83..ef3172ce77b5d 100644 --- a/.github/workflows/update-test-weights.yml +++ b/.github/workflows/update-test-weights.yml @@ -79,12 +79,13 @@ jobs: env: GH_TOKEN: ${{ github.token }} run: | - # The Docker-free lane (docker-free-e2e.yml) packs its batches on its own weights - # file. Soft-skip when master has no recent lane runs: the committed file stays. + # The Docker-free lane (docker-free-e2e.yml, called by e2e-tests.yml) packs its + # batches on its own weights file. Soft-skip when master has no recent lane + # runs: the committed file stays. DOWNLOAD_OUTPUT=$(bash .github/scripts/download_test_artifacts.sh \ --output-dir ./test-artifacts-docker-free \ --run-count ${{ github.event.inputs.run_count || '3' }} \ - --workflow docker-free-e2e.yml \ + --workflow e2e-tests.yml \ --artifact-prefix "Test Results (docker-free smoke tests)" \ --repository ${{ github.repository }} \ --no-fail-on-empty) @@ -193,9 +194,9 @@ jobs: --stats-out ./weight-stats/smoke-docker-free.json \ --file smoke-test/pytest_test_weights_docker_free.json \ --framework "Smoke pytest (Docker-free)" \ - --workflow docker-free-e2e.yml \ + --workflow e2e-tests.yml \ --entry-noun tests \ - --batch-hint "FULL_BATCH_COUNT in docker-free-e2e.yml (9)" \ + --batch-hint "FULL_BATCH_COUNT / P0_BATCH_COUNT in docker-free-e2e.yml (full=9; p0=3)" \ --test-id-key testId \ --threshold 5.0 \ --pr-gate threshold \ diff --git a/AGENTS.md b/AGENTS.md index 7923787f431d3..610e1c3dbce40 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -552,7 +552,7 @@ without changing the machine default. Select the default instance for this shell with `eval "$(scripts/dev/datahub-dev.sh shell-env)"`. Stop retains the profiles. See [scripts/dev/README.md](scripts/dev/README.md) for details and offline tests. -**CI:** `.github/workflows/docker-free-e2e.yml` runs the pytest smoke suite on this stack (label `docker-free:pytests` on a PR). See [`smoke-test/README.md`](smoke-test/README.md#the-docker-free-pytest-lane-in-ci). +**CI:** `.github/workflows/docker-free-e2e.yml` runs the pytest smoke suite on this stack, called by `e2e-tests.yml` on PRs that run pytest and on pushes to `master`. See [`smoke-test/README.md`](smoke-test/README.md#the-docker-free-pytest-lane-in-ci). ### End-to-End Workflow diff --git a/smoke-test/README.md b/smoke-test/README.md index 37e11896d5db1..b8fad4135d038 100644 --- a/smoke-test/README.md +++ b/smoke-test/README.md @@ -328,14 +328,35 @@ no longer matches a difference. CI runs it in report-only mode in the GMS-lite L ### The Docker-free pytest lane in CI -`.github/workflows/docker-free-e2e.yml` runs the full pytest suite on the Docker-free stack, in -9 batches. One job builds the jars, the embedded OpenSearch node and the frontend bundle; each -batch boots its own stack with the `.github/actions/docker-free-stack` action and runs `smoke.sh` -with `SMOKE_BACKEND=local`, which deselects the tests marked `requires(...)` for what that stack -lacks. - -- **When it runs:** on every push to `master`. On a pull request only with the - `docker-free:pytests` label. A failing batch fails the run, on pull requests and on `master`. +`.github/workflows/docker-free-e2e.yml` runs the pytest suite on the Docker-free stack. One job +builds the jars, the embedded OpenSearch node and the frontend bundle; each batch boots its own +stack with the `.github/actions/docker-free-stack` action and runs `smoke.sh` with +`SMOKE_BACKEND=local`, which deselects the tests marked `requires(...)` for what that stack lacks. + +`.github/workflows/e2e-tests.yml` (`E2E Tests`) owns the pull request and push triggers. It +classifies the PR once for smart testing and calls each lane as a reusable workflow, so lane jobs +show as `docker / …` and `docker-free / …`. + +| | Docker lane (`docker-unified.yml`) | Docker-free lane (`docker-free-e2e.yml`) | +| ------------------------------------------ | ----------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------- | +| Same-repo pull request | pytest when the change can affect smoke tests (backend, smoke-test or ingestion code; not connector-only changes) | Same condition as the Docker lane's pytest | +| Pull request from a fork | Same condition, full suite in 5 batches | Same condition, full suite in 9 batches on GitHub-hosted runners | +| Push to `master` | Full suite, 5 batches | Full suite, 9 batches | +| Push to `releases/**` | Full suite, 5 batches | Skipped | +| Batch matrix (smart testing off or shadow) | 5 batches full tier, 3 for `p0` | 9 batches full tier, 3 for `p0` | +| Batch matrix (smart testing active) | Planned on `pytest_test_weights.json` | Planned on `pytest_test_weights_docker_free.json` | +| Smart testing PR comment | `Smart test selection` | `Smart test selection (docker-free lane)` | + +This repository sets `PYTEST_P0_SMOKE=true` and `SMART_TESTING_MODE=active`, so a same-repo pull +request runs the `p0` tier with active smart testing: each lane runs the batches its plan sizes +(at most 9), and a pull request that only changes the pytest wiring runs a canary. The fixed +matrices run on pushes to `master`, on pull requests with `run-all-tests` or `run-all-tests:pytest`, +on fork pull requests (repository variables don't reach them) and on dispatch. + +- **Labels:** `run-all-tests` and `run-all-tests:pytest` turn smart testing off for both lanes, so + each runs its fixed matrix. They do not start a lane the change would not start. +- **Run a lane alone:** dispatch `docker-free-e2e.yml` (full tier, 9 batches, smart testing off) or + `docker-unified.yml` from the Actions tab. - **Results:** each batch uploads `Test Results (docker-free smoke tests) pytests ` and, on failure, `logs-docker-free-pytests-` (launcher, GMS, system-update, frontend and OpenSearch logs). The Boot stack step writes the boot timings to the job summary. From 319253a0ef4de30cbd8cfa81c5ad06d010d3117b Mon Sep 17 00:00:00 2001 From: Devashish Chandra Date: Fri, 27 Nov 2026 17:48:14 +0530 Subject: [PATCH 2/2] ci(e2e): run the Docker-free lane on master pushes only for now The lane runs on every push to master to build up a record of stable runs before it runs on pull requests. The PR wiring (run_pytest, smoke_tier and smoke_changed_tests from setup, the classifier's tags) stays in place, so enabling pull requests is one condition on the docker_free job. The calling job is named docker-free, so the lane's jobs show as "docker-free / " rather than "docker_free / ". Co-Authored-By: Claude Opus 5.5 --- .github/workflows/docker-free-e2e.yml | 7 ++++--- .github/workflows/e2e-tests.yml | 16 +++++++++------- AGENTS.md | 2 +- smoke-test/README.md | 23 +++++------------------ 4 files changed, 19 insertions(+), 29 deletions(-) diff --git a/.github/workflows/docker-free-e2e.yml b/.github/workflows/docker-free-e2e.yml index fb2b565f7ca72..81068e7f221d7 100644 --- a/.github/workflows/docker-free-e2e.yml +++ b/.github/workflows/docker-free-e2e.yml @@ -2,10 +2,11 @@ name: "Docker-free E2E" # End-to-end tests on the Docker-free stack (`datahub-dev.sh start --local`); the pytest # smoke suite for now, Playwright later. A lane of e2e-tests.yml, which calls it on -# pull requests when the Docker lane runs pytest, and on pushes to master. The -# jobs are shaped like docker-unified.yml's smoke_test_matrix and pytest_tests. +# pushes to master (pull requests later, once the lane has a record of stable runs). +# The jobs are shaped like docker-unified.yml's smoke_test_matrix and pytest_tests, so +# the PR path (smart testing, batch plan, PR comment) is ready for that. # -# Test failures fail the run, on pull requests and on master. +# Test failures fail the run. on: workflow_call: diff --git a/.github/workflows/e2e-tests.yml b/.github/workflows/e2e-tests.yml index 2d1d382ae4af8..c4a5747075fd8 100644 --- a/.github/workflows/e2e-tests.yml +++ b/.github/workflows/e2e-tests.yml @@ -331,16 +331,18 @@ jobs: classifier_duration_s: ${{ needs.classify_pr.outputs.classifier_duration_s }} secrets: inherit - # The Docker-free lane: on PRs (forks too) when the Docker lane runs pytest, and on - # every push to master while it runs next to the Docker lane (a stability window, - # to be narrowed later). Fork PRs get no repository variables or secrets, so the - # lane falls back to GitHub-hosted runners, no Depot cache and smart testing off. + # The Docker-free lane runs on every push to master for now, to build up a record of + # stable runs before it runs on pull requests. The PR wiring (run_pytest, smoke_tier, + # smoke_changed_tests from setup, classify_pr's tags) is in place: enabling it means + # adding `|| (github.event_name == 'pull_request' && needs.setup.outputs.run_pytest + # == 'true')` to the condition. Fork PRs would then fall back to GitHub-hosted + # runners, no Depot cache and smart testing off. docker_free: + # Prefix of the lane's job names: docker-free / . + name: docker-free needs: [setup, classify_pr] if: >- - ${{ !cancelled() && ( - (github.event_name == 'push' && github.ref == 'refs/heads/master') || - (github.event_name == 'pull_request' && needs.setup.outputs.run_pytest == 'true')) }} + ${{ !cancelled() && github.event_name == 'push' && github.ref == 'refs/heads/master' }} permissions: contents: read actions: read diff --git a/AGENTS.md b/AGENTS.md index 610e1c3dbce40..7ceaa4b301948 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -552,7 +552,7 @@ without changing the machine default. Select the default instance for this shell with `eval "$(scripts/dev/datahub-dev.sh shell-env)"`. Stop retains the profiles. See [scripts/dev/README.md](scripts/dev/README.md) for details and offline tests. -**CI:** `.github/workflows/docker-free-e2e.yml` runs the pytest smoke suite on this stack, called by `e2e-tests.yml` on PRs that run pytest and on pushes to `master`. See [`smoke-test/README.md`](smoke-test/README.md#the-docker-free-pytest-lane-in-ci). +**CI:** `.github/workflows/docker-free-e2e.yml` runs the pytest smoke suite on this stack, called by `e2e-tests.yml` on pushes to `master` (not yet on PRs). See [`smoke-test/README.md`](smoke-test/README.md#the-docker-free-pytest-lane-in-ci). ### End-to-End Workflow diff --git a/smoke-test/README.md b/smoke-test/README.md index b8fad4135d038..6fb56d2a98fff 100644 --- a/smoke-test/README.md +++ b/smoke-test/README.md @@ -337,24 +337,11 @@ stack with the `.github/actions/docker-free-stack` action and runs `smoke.sh` wi classifies the PR once for smart testing and calls each lane as a reusable workflow, so lane jobs show as `docker / …` and `docker-free / …`. -| | Docker lane (`docker-unified.yml`) | Docker-free lane (`docker-free-e2e.yml`) | -| ------------------------------------------ | ----------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------- | -| Same-repo pull request | pytest when the change can affect smoke tests (backend, smoke-test or ingestion code; not connector-only changes) | Same condition as the Docker lane's pytest | -| Pull request from a fork | Same condition, full suite in 5 batches | Same condition, full suite in 9 batches on GitHub-hosted runners | -| Push to `master` | Full suite, 5 batches | Full suite, 9 batches | -| Push to `releases/**` | Full suite, 5 batches | Skipped | -| Batch matrix (smart testing off or shadow) | 5 batches full tier, 3 for `p0` | 9 batches full tier, 3 for `p0` | -| Batch matrix (smart testing active) | Planned on `pytest_test_weights.json` | Planned on `pytest_test_weights_docker_free.json` | -| Smart testing PR comment | `Smart test selection` | `Smart test selection (docker-free lane)` | - -This repository sets `PYTEST_P0_SMOKE=true` and `SMART_TESTING_MODE=active`, so a same-repo pull -request runs the `p0` tier with active smart testing: each lane runs the batches its plan sizes -(at most 9), and a pull request that only changes the pytest wiring runs a canary. The fixed -matrices run on pushes to `master`, on pull requests with `run-all-tests` or `run-all-tests:pytest`, -on fork pull requests (repository variables don't reach them) and on dispatch. - -- **Labels:** `run-all-tests` and `run-all-tests:pytest` turn smart testing off for both lanes, so - each runs its fixed matrix. They do not start a lane the change would not start. +- **When it runs:** on every push to `master`, full suite in 9 batches, and on dispatch. It does not + run on pull requests yet: it will, once it has a record of stable runs on `master`. The PR path is + already wired as in the Docker lane: the same `run_pytest` condition, smart testing with batches + planned on `pytest_test_weights_docker_free.json` (at most 9; 3 for the fixed `p0` matrix), and + its own sticky comment, "Smart test selection (docker-free lane)". - **Run a lane alone:** dispatch `docker-free-e2e.yml` (full tier, 9 batches, smart testing off) or `docker-unified.yml` from the Actions tab. - **Results:** each batch uploads `Test Results (docker-free smoke tests) pytests ` and, on failure,