Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5c85220b54 | ||
|
|
e8d2be88d3 | ||
|
|
92ffcd9ca5 |
No files matched your search
@@ -28,28 +28,27 @@
|
||||
# version with content nobody compared, which is the exact failure mode the
|
||||
# `==` specifier was adopted to expose.
|
||||
#
|
||||
# So this workflow asks the index and reports a verdict, and the callers make
|
||||
# their real jobs depend on it. Three outcomes, all of them visible:
|
||||
# So this workflow asks the index and reports a verdict: the job is green only
|
||||
# when the pinned core is on the index, and RED in every other case. There is no
|
||||
# "skip" outcome and no output a caller can read to skip itself (rule ci-13:
|
||||
# nothing counts as passed that did not pass). Outcomes:
|
||||
#
|
||||
# the project is not on the index at all
|
||||
# -> the publish window. This job passes, emits a ::warning:: annotation
|
||||
# on the run page, writes the reason into the run summary, and returns
|
||||
# available=false. Every caller job is then SKIPPED - grey in the
|
||||
# checks list, not green - and the summary says in words that no tests
|
||||
# ran. Nobody can mistake it for a passing build.
|
||||
# -> red. During the publish window (the core is uploaded first, this
|
||||
# package after it) no install here can succeed, so the run says so and
|
||||
# fails; re-run it once the core's publish has finished. The callers
|
||||
# `need` this job, so they do not run, and the `gate` of tests.yml
|
||||
# refuses a skipped job.
|
||||
#
|
||||
# the project is on the index and carries the pinned version
|
||||
# -> available=true. Every caller job runs exactly as it did before this
|
||||
# file existed. Nothing is weakened, ever.
|
||||
# -> green. Every caller job runs exactly as it did before this file
|
||||
# existed. Nothing is weakened, ever.
|
||||
#
|
||||
# the project is on the index but NOT at the pinned version
|
||||
# -> this is not the window. The core has been published, so the pin
|
||||
# names a version that was never uploaded. Hard failure, red.
|
||||
# -> red: the pin names a version that was never uploaded.
|
||||
#
|
||||
# Anything ambiguous (index unreachable, malformed answer, no `==` pin in
|
||||
# pyproject.toml, two of them) is also a hard failure. A gate that answers
|
||||
# "skip" when it does not know would silently disable this repo's whole CI the
|
||||
# first time PyPI has a bad minute.
|
||||
# pyproject.toml, two of them) is also a hard failure.
|
||||
#
|
||||
# This does NOT stop being useful once the core is published: it is the check
|
||||
# that catches a pin pointing at a version that does not exist, about 20s
|
||||
@@ -60,12 +59,6 @@ name: core-on-index
|
||||
on:
|
||||
workflow_call:
|
||||
outputs:
|
||||
available:
|
||||
description: >-
|
||||
"true" when the invisible-core version pinned in pyproject.toml can
|
||||
be resolved from the package index. Any other value means the caller
|
||||
must not attempt an install.
|
||||
value: ${{ jobs.probe.outputs.available }}
|
||||
pin:
|
||||
description: The invisible-core version this repo pins.
|
||||
value: ${{ jobs.probe.outputs.pin }}
|
||||
@@ -79,7 +72,6 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 5
|
||||
outputs:
|
||||
available: ${{ steps.probe.outputs.available }}
|
||||
pin: ${{ steps.probe.outputs.pin }}
|
||||
steps:
|
||||
# SHA-pinned like e2e.yml: this job decides whether the rest of the repo's
|
||||
@@ -167,29 +159,20 @@ jobs:
|
||||
f"verdict, so this job fails instead of guessing. Re-run it.")
|
||||
|
||||
if unpublished:
|
||||
msg = (f"{DIST} has never been published to the index. This is the "
|
||||
f"expected publish window: the core is uploaded first, this "
|
||||
f"repo's package after it.")
|
||||
print(f"::warning title={DIST} is not on the index yet::{msg} "
|
||||
f"NOTHING WAS INSTALLED AND NO TEST RAN in this workflow run.")
|
||||
write("GITHUB_STEP_SUMMARY",
|
||||
f"### NO TESTS RAN\n\n{msg}\n\n"
|
||||
f"Every job in this workflow was **skipped**, not passed. "
|
||||
f"`pyproject.toml` pins `{DIST}=={pin}`; until that version is on "
|
||||
f"the index no `pip install` in this repository can resolve, so "
|
||||
f"there is nothing to run. Publish `{DIST}=={pin}`, then re-run "
|
||||
f"this workflow - the jobs come back on their own, with no edit "
|
||||
f"to any file here.\n")
|
||||
write("GITHUB_OUTPUT", "available=false")
|
||||
sys.exit(0)
|
||||
die(f"FAIL core-on-index: the pinned {DIST} {pin} is not on the index. "
|
||||
f"Fix: wait for its publish to finish, or pin a published core. "
|
||||
f"Rule: ci-13 nothing counts as passed that did not pass")
|
||||
|
||||
versions = data.get("versions")
|
||||
if not versions:
|
||||
die(f"{url} answered but listed no versions. The index API changed shape "
|
||||
f"or served something unexpected; refusing to turn that into a skip.")
|
||||
f"or served something unexpected; refusing to guess.")
|
||||
if pin not in versions:
|
||||
shown = sorted(versions)[-10:] # diagnostics only, so a plain sort
|
||||
die(f"pyproject.toml pins {DIST}=={pin}, but the index publishes "
|
||||
die(f"FAIL core-on-index: the pinned {DIST} {pin} is not on the index. "
|
||||
f"Fix: wait for its publish to finish, or pin a published core. "
|
||||
f"Rule: ci-13 nothing counts as passed that did not pass. "
|
||||
f"Detail: pyproject.toml pins {DIST}=={pin}, but the index publishes "
|
||||
f"{len(versions)} version(s) ({', '.join(shown)}) and not {pin}. "
|
||||
f"{DIST} exists, so this is NOT the "
|
||||
f"publish window - the pin names a version that was never uploaded. "
|
||||
@@ -197,11 +180,9 @@ jobs:
|
||||
f"the core first.")
|
||||
|
||||
print(f"{DIST}=={pin} is on the index - the workflow runs normally.")
|
||||
write("GITHUB_OUTPUT", "available=true")
|
||||
PY
|
||||
|
||||
- name: Say so in the run summary
|
||||
if: steps.probe.outputs.available == 'true'
|
||||
run: |
|
||||
echo "invisible-core==${{ steps.probe.outputs.pin }} is on the index; jobs run normally." \
|
||||
>> "$GITHUB_STEP_SUMMARY"
|
||||
+135
-78
@@ -1,6 +1,9 @@
|
||||
# ─────────────────────────────────────────────────────────────────────────────
|
||||
# e2e.yml - run the FULL browser-driving e2e suite (the 127 @pytest.mark.e2e)
|
||||
# on GitHub, on every push/PR to main.
|
||||
# on GitHub, in the merge queue run of every change to main and on every push to main.
|
||||
# A pull request runs the fast set (tests.yml); this workflow is too heavy for every push to a
|
||||
# pull request, so it runs when the change enters the merge queue (`merge_group`), and that run
|
||||
# decides: its ONE verdict is the job `e2e verdict`.
|
||||
#
|
||||
# Why this can run on CI when the drive-gate had to stay light: the drive-gate
|
||||
# launched Firefox in true HEADLESS mode, which is content-process unstable on
|
||||
@@ -22,16 +25,9 @@ on:
|
||||
- '**.md'
|
||||
- 'docs/**'
|
||||
- 'LICENSE'
|
||||
pull_request:
|
||||
branches: [main]
|
||||
# The same filter as `push` above, which had it and this one did not. A
|
||||
# docs-only PR (#54, deleting the Pages site) therefore spun up the full
|
||||
# browser bench, hung, and burned the whole 40-minute timeout on a change no
|
||||
# test can observe. The filter belongs on BOTH triggers or it is not a filter.
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
- 'docs/**'
|
||||
- 'LICENSE'
|
||||
# The merge queue run. GitHub applies no `paths` or `paths-ignore` to it, so a docs-only change runs the whole set here too.
|
||||
merge_group:
|
||||
types: [checks_requested]
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
only:
|
||||
@@ -46,22 +42,20 @@ on:
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
# A newer push to a pull request cancels the older in-flight run of THIS
|
||||
# workflow on that pull request as a whole, cleanly, instead of leaving its
|
||||
# queued jobs to be cancelled one by one - which left the run marked failed even
|
||||
# though nothing had actually failed. Keyed by workflow + pull request number,
|
||||
# so tests and e2e never cancel each other.
|
||||
# Nothing cancels this workflow: a merge queue run is keyed by its own ref
|
||||
# (one per queue entry, `gh-readonly-queue/...`) and never cancelled in
|
||||
# progress, and the run of a push is unique to the run (`github.run_id`).
|
||||
#
|
||||
# NEVER on main. The release gate (scripts/e2e_is_green.py) asks for the e2e
|
||||
# check-run of the commit being tagged, and a cancelled one refuses the release:
|
||||
# with the group keyed by ref, the next push to main cancelled the run of the
|
||||
# commit before it. Outside a pull request the group is unique to the run
|
||||
# commit before it. Outside the merge queue the group is unique to the run
|
||||
# (`github.run_id`), so every commit of main keeps its own finished run, and a
|
||||
# pending run is not replaced by a newer one either (a group with a fixed name
|
||||
# drops the older pending run, cancel or not).
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.pull_request.number) || github.run_id }}
|
||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
||||
group: ${{ github.workflow }}-${{ github.event_name == 'merge_group' && github.ref || github.run_id }}
|
||||
cancel-in-progress: false
|
||||
|
||||
# Engine and GeoIP downloads go through the release API with this token.
|
||||
# Anonymous requests share a 60-an-hour limit per runner address and are the
|
||||
@@ -72,12 +66,46 @@ env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
|
||||
jobs:
|
||||
# THE FIRST JOB: does this change have anything for the workflow to test? GitHub applies no `paths` filter to a merge queue run, so a docs-only change would
|
||||
# run everything here. In a queue run scripts/ci_changes.py lists the files of the entry (base_sha..head_sha) and applies the path rules of the `push` trigger
|
||||
# above; on any other event it says run=true. `run=false` is an explicit "nothing to test", not a skip: every other job needs this one and runs only on
|
||||
# run == 'true', and `e2e verdict` (scripts/ci_gate.py, CHANGES_RUN) expects them all skipped then, and red otherwise. The script is read from main, never
|
||||
# from the branch it judges (a branch must not decide that it needs no test); while it is not on main yet the copy of this branch is used, and the log says so.
|
||||
changes:
|
||||
name: changes
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 5
|
||||
outputs:
|
||||
run: ${{ steps.changes.outputs.run }}
|
||||
files: ${{ steps.changes.outputs.files }}
|
||||
steps:
|
||||
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
||||
with: { fetch-depth: 1 }
|
||||
- name: does the change touch anything this workflow tests
|
||||
id: changes
|
||||
shell: bash
|
||||
env:
|
||||
EVENT_NAME: ${{ github.event_name }}
|
||||
BASE_SHA: ${{ github.event.merge_group.base_sha }}
|
||||
HEAD_SHA: ${{ github.event.merge_group.head_sha }}
|
||||
run: |
|
||||
git fetch --no-tags --depth=1 origin +refs/heads/main:refs/remotes/origin/main
|
||||
if git cat-file -e origin/main:scripts/ci_changes.py 2>/dev/null; then
|
||||
git show origin/main:scripts/ci_changes.py > "$RUNNER_TEMP/ci_changes.py"
|
||||
else
|
||||
echo "ci_changes.py is not on origin/main yet: falling back to the copy of this branch"
|
||||
cp scripts/ci_changes.py "$RUNNER_TEMP/ci_changes.py"
|
||||
fi
|
||||
python3 "$RUNNER_TEMP/ci_changes.py" e2e "$EVENT_NAME" "$BASE_SHA" "$HEAD_SHA" | tee -a "$GITHUB_OUTPUT"
|
||||
|
||||
# The install below resolves `invisible-core==N.M.0` from the package index,
|
||||
# and the core is published BEFORE this package. This gate answers whether it
|
||||
# is on the index yet; during that window the e2e job is SKIPPED with the
|
||||
# reason in the run summary rather than faked green, and once the core is up
|
||||
# it runs unchanged. See .github/workflows/core-on-index.yml.
|
||||
# is on the index yet; during that window this job FAILS (rule ci-13: a core
|
||||
# that is not on the index is red, never a skip) and the e2e jobs, which
|
||||
# need it, do not run; once the core is up it runs unchanged. See .github/workflows/core-on-index.yml.
|
||||
core-on-index:
|
||||
needs: changes
|
||||
if: needs.changes.outputs.run == 'true'
|
||||
uses: ./.github/workflows/core-on-index.yml
|
||||
|
||||
# THE UBUNTU PACKAGES OF THE LINUX JOBS, from Ubuntu's archive once per runner image and list (linux-deps.yml), never by a job: a run lost a green leg to its time
|
||||
@@ -86,8 +114,8 @@ jobs:
|
||||
# Playwright's install-deps names for Firefox. The jobs install its roots by name from that repository, with --no-download.
|
||||
linux-deps-e2e:
|
||||
name: linux-deps-e2e
|
||||
needs: core-on-index
|
||||
if: needs.core-on-index.outputs.available == 'true' && inputs.only != 'windows-control-a'
|
||||
needs: [changes, core-on-index]
|
||||
if: needs.changes.outputs.run == 'true' && inputs.only != 'windows-control-a'
|
||||
uses: ./.github/workflows/linux-deps.yml
|
||||
with:
|
||||
name: e2e
|
||||
@@ -103,8 +131,8 @@ jobs:
|
||||
# branch protection read.
|
||||
e2e-linux:
|
||||
name: e2e (linux, part ${{ matrix.part }})
|
||||
needs: [core-on-index, linux-deps-e2e]
|
||||
if: needs.core-on-index.outputs.available == 'true' && inputs.only != 'windows-control-a'
|
||||
needs: [changes, core-on-index, linux-deps-e2e]
|
||||
if: needs.changes.outputs.run == 'true' && inputs.only != 'windows-control-a'
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 40
|
||||
strategy:
|
||||
@@ -116,14 +144,14 @@ jobs:
|
||||
with: { fetch-depth: 1 }
|
||||
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
|
||||
with: { python-version: '3.11' }
|
||||
# The A/A of the three A/B oracles (page, network, host) runs on the first seeds of the candidate set on a pull request, and on ALL of them when the pull request
|
||||
# changes a file of that oracle (scripts/ci_ab_pr_seeds.py holds the lists). The checkout is shallow, so the script fetches the base commit and lists the files that
|
||||
# differ from it (`git diff --name-only <base> HEAD`: HEAD is the merge commit, so this is the pull request's own change); the tests read the variables it prints.
|
||||
# The A/A of the three A/B oracles (page, network, host) runs on the first seeds of the candidate set in the merge queue run, and on ALL of them when the change
|
||||
# touches a file of that oracle (scripts/ci_ab_pr_seeds.py holds the lists). The checkout is shallow, so the script fetches the base commit of the queue entry and lists the files that
|
||||
# differ from it (`git diff --name-only <base> HEAD`: HEAD is the merge group commit, so this is the change of the entry); the tests read the variables it prints.
|
||||
- name: How many seeds the A/A of each oracle visits (all of them when the pull request touches the oracle)
|
||||
if: github.event_name == 'pull_request'
|
||||
if: github.event_name == 'merge_group'
|
||||
shell: bash
|
||||
env:
|
||||
BASE_SHA: ${{ github.event.pull_request.base.sha }}
|
||||
BASE_SHA: ${{ github.event.merge_group.base_sha }}
|
||||
run: python scripts/ci_ab_pr_seeds.py "$BASE_SHA" >> "$GITHUB_ENV"
|
||||
- name: Install wrapper + test deps (+ Playwright ONLY as a system tool)
|
||||
run: |
|
||||
@@ -368,13 +396,12 @@ jobs:
|
||||
# it is green only when every part is green. `needs.e2e-linux.result` is the result of the matrix as a whole (`success` only when every part succeeded;
|
||||
# one failed, cancelled or skipped part makes it something else), and anything but `success` is red here: a cancelled part measured nothing, a skipped
|
||||
# one ran nothing. `always()` so that a red or cancelled part still reaches this job and turns it red instead of skipping it, which reads as not red.
|
||||
# The gate of the core on the index stays the same as for the parts: while the pinned core is not on the index the parts are skipped with the reason in
|
||||
# the summary (core-on-index.yml), and so is this job, as the Linux job was before the split.
|
||||
# The gate of the core on the index stays the same as for the parts: while the pinned core is not on the index core-on-index is red and the parts are skipped, so this job (always()) sees their result `skipped` and fails (rule ci-13).
|
||||
# tests/test_ci_runs_once_per_commit.py (5.) holds this job.
|
||||
e2e:
|
||||
name: e2e (linux, xvfb)
|
||||
needs: [core-on-index, e2e-linux]
|
||||
if: always() && needs.core-on-index.outputs.available == 'true' && inputs.only != 'windows-control-a'
|
||||
needs: [changes, core-on-index, e2e-linux]
|
||||
if: always() && needs.changes.outputs.run == 'true' && inputs.only != 'windows-control-a'
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 5
|
||||
steps:
|
||||
@@ -391,12 +418,11 @@ jobs:
|
||||
# ``Control+A`` selects all in a field, on the PUBLISHED engine and the core this package pins, on Windows, where the keyboard of a real
|
||||
# user is: the shortcut letter used to reach the browser as Control+Shift+A (invisible-core 63.66.0 fixes it). The e2e is red on the
|
||||
# keyboard that held Shift for the capital A (tests/test_control_a_selects_all_in_a_field_e2e.py: 5 ways to press it x an <input> and a
|
||||
# <textarea>, in-process and served to the stock Playwright client). Same gate as the Linux job: it is SKIPPED, with the reason in the
|
||||
# summary, until the core is on the index, and it runs unchanged after; `workflow_dispatch` with `only: windows-control-a` runs it alone.
|
||||
# <textarea>, in-process and served to the stock Playwright client). Same gate as the Linux job: it needs core-on-index, which fails until the core is on the index, and it runs unchanged after; `workflow_dispatch` with `only: windows-control-a` runs it alone.
|
||||
e2e-windows-control-a:
|
||||
name: e2e (windows, Control+A)
|
||||
needs: core-on-index
|
||||
if: needs.core-on-index.outputs.available == 'true'
|
||||
needs: [changes, core-on-index]
|
||||
if: needs.changes.outputs.run == 'true'
|
||||
runs-on: windows-latest
|
||||
timeout-minutes: 20
|
||||
# TEMP and TMP on D:\a\_temp (the runner's temp folder): the Firefox profiles land in TEMP and on C: they saturate the disk (queue up to 144,
|
||||
@@ -438,8 +464,8 @@ jobs:
|
||||
# partition whole and tests/test_every_suite_runs_on_linux_and_windows.py holds both systems together.
|
||||
e2e-windows:
|
||||
name: e2e (windows, part ${{ matrix.part }})
|
||||
needs: core-on-index
|
||||
if: needs.core-on-index.outputs.available == 'true' && inputs.only != 'windows-control-a'
|
||||
needs: [changes, core-on-index]
|
||||
if: needs.changes.outputs.run == 'true' && inputs.only != 'windows-control-a'
|
||||
runs-on: windows-2022
|
||||
timeout-minutes: 40
|
||||
# TEMP and TMP on D:\a\_temp (the runner's temp folder): the Firefox profiles land in TEMP and on C: they saturate the disk (queue up to 144,
|
||||
@@ -459,14 +485,14 @@ jobs:
|
||||
with: { fetch-depth: 1 }
|
||||
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
|
||||
with: { python-version: '3.11' }
|
||||
# The A/A of the three A/B oracles (page, network, host) runs on the first seeds of the candidate set on a pull request, and on ALL of them when the pull request
|
||||
# changes a file of that oracle (scripts/ci_ab_pr_seeds.py holds the lists). The checkout is shallow, so the script fetches the base commit and lists the files that
|
||||
# differ from it (`git diff --name-only <base> HEAD`: HEAD is the merge commit, so this is the pull request's own change); the tests read the variables it prints.
|
||||
# The A/A of the three A/B oracles (page, network, host) runs on the first seeds of the candidate set in the merge queue run, and on ALL of them when the change
|
||||
# touches a file of that oracle (scripts/ci_ab_pr_seeds.py holds the lists). The checkout is shallow, so the script fetches the base commit of the queue entry and lists the files that
|
||||
# differ from it (`git diff --name-only <base> HEAD`: HEAD is the merge group commit, so this is the change of the entry); the tests read the variables it prints.
|
||||
- name: How many seeds the A/A of each oracle visits (all of them when the pull request touches the oracle)
|
||||
if: github.event_name == 'pull_request'
|
||||
if: github.event_name == 'merge_group'
|
||||
shell: bash
|
||||
env:
|
||||
BASE_SHA: ${{ github.event.pull_request.base.sha }}
|
||||
BASE_SHA: ${{ github.event.merge_group.base_sha }}
|
||||
run: python scripts/ci_ab_pr_seeds.py "$BASE_SHA" >> "$GITHUB_ENV"
|
||||
- name: Install wrapper + test deps (+ Playwright ONLY as a system tool)
|
||||
run: |
|
||||
@@ -538,8 +564,8 @@ jobs:
|
||||
# above, `own_job` in the Windows parts). The same setup as the shared jobs: the security state, the engine, the GeoIP database made by the repository.
|
||||
e2e-network:
|
||||
name: e2e (network, linux)
|
||||
needs: [core-on-index, linux-deps-e2e]
|
||||
if: needs.core-on-index.outputs.available == 'true' && inputs.only != 'windows-control-a'
|
||||
needs: [changes, core-on-index, linux-deps-e2e]
|
||||
if: needs.changes.outputs.run == 'true' && inputs.only != 'windows-control-a'
|
||||
runs-on: ubuntu-24.04
|
||||
# the network oracle's own guard (2197 s, two engine runs: the measured runs 45121964904 and 45153612447 plus 25%) and the job's own steps, with room for a slow runner
|
||||
timeout-minutes: 50
|
||||
@@ -549,10 +575,10 @@ jobs:
|
||||
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
|
||||
with: { python-version: '3.11' }
|
||||
- name: How many seeds the A/A of each oracle visits (all of them when the pull request touches the oracle)
|
||||
if: github.event_name == 'pull_request'
|
||||
if: github.event_name == 'merge_group'
|
||||
shell: bash
|
||||
env:
|
||||
BASE_SHA: ${{ github.event.pull_request.base.sha }}
|
||||
BASE_SHA: ${{ github.event.merge_group.base_sha }}
|
||||
run: python scripts/ci_ab_pr_seeds.py "$BASE_SHA" >> "$GITHUB_ENV"
|
||||
- name: Install wrapper + test deps (+ Playwright ONLY as a system tool)
|
||||
run: |
|
||||
@@ -629,8 +655,8 @@ jobs:
|
||||
|
||||
e2e-network-windows:
|
||||
name: e2e (network, windows)
|
||||
needs: core-on-index
|
||||
if: needs.core-on-index.outputs.available == 'true' && inputs.only != 'windows-control-a'
|
||||
needs: [changes, core-on-index]
|
||||
if: needs.changes.outputs.run == 'true' && inputs.only != 'windows-control-a'
|
||||
runs-on: windows-2022
|
||||
# the network oracle's own guard (2197 s, two engine runs: the measured runs 45121964904 and 45153612447 plus 25%) and the job's own steps, with room for a slow runner
|
||||
timeout-minutes: 50
|
||||
@@ -643,10 +669,10 @@ jobs:
|
||||
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
|
||||
with: { python-version: '3.11' }
|
||||
- name: How many seeds the A/A of each oracle visits (all of them when the pull request touches the oracle)
|
||||
if: github.event_name == 'pull_request'
|
||||
if: github.event_name == 'merge_group'
|
||||
shell: bash
|
||||
env:
|
||||
BASE_SHA: ${{ github.event.pull_request.base.sha }}
|
||||
BASE_SHA: ${{ github.event.merge_group.base_sha }}
|
||||
run: python scripts/ci_ab_pr_seeds.py "$BASE_SHA" >> "$GITHUB_ENV"
|
||||
- name: Install wrapper + test deps (+ Playwright ONLY as a system tool)
|
||||
run: |
|
||||
@@ -702,8 +728,8 @@ jobs:
|
||||
# 35 for the test.
|
||||
e2e-host:
|
||||
name: e2e (host, linux)
|
||||
needs: [core-on-index, linux-deps-e2e]
|
||||
if: needs.core-on-index.outputs.available == 'true' && inputs.only != 'windows-control-a'
|
||||
needs: [changes, core-on-index, linux-deps-e2e]
|
||||
if: needs.changes.outputs.run == 'true' && inputs.only != 'windows-control-a'
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 65
|
||||
steps:
|
||||
@@ -712,10 +738,10 @@ jobs:
|
||||
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
|
||||
with: { python-version: '3.11' }
|
||||
- name: How many seeds the A/A of each oracle visits (all of them when the pull request touches the oracle)
|
||||
if: github.event_name == 'pull_request'
|
||||
if: github.event_name == 'merge_group'
|
||||
shell: bash
|
||||
env:
|
||||
BASE_SHA: ${{ github.event.pull_request.base.sha }}
|
||||
BASE_SHA: ${{ github.event.merge_group.base_sha }}
|
||||
run: python scripts/ci_ab_pr_seeds.py "$BASE_SHA" >> "$GITHUB_ENV"
|
||||
- name: Install wrapper + test deps (+ Playwright ONLY as a system tool)
|
||||
run: |
|
||||
@@ -812,8 +838,8 @@ jobs:
|
||||
|
||||
e2e-host-windows:
|
||||
name: e2e (host, windows)
|
||||
needs: core-on-index
|
||||
if: needs.core-on-index.outputs.available == 'true' && inputs.only != 'windows-control-a'
|
||||
needs: [changes, core-on-index]
|
||||
if: needs.changes.outputs.run == 'true' && inputs.only != 'windows-control-a'
|
||||
runs-on: windows-2022
|
||||
timeout-minutes: 45
|
||||
defaults:
|
||||
@@ -825,10 +851,10 @@ jobs:
|
||||
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
|
||||
with: { python-version: '3.11' }
|
||||
- name: How many seeds the A/A of each oracle visits (all of them when the pull request touches the oracle)
|
||||
if: github.event_name == 'pull_request'
|
||||
if: github.event_name == 'merge_group'
|
||||
shell: bash
|
||||
env:
|
||||
BASE_SHA: ${{ github.event.pull_request.base.sha }}
|
||||
BASE_SHA: ${{ github.event.merge_group.base_sha }}
|
||||
run: python scripts/ci_ab_pr_seeds.py "$BASE_SHA" >> "$GITHUB_ENV"
|
||||
- name: Install wrapper + test deps (+ Playwright ONLY as a system tool)
|
||||
run: |
|
||||
@@ -951,8 +977,8 @@ jobs:
|
||||
# `own_job` in the Windows parts). 45 minutes for the job, as the host oracle's: the setup of the job plus the guard of the test with the margin of Windows. The same setup as the shared jobs.
|
||||
e2e-page:
|
||||
name: e2e (page oracle, linux)
|
||||
needs: [core-on-index, linux-deps-e2e]
|
||||
if: needs.core-on-index.outputs.available == 'true' && inputs.only != 'windows-control-a'
|
||||
needs: [changes, core-on-index, linux-deps-e2e]
|
||||
if: needs.changes.outputs.run == 'true' && inputs.only != 'windows-control-a'
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 45
|
||||
steps:
|
||||
@@ -961,10 +987,10 @@ jobs:
|
||||
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
|
||||
with: { python-version: '3.11' }
|
||||
- name: How many seeds the A/A of each oracle visits (all of them when the pull request touches the oracle)
|
||||
if: github.event_name == 'pull_request'
|
||||
if: github.event_name == 'merge_group'
|
||||
shell: bash
|
||||
env:
|
||||
BASE_SHA: ${{ github.event.pull_request.base.sha }}
|
||||
BASE_SHA: ${{ github.event.merge_group.base_sha }}
|
||||
run: python scripts/ci_ab_pr_seeds.py "$BASE_SHA" >> "$GITHUB_ENV"
|
||||
- name: Install wrapper + test deps (+ Playwright ONLY as a system tool)
|
||||
run: |
|
||||
@@ -1041,8 +1067,8 @@ jobs:
|
||||
|
||||
e2e-page-windows:
|
||||
name: e2e (page oracle, windows)
|
||||
needs: core-on-index
|
||||
if: needs.core-on-index.outputs.available == 'true' && inputs.only != 'windows-control-a'
|
||||
needs: [changes, core-on-index]
|
||||
if: needs.changes.outputs.run == 'true' && inputs.only != 'windows-control-a'
|
||||
runs-on: windows-2022
|
||||
timeout-minutes: 45
|
||||
defaults:
|
||||
@@ -1054,10 +1080,10 @@ jobs:
|
||||
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
|
||||
with: { python-version: '3.11' }
|
||||
- name: How many seeds the A/A of each oracle visits (all of them when the pull request touches the oracle)
|
||||
if: github.event_name == 'pull_request'
|
||||
if: github.event_name == 'merge_group'
|
||||
shell: bash
|
||||
env:
|
||||
BASE_SHA: ${{ github.event.pull_request.base.sha }}
|
||||
BASE_SHA: ${{ github.event.merge_group.base_sha }}
|
||||
run: python scripts/ci_ab_pr_seeds.py "$BASE_SHA" >> "$GITHUB_ENV"
|
||||
- name: Install wrapper + test deps (+ Playwright ONLY as a system tool)
|
||||
run: |
|
||||
@@ -1120,8 +1146,8 @@ jobs:
|
||||
# Seed 0 is in shard 1, and its second launch on a reused profile is part of that shard's A/A.
|
||||
e2e-page-final-touched:
|
||||
name: e2e (page oracle, is it touched)
|
||||
needs: core-on-index
|
||||
if: github.event_name == 'pull_request' && needs.core-on-index.outputs.available == 'true' && inputs.only != 'windows-control-a'
|
||||
needs: [changes, core-on-index]
|
||||
if: needs.changes.outputs.run == 'true' && github.event_name == 'merge_group' && inputs.only != 'windows-control-a'
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 5
|
||||
outputs:
|
||||
@@ -1131,17 +1157,17 @@ jobs:
|
||||
with: { fetch-depth: 1 }
|
||||
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
|
||||
with: { python-version: '3.11' }
|
||||
- name: Does the pull request change a file of the page oracle
|
||||
- name: Does the change touch a file of the page oracle
|
||||
id: touched
|
||||
shell: bash
|
||||
env:
|
||||
BASE_SHA: ${{ github.event.pull_request.base.sha }}
|
||||
BASE_SHA: ${{ github.event.merge_group.base_sha }}
|
||||
run: python scripts/ci_ab_oracle.py touched "$BASE_SHA" | tee -a "$GITHUB_OUTPUT"
|
||||
|
||||
e2e-page-final:
|
||||
name: e2e (page oracle, final seeds ${{ matrix.shard }}/4, linux)
|
||||
needs: [core-on-index, e2e-page-final-touched, linux-deps-e2e]
|
||||
if: needs.core-on-index.outputs.available == 'true' && needs.e2e-page-final-touched.outputs.touched == 'true'
|
||||
needs: [changes, core-on-index, e2e-page-final-touched, linux-deps-e2e]
|
||||
if: needs.changes.outputs.run == 'true' && needs.e2e-page-final-touched.outputs.touched == 'true'
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 40
|
||||
strategy:
|
||||
@@ -1230,8 +1256,8 @@ jobs:
|
||||
|
||||
e2e-page-final-windows:
|
||||
name: e2e (page oracle, final seeds ${{ matrix.shard }}/4, windows)
|
||||
needs: [core-on-index, e2e-page-final-touched]
|
||||
if: needs.core-on-index.outputs.available == 'true' && needs.e2e-page-final-touched.outputs.touched == 'true'
|
||||
needs: [changes, core-on-index, e2e-page-final-touched]
|
||||
if: needs.changes.outputs.run == 'true' && needs.e2e-page-final-touched.outputs.touched == 'true'
|
||||
runs-on: windows-2022
|
||||
timeout-minutes: 40
|
||||
strategy:
|
||||
@@ -1294,3 +1320,34 @@ jobs:
|
||||
${{ runner.temp }}/page-final-e2e.xml
|
||||
if-no-files-found: ignore
|
||||
retention-days: 14
|
||||
|
||||
# THE VERDICT of the workflow, the only one that decides (rule ci-13, nothing counts as passed that did not pass). It waits for EVERY job of this file, and
|
||||
# `if: always()` makes sure a failed, cancelled or skipped one still reaches it. Each must end in `success`; only the jobs scripts/ci_gate.py names as
|
||||
# conditional by design may be `skipped` (the final-seed shards when the page oracle is not touched, and what `only: windows-control-a` leaves out).
|
||||
# The judge is read from main, never from the branch it judges; while the file is not on main yet (the change that adds it) the copy of this branch is
|
||||
# used, and the log says so. `e2e (linux, xvfb)` above stays the Linux check the release reads (scripts/e2e_is_green.py).
|
||||
verdict:
|
||||
name: e2e verdict
|
||||
needs: [changes, core-on-index, linux-deps-e2e, e2e-linux, e2e, e2e-windows-control-a, e2e-windows, e2e-network, e2e-network-windows, e2e-host, e2e-host-windows, e2e-page, e2e-page-windows, e2e-page-final-touched, e2e-page-final, e2e-page-final-windows]
|
||||
if: always()
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 5
|
||||
steps:
|
||||
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
||||
with: { fetch-depth: 1 }
|
||||
- name: refuse unless every needed job succeeded
|
||||
env:
|
||||
NEEDS: ${{ toJSON(needs) }}
|
||||
EVENT_NAME: ${{ github.event_name }}
|
||||
WORKFLOW: e2e
|
||||
CHANGES_RUN: ${{ needs.changes.outputs.run }}
|
||||
INPUT_ONLY: ${{ inputs.only }}
|
||||
run: |
|
||||
git fetch --no-tags --depth=1 origin +refs/heads/main:refs/remotes/origin/main
|
||||
if git cat-file -e origin/main:scripts/ci_gate.py 2>/dev/null; then
|
||||
git show origin/main:scripts/ci_gate.py > "$RUNNER_TEMP/ci_gate.py"
|
||||
else
|
||||
echo "ci_gate.py is not on origin/main yet: falling back to the copy of this branch"
|
||||
cp scripts/ci_gate.py "$RUNNER_TEMP/ci_gate.py"
|
||||
fi
|
||||
python3 "$RUNNER_TEMP/ci_gate.py"
|
||||
@@ -11,9 +11,10 @@
|
||||
# WHICH ENGINE. The published one (`python -m invisible_playwright fetch`), as e2e.yml. The candidate of the engine repository runs the same entry on its own
|
||||
# binary (scripts/run_fakeweb.py --binary), and judges the four e2e tests of this fake web as the suite `wrapper.e2e.fakeweb` of ci/required-suites.json.
|
||||
#
|
||||
# WHEN. A pull request or a push to main that touches the fake web or this file (the journey and the hard pages are not a round for every change); again by hand
|
||||
# with `workflow_dispatch`. Four legs, a profile on a system each (Linux under Xvfb, Windows); no leg is repeated or forgiven, and the ONE verdict of the workflow is the
|
||||
# job `fakeweb verdict`: red unless all four legs are green (a skipped leg, for a core that is not on the index yet, is not green: nothing was measured).
|
||||
# WHEN. The merge queue run of every change to main (`merge_group`: GitHub applies no `paths` filter to it, so every queue entry runs it, and that run decides), and a
|
||||
# push to main that touches the fake web or this file; again by hand with `workflow_dispatch`. A pull request does not run it: a pull request runs the fast set
|
||||
# (tests.yml). Four legs, a profile on a system each (Linux under Xvfb, Windows); no leg is repeated or forgiven, and the ONE verdict of the workflow is the
|
||||
# job `fakeweb verdict`: red unless every job of the workflow is green (a skipped leg, for a core that is not on the index yet, is not green: nothing was measured).
|
||||
|
||||
name: fakeweb
|
||||
|
||||
@@ -27,37 +28,66 @@ on:
|
||||
- 'scripts/fakeweb_p4_report.py'
|
||||
- 'scripts/playwright_pin.txt'
|
||||
- '.github/workflows/fakeweb.yml'
|
||||
pull_request:
|
||||
paths:
|
||||
- 'tests/fakeweb/**'
|
||||
- 'tests/test_fakeweb_*.py'
|
||||
- 'scripts/run_fakeweb.py'
|
||||
- 'scripts/fakeweb_p4_report.py'
|
||||
- 'scripts/playwright_pin.txt'
|
||||
- '.github/workflows/fakeweb.yml'
|
||||
merge_group:
|
||||
types: [checks_requested]
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
# A newer push to a pull request cancels the older run of THIS workflow on that pull request, and nothing else cancels (the same group as e2e.yml).
|
||||
# Nothing cancels this workflow (the same group as e2e.yml): a merge queue run is keyed by its own ref (one per queue entry) and never cancelled in progress,
|
||||
# and the run of a push is unique to the run.
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.pull_request.number) || github.run_id }}
|
||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
||||
group: ${{ github.workflow }}-${{ github.event_name == 'merge_group' && github.ref || github.run_id }}
|
||||
cancel-in-progress: false
|
||||
|
||||
# The engine download goes through the release API with the token of the job (anonymous requests are the ones GitHub drops first).
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ github.token }}
|
||||
|
||||
jobs:
|
||||
# THE FIRST JOB: does this change have anything for the workflow to test? GitHub applies no `paths` filter to a merge queue run, so a docs-only change would
|
||||
# run everything here. In a queue run scripts/ci_changes.py lists the files of the entry (base_sha..head_sha) and applies the path rules of the `push` trigger
|
||||
# above; on any other event it says run=true. `run=false` is an explicit "nothing to test", not a skip: every other job needs this one and runs only on
|
||||
# run == 'true', and `fakeweb verdict` (scripts/ci_gate.py, CHANGES_RUN) expects them all skipped then, and red otherwise. The script is read from main, never
|
||||
# from the branch it judges (a branch must not decide that it needs no test); while it is not on main yet the copy of this branch is used, and the log says so.
|
||||
changes:
|
||||
name: changes
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 5
|
||||
outputs:
|
||||
run: ${{ steps.changes.outputs.run }}
|
||||
files: ${{ steps.changes.outputs.files }}
|
||||
steps:
|
||||
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
||||
with: { fetch-depth: 1 }
|
||||
- name: does the change touch anything this workflow tests
|
||||
id: changes
|
||||
shell: bash
|
||||
env:
|
||||
EVENT_NAME: ${{ github.event_name }}
|
||||
BASE_SHA: ${{ github.event.merge_group.base_sha }}
|
||||
HEAD_SHA: ${{ github.event.merge_group.head_sha }}
|
||||
run: |
|
||||
git fetch --no-tags --depth=1 origin +refs/heads/main:refs/remotes/origin/main
|
||||
if git cat-file -e origin/main:scripts/ci_changes.py 2>/dev/null; then
|
||||
git show origin/main:scripts/ci_changes.py > "$RUNNER_TEMP/ci_changes.py"
|
||||
else
|
||||
echo "ci_changes.py is not on origin/main yet: falling back to the copy of this branch"
|
||||
cp scripts/ci_changes.py "$RUNNER_TEMP/ci_changes.py"
|
||||
fi
|
||||
python3 "$RUNNER_TEMP/ci_changes.py" fakeweb "$EVENT_NAME" "$BASE_SHA" "$HEAD_SHA" | tee -a "$GITHUB_OUTPUT"
|
||||
|
||||
core-on-index:
|
||||
needs: changes
|
||||
if: needs.changes.outputs.run == 'true'
|
||||
uses: ./.github/workflows/core-on-index.yml
|
||||
|
||||
# The Ubuntu packages of the Linux legs, from Ubuntu's archive once per runner image and list (linux-deps.yml), never by a leg.
|
||||
linux-deps-fakeweb:
|
||||
name: linux-deps-fakeweb
|
||||
needs: core-on-index
|
||||
if: needs.core-on-index.outputs.available == 'true'
|
||||
needs: [changes, core-on-index]
|
||||
if: needs.changes.outputs.run == 'true'
|
||||
uses: ./.github/workflows/linux-deps.yml
|
||||
with:
|
||||
name: fakeweb
|
||||
@@ -66,8 +96,8 @@ jobs:
|
||||
|
||||
walk:
|
||||
name: fakeweb ${{ matrix.profile }} (${{ matrix.os }})
|
||||
needs: [core-on-index, linux-deps-fakeweb]
|
||||
if: needs.core-on-index.outputs.available == 'true'
|
||||
needs: [changes, core-on-index, linux-deps-fakeweb]
|
||||
if: needs.changes.outputs.run == 'true'
|
||||
runs-on: ${{ matrix.runner }}
|
||||
timeout-minutes: 30
|
||||
strategy:
|
||||
@@ -175,19 +205,29 @@ jobs:
|
||||
if-no-files-found: warn
|
||||
retention-days: 14
|
||||
|
||||
# THE VERDICT of the workflow, the only one: green only when all four legs ran and passed.
|
||||
# THE VERDICT of the workflow, the only one that decides (rule ci-13): it waits for EVERY job of this file, `if: always()` so that a failed, cancelled or skipped
|
||||
# one still reaches it, and each must end in `success` (a leg that did not run measured nothing). scripts/ci_gate.py judges it, read from main and never from
|
||||
# the branch it judges; while the file is not on main yet (the change that adds it) the copy of this branch is used, and the log says so.
|
||||
verdict:
|
||||
name: fakeweb verdict
|
||||
needs: [core-on-index, walk]
|
||||
needs: [changes, core-on-index, linux-deps-fakeweb, walk]
|
||||
if: always()
|
||||
runs-on: ubuntu-24.04
|
||||
steps:
|
||||
- name: red unless every leg is green
|
||||
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
||||
with: { fetch-depth: 1 }
|
||||
- name: refuse unless every needed job succeeded
|
||||
env:
|
||||
NEEDS: ${{ toJSON(needs) }}
|
||||
EVENT_NAME: ${{ github.event_name }}
|
||||
WORKFLOW: fakeweb
|
||||
CHANGES_RUN: ${{ needs.changes.outputs.run }}
|
||||
run: |
|
||||
echo "core-on-index: ${{ needs.core-on-index.result }}"
|
||||
echo "walk (p2 and p4, linux and windows): ${{ needs.walk.result }}"
|
||||
if [ "${{ needs.walk.result }}" != "success" ]; then
|
||||
echo "RED: the four legs did not all pass (a leg that did not run measured nothing)"
|
||||
exit 1
|
||||
git fetch --no-tags --depth=1 origin +refs/heads/main:refs/remotes/origin/main
|
||||
if git cat-file -e origin/main:scripts/ci_gate.py 2>/dev/null; then
|
||||
git show origin/main:scripts/ci_gate.py > "$RUNNER_TEMP/ci_gate.py"
|
||||
else
|
||||
echo "ci_gate.py is not on origin/main yet: falling back to the copy of this branch"
|
||||
cp scripts/ci_gate.py "$RUNNER_TEMP/ci_gate.py"
|
||||
fi
|
||||
echo "green: ours equals stock on the fake web, on both systems"
|
||||
python3 "$RUNNER_TEMP/ci_gate.py"
|
||||
@@ -39,16 +39,15 @@ env:
|
||||
jobs:
|
||||
# `pip install .` below resolves `invisible-core==N.M.0` from the package
|
||||
# index, and the core is published BEFORE this package. This gate answers
|
||||
# whether it is there yet; during that window the smoke matrix is SKIPPED
|
||||
# with the reason in the run summary rather than faked green, and once the
|
||||
# core is up it runs unchanged. See .github/workflows/core-on-index.yml.
|
||||
# whether it is there yet; during that window this job FAILS (rule ci-13: a
|
||||
# core that is not on the index is red, never a skip) and the smoke matrix,
|
||||
# which needs it, does not run; once the core is up it runs unchanged. See .github/workflows/core-on-index.yml.
|
||||
core-on-index:
|
||||
uses: ./.github/workflows/core-on-index.yml
|
||||
|
||||
smoke:
|
||||
name: launch (${{ matrix.os }}, py${{ matrix.python }})
|
||||
needs: core-on-index
|
||||
if: needs.core-on-index.outputs.available == 'true'
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
|
||||
+48
-69
@@ -5,6 +5,9 @@ on:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
branches: [main]
|
||||
# The merge queue run: a pull request is judged by this fast set; e2e.yml and fakeweb.yml run in the queue run and that run decides.
|
||||
merge_group:
|
||||
types: [checks_requested]
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
@@ -17,9 +20,10 @@ permissions:
|
||||
# each other; only an older run of THIS workflow on the same branch is replaced.
|
||||
# A newer push to a pull request cancels the run it supersedes. Never on main:
|
||||
# outside a pull request the group is unique to the run (`github.run_id`), so
|
||||
# every commit of main keeps its own finished run (see e2e.yml for why).
|
||||
# every commit of main keeps its own finished run (see e2e.yml for why). A merge queue run is keyed by its own ref (one per queue entry) and is never
|
||||
# cancelled: `cancel-in-progress` is true on a pull request only.
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && format('pr-{0}', github.event.pull_request.number) || github.run_id }}
|
||||
group: ${{ github.workflow }}-${{ github.event_name == 'merge_group' && github.ref || github.event_name == 'pull_request' && format('pr-{0}', github.event.pull_request.number) || github.run_id }}
|
||||
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
||||
|
||||
# Engine and GeoIP downloads go through the release API with this token.
|
||||
@@ -152,11 +156,11 @@ jobs:
|
||||
# package index. The core is published BEFORE this package, so between the
|
||||
# first push of this repo and that upload there is a window in which no
|
||||
# install here can succeed. This gate answers "is it on the index?" and the
|
||||
# unit job depends on the answer: during the window that job is SKIPPED (grey
|
||||
# in the checks list, with the reason written into the run summary), never
|
||||
# faked green; once the core is published it runs exactly as before. Full
|
||||
# reasoning, including why `|| true`, `--no-deps` and a git fallback were all
|
||||
# rejected, is in .github/workflows/core-on-index.yml.
|
||||
# unit job depends on the answer: during the window this job FAILS with the
|
||||
# reason (rule ci-13: a core that is not on the index is red, never a skip),
|
||||
# and `gate` is red with it; once the core is published it runs exactly as
|
||||
# before. Full reasoning, including why `|| true`, `--no-deps` and a git
|
||||
# fallback were all rejected, is in .github/workflows/core-on-index.yml.
|
||||
core-on-index:
|
||||
uses: ./.github/workflows/core-on-index.yml
|
||||
|
||||
@@ -169,7 +173,6 @@ jobs:
|
||||
unit:
|
||||
name: pytest (${{ matrix.os }}, py${{ matrix.python }})
|
||||
needs: core-on-index
|
||||
if: needs.core-on-index.outputs.available == 'true'
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
@@ -347,13 +350,12 @@ jobs:
|
||||
# exactly how it got here. This job depends on the whole matrix and its
|
||||
# name never changes.
|
||||
#
|
||||
# SKIPPED IS NOT FAILED, and that is the part specific to this repo. `unit`
|
||||
# is skipped on purpose when `core-on-index` says the pin is not yet on the
|
||||
# index: during that window no install can succeed, and the workflow chose
|
||||
# to SKIP instead of faking green. A gate that required `success` would
|
||||
# turn that choice into a red and push toward dropping the protection on
|
||||
# release day of all days. So it refuses on `failure` and `cancelled`,
|
||||
# never on `skipped`.
|
||||
# SKIPPED IS RED (rule ci-13: nothing counts as passed that did not pass).
|
||||
# A job that was skipped ran nothing. `unit` used to be skipped when
|
||||
# `core-on-index` said the pin was not on the index yet, and this gate
|
||||
# treated that skip as a pass: a pull request merged with no test run. Now
|
||||
# `core-on-index` fails in that case, and the gate refuses every needed job
|
||||
# whose result is not `success`.
|
||||
# The guides are the surface a stranger copies first, and until 2026-09-08
|
||||
# nothing read them: one page published `page.accessibility.snapshot()`, which
|
||||
# this fork does not have, so anybody who ran that block got an AttributeError.
|
||||
@@ -361,13 +363,11 @@ jobs:
|
||||
# by a reader who then leaves.
|
||||
#
|
||||
# It needs the package importable, because it asks the REAL classes what they
|
||||
# have rather than carrying a list that would drift from them - so it takes
|
||||
# core-on-index's answer exactly as `unit` does, and is SKIPPED during the
|
||||
# window rather than faked green.
|
||||
# have rather than carrying a list that would drift from them - so it needs
|
||||
# core-on-index exactly as `unit` does.
|
||||
docs-api:
|
||||
name: the guides name an API that exists
|
||||
needs: core-on-index
|
||||
if: needs.core-on-index.outputs.available == 'true'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 (v4.4.0)
|
||||
@@ -396,59 +396,37 @@ jobs:
|
||||
# the decorative protection this project has already met once, on the branch
|
||||
# rules that required job names no job produced any more.
|
||||
#
|
||||
# `skipped` is not a failure and must not be treated as one: `version` runs on
|
||||
# pull requests only and is skipped on every push to main, and `unit` and
|
||||
# `docs-api` are skipped during the window when the pinned core is not on the
|
||||
# index yet. The case arms name failure and cancelled, so a skip passes on
|
||||
# purpose. That is also why each arm carries its own sentence: a gate that
|
||||
# exits 1 without saying which of five inputs went red is a gate somebody has
|
||||
# to open five tabs to read.
|
||||
# Every needed job must end in `success`; `skipped`, `cancelled` and
|
||||
# `failure` are red, one FAIL line each (scripts/ci_gate.py). The single job
|
||||
# that is conditional by design is `version`: it runs on pull requests and in
|
||||
# the merge queue run, so a push to main skips it on purpose, and the script
|
||||
# expects `skipped` there and `success` on a pull request and in the queue.
|
||||
# Nothing else is forgiven. The
|
||||
# script is read from origin/main, not from the branch being judged. Its table and the `needs:` below are held together by
|
||||
# tests/test_the_gate_is_red_when_a_needed_job_is_skipped.py.
|
||||
gate:
|
||||
needs: [core-on-index, unit, docs-api, english, claims, version, way-in, install-job, noreply-identity]
|
||||
if: always()
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: refuse unless nothing failed
|
||||
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 (v4.4.0)
|
||||
- name: refuse unless every needed job succeeded
|
||||
env:
|
||||
NEEDS: ${{ toJSON(needs) }}
|
||||
EVENT_NAME: ${{ github.event_name }}
|
||||
WORKFLOW: tests
|
||||
# The judge is read from main, never from the branch it judges. Only
|
||||
# while the file is not on main yet (the change that adds it) the
|
||||
# copy of this branch is used, and the log says so.
|
||||
run: |
|
||||
echo "core-on-index: ${{ needs.core-on-index.result }}"
|
||||
echo "unit: ${{ needs.unit.result }}"
|
||||
echo "docs-api: ${{ needs.docs-api.result }}"
|
||||
echo "english: ${{ needs.english.result }}"
|
||||
echo "claims: ${{ needs.claims.result }}"
|
||||
echo "way-in: ${{ needs.way-in.result }}"
|
||||
echo "version: ${{ needs.version.result }}"
|
||||
echo "install-job: ${{ needs.install-job.result }}"
|
||||
echo "noreply-identity: ${{ needs.noreply-identity.result }}"
|
||||
case "${{ needs.unit.result }}" in
|
||||
failure|cancelled) echo "the suite did not pass"; exit 1 ;;
|
||||
esac
|
||||
case "${{ needs.core-on-index.result }}" in
|
||||
failure|cancelled) echo "the index check did not run"; exit 1 ;;
|
||||
esac
|
||||
case "${{ needs.docs-api.result }}" in
|
||||
failure|cancelled) echo "the guides name something that does not exist"; exit 1 ;;
|
||||
esac
|
||||
case "${{ needs.english.result }}" in
|
||||
failure|cancelled) echo "the repository is not English"; exit 1 ;;
|
||||
esac
|
||||
case "${{ needs.claims.result }}" in
|
||||
failure|cancelled) echo "the README promises what no measurement supports"; exit 1 ;;
|
||||
esac
|
||||
case "${{ needs.way-in.result }}" in
|
||||
failure|cancelled) echo "an install instruction is not uv"; exit 1 ;;
|
||||
esac
|
||||
case "${{ needs.version.result }}" in
|
||||
failure|cancelled) echo "the version this change proposes is already taken"; exit 1 ;;
|
||||
esac
|
||||
case "${{ needs.install-job.result }}" in
|
||||
failure|cancelled) echo "the user-install job would not run on a release, or leaks"; exit 1 ;;
|
||||
esac
|
||||
# Unlike the checks above this one must be `success`: it runs on every
|
||||
# event this workflow has, so a skip would mean the check never ran.
|
||||
if [ "${{ needs.noreply-identity.result }}" != "success" ]; then
|
||||
echo "a commit or tag of this change has an email that is not a GitHub noreply address"; exit 1
|
||||
git fetch --no-tags --depth=1 origin +refs/heads/main:refs/remotes/origin/main
|
||||
if git cat-file -e origin/main:scripts/ci_gate.py 2>/dev/null; then
|
||||
git show origin/main:scripts/ci_gate.py > "$RUNNER_TEMP/ci_gate.py"
|
||||
else
|
||||
echo "ci_gate.py is not on origin/main yet: falling back to the copy of this branch"
|
||||
cp scripts/ci_gate.py "$RUNNER_TEMP/ci_gate.py"
|
||||
fi
|
||||
echo "ok"
|
||||
python3 "$RUNNER_TEMP/ci_gate.py"
|
||||
|
||||
# Measured 2026-09-04: 0.10.0 was on the index while main sat on 0.10.0 with
|
||||
# FIFTEEN commits of different content on top of the tag - 39 files, 841
|
||||
@@ -458,13 +436,14 @@ jobs:
|
||||
# indistinguishable from somebody forgetting to bump. The fix could not have
|
||||
# reached anybody, and nothing would have said so.
|
||||
#
|
||||
# Pull requests only: on main straight after a release the version IS the
|
||||
# published one until somebody bumps, and a gate that is red at rest is one
|
||||
# people learn to skip. Bumping publishes nothing - publishing happens on a
|
||||
# Where a change is proposed (a pull request, and the merge queue run, which
|
||||
# compares the version the entry proposes with the published one): on main
|
||||
# straight after a release the version IS the published one until somebody
|
||||
# bumps, and a gate that is red at rest is one people learn to skip. Bumping publishes nothing - publishing happens on a
|
||||
# tag push - so main on an unreleased version is the normal state between
|
||||
# releases and the rule costs one line.
|
||||
version:
|
||||
if: github.event_name == 'pull_request'
|
||||
if: github.event_name == 'pull_request' || github.event_name == 'merge_group'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 (v4.4.0)
|
||||
|
||||
@@ -14,8 +14,8 @@
|
||||
{"id": "wrapper.e2e.fakeweb", "giro": "G2", "os": ["linux", "windows"], "min_tests": 7, "exact": true, "tests": ["tests/test_fakeweb_p2_e2e.py", "tests/test_fakeweb_p4_e2e.py"], "marker": "e2e", "needs_root": false, "note": "The fake web, offline: our browser on the hard pages (profile P2: a reused routed page reaches networkidle every time, also under a load of three other browsers; the other site is another process) and on the 17-step journey of a person (profile P4: every step as stock, and every page left only once its noise is done), each judged against what stock Firefox does, as tests/fakeweb/pages.json declares it. 7 = 3 + 4 (the last two: a `load` that takes 20 s is a step that succeeds, and a `load` that never comes ends in an error that names the wait and the page). Stock itself is held to that declaration, and compared with ours step by step, by scripts/run_fakeweb.py in .github/workflows/fakeweb.yml. Needs the candidate binary (STEALTHFOX_E2E_BINARY).", "stock_firefox": true, "extra_steps": ["fakeweb_profiles"]},
|
||||
{"id": "wrapper.e2e.fontconfig", "giro": "G2", "os": ["linux"], "min_tests": 2, "exact": true, "tests": ["tests/test_the_parent_reads_the_bundle_from_fontconfig_s_cache_linux_e2e.py"], "marker": "e2e", "needs_root": false, "linux_only": "Fontconfig exists only on Linux: the parent of the engine shows <GRE>/fonts to it (FcConfigAppFontAddDir) to rebuild a font from a path and a face index. On Windows DirectWrite opens the file from its path, with no folder to scan and no cache to read, so this test has no Windows counterpart.", "note": "2 = (1) the stand-in that runs the engine under strace stays in the engine's place, as the core launches it (the leader of a process group of its own): a fake engine with a child, no browser; the process the launcher holds lives as long as the fake engine, and the group killed holds strace and the child (the stand-in that exec'd setsid forked and exited 0 at once: candidate 44161687675); (2) the warm launch of the parent reads the bundle from fontconfig's cache and does not scan it again (from firefox-66, engine_at_least). Two launches under strace with the same XDG_CACHE_HOME of the test, the first cold and the second warm: the cold parent opens every font file of <GRE>/fonts (the folder as the disk lists it) before any page and fontconfig writes its cache; the warm parent does not open every one of them, and it opens a *.cache-* file of fontconfig (a few files are opened to be used, so the verdict asks about the whole folder, as a scan does). Scan and drawing are told apart by position: only what the parent opens before the first page counts (the opens that draw are written as after_startup). Evidence in RUNNER_TEMP/invpw-evidence/fontconfig-cache: the interval and the number of opens of the bundle, the names of the files of the bundle each launch opened before the first page, the size of the cache file, the VmRSS of the parent after about:blank and after a page with every family, and a third launch with gfx.bundled-fonts.activate=0 (the behaviour before), which is evidence only. Needs strace on the runner: without it both are red, not skipped. No threshold."},
|
||||
{"id": "wrapper.unit.compositing", "giro": "G1", "os": ["linux", "windows"], "min_tests": 30, "exact": true, "tests": ["tests/test_the_page_bytes_reference_compares_decoded_pixels.py"], "marker": "unit", "needs_root": false, "note": "The helpers of wrapper.e2e.compositing on known inputs, no browser: the PNG compared on decoded pixels (another deBG chunk and compression are the same, one pixel is not, every scanline filter), the comparison with a reference (changed, missing and extra keys named, the entry to record), the type of an engine process, an engine process known by its executable and not by the name it gives itself (Linux), and the CPU of a window, and the shape of the committed Windows reference, and the box cut out of a screenshot (its pixels, a box outside the picture refused, written as a PNG and read back, two boxes told apart by a pixel that is named, the pixels that are not grey)."},
|
||||
{"id": "wrapper.unit.all.linux", "giro": "G1", "os": ["linux"], "min_tests": 3719, "exact": true, "tests": ["tests/test_a_162_message_is_read_like_a_161_one.py", "tests/test_a_click_makes_one_mousemove_at_its_point.py", "tests/test_a_closed_context_leaves_nothing_in_the_registry.py", "tests/test_a_closed_page_says_nothing.py", "tests/test_a_closed_pipe_is_a_closed_target.py", "tests/test_a_commit_at_any_point_of_the_hand_over_reaches_the_client_once.py", "tests/test_a_context_proxy_carries_its_measured_udp_exit.py", "tests/test_a_context_route_disables_the_cache.py", "tests/test_a_detached_frame_answers_detached.py", "tests/test_a_dialog_is_a_protocol_object.py", "tests/test_a_dialog_is_answered_after_a_pause.py", "tests/test_a_download_finished_before_it_was_announced_is_finished.py", "tests/test_a_failed_expect_carries_its_call_log.py", "tests/test_a_failed_generation_of_the_security_state_keeps_its_evidence.py", "tests/test_a_failed_launch_stops_the_display.py", "tests/test_a_field_is_typed_after_a_pause.py", "tests/test_a_file_chooser_is_never_dropped_in_silence.py", "tests/test_a_frame_tap_needs_a_context_with_touch.py", "tests/test_a_handle_action_walks_like_a_selector_action.py", "tests/test_a_launch_asks_nobody_on_the_internet_where_it_leaves_from.py", "tests/test_a_launch_gives_the_core_its_engine_for_the_security_state.py", "tests/test_a_launch_has_one_deadline.py", "tests/test_a_launch_without_a_session_gets_one.py", "tests/test_a_live_event_does_not_overtake_the_replay_of_a_new_page.py", "tests/test_a_module_that_leaves_a_browser_open_fails.py", "tests/test_a_new_page_waits_for_the_engine.py", "tests/test_a_non_finite_number_crosses_the_wire_as_a_tag.py", "tests/test_a_page_closed_before_its_announcement_is_not_announced.py", "tests/test_a_page_is_handed_over_only_when_the_engine_says_it_is_ready.py", "tests/test_a_path_leaves_as_one_stroke.py", "tests/test_a_port_number_is_held_until_it_is_used.py", "tests/test_a_read_whose_probe_ran_out_is_the_callers_timeout.py", "tests/test_a_request_and_a_response_are_light.py", "tests/test_a_request_says_what_it_is.py", "tests/test_a_screenshot_sends_its_scale_to_the_engine.py", "tests/test_a_session_ends_before_the_next_test_starts.py", "tests/test_a_streamed_upload_is_staged_in_the_session.py", "tests/test_a_stroke_is_judged_by_its_shape_not_its_length.py", "tests/test_a_unit_test_does_not_read_the_seal_of_the_job.py", "tests/test_ab_host.py", "tests/test_ab_host_aa_stable.py", "tests/test_ab_network.py", "tests/test_ab_oracle.py", "tests/test_actions_without_a_point.py", "tests/test_add_script_tag.py", "tests/test_an_element_handle_serves_every_method_of_the_client.py", "tests/test_an_expect_reads_its_value_once.py", "tests/test_async_api.py", "tests/test_browser_output_is_drained.py", "tests/test_ci_downloads_are_authenticated.py", "tests/test_ci_drive_gate_goes_through_the_core.py", "tests/test_ci_host_gate.py", "tests/test_ci_host_gate_ab.py", "tests/test_ci_lab_geoip.py", "tests/test_ci_lab_geoip_verify.py", "tests/test_ci_lab_intermediates.py", "tests/test_ci_lab_security_state.py", "tests/test_ci_linux_legs_read_no_mirror.py", "tests/test_ci_poison_host.py", "tests/test_ci_real_geoip_check.py", "tests/test_ci_real_geoip_exit_code.py", "tests/test_ci_runs_once_per_commit.py", "tests/test_ci_suite_run.py", "tests/test_ci_verdict.py", "tests/test_ci_workflows_build_the_geoip_database.py", "tests/test_ci_workflows_set_the_intermediates_list.py", "tests/test_ci_workflows_set_the_security_state.py", "tests/test_cli.py", "tests/test_click_rhythm.py", "tests/test_connect_does_not_start_threads_on_the_loop.py", "tests/test_context_locale_is_a_list.py", "tests/test_core_pin.py", "tests/test_cpu_by_type_window.py", "tests/test_cross_origin_iframe.py", "tests/test_cursor_dispatch.py", "tests/test_cursor_wiring.py", "tests/test_docs_name_the_mcp_repo_as_it_is.py", "tests/test_doh_session_prefs_unit.py", "tests/test_drag_motion.py", "tests/test_e2e_hermetic.py", "tests/test_element_handle_actions.py", "tests/test_every_action_is_pinned_by_commit_sha.py", "tests/test_every_argument_reaches_the_page_as_playwright_sends_it.py", "tests/test_every_held_request_of_the_journey_starts_after_the_load.py", "tests/test_every_order_of_the_events_of_a_popup_gives_one_page_event.py", "tests/test_every_page_draws_its_own_acts.py", "tests/test_every_refusal_is_declared.py", "tests/test_every_route_command_is_answered_may_fail.py", "tests/test_every_suite_runs_on_linux_and_windows.py", "tests/test_every_wire_method_is_served_or_refused.py", "tests/test_expose_binding_refusal.py", "tests/test_fakeweb_p4_report.py", "tests/test_fakeweb_stock_unsettled.py", "tests/test_fission_identity_parity_e2e.py", "tests/test_fixtures_name_why_the_package_is_missing.py", "tests/test_fork.py", "tests/test_frame_dispatch.py", "tests/test_geoip_used.py", "tests/test_glean_ready.py", "tests/test_goto_follows_the_base_url.py", "tests/test_hook_wiring.py", "tests/test_imports.py", "tests/test_intLine truncated
|
||||
{"id": "wrapper.unit.all.windows", "giro": "G1", "os": ["windows"], "min_tests": 3720, "exact": true, "tests": ["tests/test_a_162_message_is_read_like_a_161_one.py", "tests/test_a_click_makes_one_mousemove_at_its_point.py", "tests/test_a_closed_context_leaves_nothing_in_the_registry.py", "tests/test_a_closed_page_says_nothing.py", "tests/test_a_closed_pipe_is_a_closed_target.py", "tests/test_a_commit_at_any_point_of_the_hand_over_reaches_the_client_once.py", "tests/test_a_context_proxy_carries_its_measured_udp_exit.py", "tests/test_a_context_route_disables_the_cache.py", "tests/test_a_detached_frame_answers_detached.py", "tests/test_a_dialog_is_a_protocol_object.py", "tests/test_a_dialog_is_answered_after_a_pause.py", "tests/test_a_download_finished_before_it_was_announced_is_finished.py", "tests/test_a_failed_expect_carries_its_call_log.py", "tests/test_a_failed_generation_of_the_security_state_keeps_its_evidence.py", "tests/test_a_failed_launch_stops_the_display.py", "tests/test_a_field_is_typed_after_a_pause.py", "tests/test_a_file_chooser_is_never_dropped_in_silence.py", "tests/test_a_frame_tap_needs_a_context_with_touch.py", "tests/test_a_handle_action_walks_like_a_selector_action.py", "tests/test_a_launch_asks_nobody_on_the_internet_where_it_leaves_from.py", "tests/test_a_launch_gives_the_core_its_engine_for_the_security_state.py", "tests/test_a_launch_has_one_deadline.py", "tests/test_a_launch_without_a_session_gets_one.py", "tests/test_a_live_event_does_not_overtake_the_replay_of_a_new_page.py", "tests/test_a_module_that_leaves_a_browser_open_fails.py", "tests/test_a_new_page_waits_for_the_engine.py", "tests/test_a_non_finite_number_crosses_the_wire_as_a_tag.py", "tests/test_a_page_closed_before_its_announcement_is_not_announced.py", "tests/test_a_page_is_handed_over_only_when_the_engine_says_it_is_ready.py", "tests/test_a_path_leaves_as_one_stroke.py", "tests/test_a_port_number_is_held_until_it_is_used.py", "tests/test_a_read_whose_probe_ran_out_is_the_callers_timeout.py", "tests/test_a_request_and_a_response_are_light.py", "tests/test_a_request_says_what_it_is.py", "tests/test_a_screenshot_sends_its_scale_to_the_engine.py", "tests/test_a_session_ends_before_the_next_test_starts.py", "tests/test_a_streamed_upload_is_staged_in_the_session.py", "tests/test_a_stroke_is_judged_by_its_shape_not_its_length.py", "tests/test_a_unit_test_does_not_read_the_seal_of_the_job.py", "tests/test_ab_host.py", "tests/test_ab_host_aa_stable.py", "tests/test_ab_network.py", "tests/test_ab_oracle.py", "tests/test_actions_without_a_point.py", "tests/test_add_script_tag.py", "tests/test_an_element_handle_serves_every_method_of_the_client.py", "tests/test_an_expect_reads_its_value_once.py", "tests/test_async_api.py", "tests/test_browser_output_is_drained.py", "tests/test_ci_downloads_are_authenticated.py", "tests/test_ci_drive_gate_goes_through_the_core.py", "tests/test_ci_host_gate.py", "tests/test_ci_host_gate_ab.py", "tests/test_ci_lab_geoip.py", "tests/test_ci_lab_geoip_verify.py", "tests/test_ci_lab_intermediates.py", "tests/test_ci_lab_security_state.py", "tests/test_ci_linux_legs_read_no_mirror.py", "tests/test_ci_poison_host.py", "tests/test_ci_real_geoip_check.py", "tests/test_ci_real_geoip_exit_code.py", "tests/test_ci_runs_once_per_commit.py", "tests/test_ci_suite_run.py", "tests/test_ci_verdict.py", "tests/test_ci_workflows_build_the_geoip_database.py", "tests/test_ci_workflows_set_the_intermediates_list.py", "tests/test_ci_workflows_set_the_security_state.py", "tests/test_cli.py", "tests/test_click_rhythm.py", "tests/test_connect_does_not_start_threads_on_the_loop.py", "tests/test_context_locale_is_a_list.py", "tests/test_core_pin.py", "tests/test_cpu_by_type_window.py", "tests/test_cross_origin_iframe.py", "tests/test_cursor_dispatch.py", "tests/test_cursor_wiring.py", "tests/test_docs_name_the_mcp_repo_as_it_is.py", "tests/test_doh_session_prefs_unit.py", "tests/test_drag_motion.py", "tests/test_e2e_hermetic.py", "tests/test_element_handle_actions.py", "tests/test_every_action_is_pinned_by_commit_sha.py", "tests/test_every_argument_reaches_the_page_as_playwright_sends_it.py", "tests/test_every_held_request_of_the_journey_starts_after_the_load.py", "tests/test_every_order_of_the_events_of_a_popup_gives_one_page_event.py", "tests/test_every_page_draws_its_own_acts.py", "tests/test_every_refusal_is_declared.py", "tests/test_every_route_command_is_answered_may_fail.py", "tests/test_every_suite_runs_on_linux_and_windows.py", "tests/test_every_wire_method_is_served_or_refused.py", "tests/test_expose_binding_refusal.py", "tests/test_fakeweb_p4_report.py", "tests/test_fakeweb_stock_unsettled.py", "tests/test_fission_identity_parity_e2e.py", "tests/test_fixtures_name_why_the_package_is_missing.py", "tests/test_fork.py", "tests/test_frame_dispatch.py", "tests/test_geoip_used.py", "tests/test_glean_ready.py", "tests/test_goto_follows_the_base_url.py", "tests/test_hook_wiring.py", "tests/test_imports.py", "tests/testLine truncated
|
||||
{"id": "wrapper.unit.all.linux", "giro": "G1", "os": ["linux"], "min_tests": 3879, "exact": true, "tests": ["tests/test_a_162_message_is_read_like_a_161_one.py", "tests/test_a_click_makes_one_mousemove_at_its_point.py", "tests/test_a_closed_context_leaves_nothing_in_the_registry.py", "tests/test_a_closed_page_says_nothing.py", "tests/test_a_closed_pipe_is_a_closed_target.py", "tests/test_a_commit_at_any_point_of_the_hand_over_reaches_the_client_once.py", "tests/test_a_context_proxy_carries_its_measured_udp_exit.py", "tests/test_a_context_route_disables_the_cache.py", "tests/test_a_detached_frame_answers_detached.py", "tests/test_a_dialog_is_a_protocol_object.py", "tests/test_a_dialog_is_answered_after_a_pause.py", "tests/test_a_docs_only_change_runs_nothing_heavy_in_the_queue.py", "tests/test_a_download_finished_before_it_was_announced_is_finished.py", "tests/test_a_failed_expect_carries_its_call_log.py", "tests/test_a_failed_generation_of_the_security_state_keeps_its_evidence.py", "tests/test_a_failed_launch_stops_the_display.py", "tests/test_a_field_is_typed_after_a_pause.py", "tests/test_a_file_chooser_is_never_dropped_in_silence.py", "tests/test_a_frame_tap_needs_a_context_with_touch.py", "tests/test_a_handle_action_walks_like_a_selector_action.py", "tests/test_a_launch_asks_nobody_on_the_internet_where_it_leaves_from.py", "tests/test_a_launch_gives_the_core_its_engine_for_the_security_state.py", "tests/test_a_launch_has_one_deadline.py", "tests/test_a_launch_without_a_session_gets_one.py", "tests/test_a_live_event_does_not_overtake_the_replay_of_a_new_page.py", "tests/test_a_module_that_leaves_a_browser_open_fails.py", "tests/test_a_new_page_waits_for_the_engine.py", "tests/test_a_non_finite_number_crosses_the_wire_as_a_tag.py", "tests/test_a_page_closed_before_its_announcement_is_not_announced.py", "tests/test_a_page_is_handed_over_only_when_the_engine_says_it_is_ready.py", "tests/test_a_path_leaves_as_one_stroke.py", "tests/test_a_port_number_is_held_until_it_is_used.py", "tests/test_a_read_whose_probe_ran_out_is_the_callers_timeout.py", "tests/test_a_request_and_a_response_are_light.py", "tests/test_a_request_says_what_it_is.py", "tests/test_a_screenshot_sends_its_scale_to_the_engine.py", "tests/test_a_session_ends_before_the_next_test_starts.py", "tests/test_a_streamed_upload_is_staged_in_the_session.py", "tests/test_a_stroke_is_judged_by_its_shape_not_its_length.py", "tests/test_a_unit_test_does_not_read_the_seal_of_the_job.py", "tests/test_ab_host.py", "tests/test_ab_host_aa_stable.py", "tests/test_ab_network.py", "tests/test_ab_oracle.py", "tests/test_actions_without_a_point.py", "tests/test_add_script_tag.py", "tests/test_an_element_handle_serves_every_method_of_the_client.py", "tests/test_an_expect_reads_its_value_once.py", "tests/test_async_api.py", "tests/test_browser_output_is_drained.py", "tests/test_ci_downloads_are_authenticated.py", "tests/test_ci_drive_gate_goes_through_the_core.py", "tests/test_ci_host_gate.py", "tests/test_ci_host_gate_ab.py", "tests/test_ci_lab_geoip.py", "tests/test_ci_lab_geoip_verify.py", "tests/test_ci_lab_intermediates.py", "tests/test_ci_lab_security_state.py", "tests/test_ci_linux_legs_read_no_mirror.py", "tests/test_ci_poison_host.py", "tests/test_ci_real_geoip_check.py", "tests/test_ci_real_geoip_exit_code.py", "tests/test_ci_runs_once_per_commit.py", "tests/test_ci_suite_run.py", "tests/test_ci_verdict.py", "tests/test_ci_workflows_build_the_geoip_database.py", "tests/test_ci_workflows_set_the_intermediates_list.py", "tests/test_ci_workflows_set_the_security_state.py", "tests/test_cli.py", "tests/test_click_rhythm.py", "tests/test_connect_does_not_start_threads_on_the_loop.py", "tests/test_context_locale_is_a_list.py", "tests/test_core_pin.py", "tests/test_cpu_by_type_window.py", "tests/test_cross_origin_iframe.py", "tests/test_cursor_dispatch.py", "tests/test_cursor_wiring.py", "tests/test_docs_name_the_mcp_repo_as_it_is.py", "tests/test_doh_session_prefs_unit.py", "tests/test_drag_motion.py", "tests/test_e2e_hermetic.py", "tests/test_element_handle_actions.py", "tests/test_every_action_is_pinned_by_commit_sha.py", "tests/test_every_argument_reaches_the_page_as_playwright_sends_it.py", "tests/test_every_held_request_of_the_journey_starts_after_the_load.py", "tests/test_every_order_of_the_events_of_a_popup_gives_one_page_event.py", "tests/test_every_page_draws_its_own_acts.py", "tests/test_every_refusal_is_declared.py", "tests/test_every_route_command_is_answered_may_fail.py", "tests/test_every_suite_runs_on_linux_and_windows.py", "tests/test_every_wire_method_is_served_or_refused.py", "tests/test_expose_binding_refusal.py", "tests/test_fakeweb_p4_report.py", "tests/test_fakeweb_stock_unsettled.py", "tests/test_fission_identity_parity_e2e.py", "tests/test_fixtures_name_why_the_package_is_missing.py", "tests/test_fork.py", "tests/test_frame_dispatch.py", "tests/test_geoip_used.py", "tests/test_glean_ready.py", "tests/test_goto_follows_the_base_url.py", "Line truncated
|
||||
{"id": "wrapper.unit.all.windows", "giro": "G1", "os": ["windows"], "min_tests": 3880, "exact": true, "tests": ["tests/test_a_162_message_is_read_like_a_161_one.py", "tests/test_a_click_makes_one_mousemove_at_its_point.py", "tests/test_a_closed_context_leaves_nothing_in_the_registry.py", "tests/test_a_closed_page_says_nothing.py", "tests/test_a_closed_pipe_is_a_closed_target.py", "tests/test_a_commit_at_any_point_of_the_hand_over_reaches_the_client_once.py", "tests/test_a_context_proxy_carries_its_measured_udp_exit.py", "tests/test_a_context_route_disables_the_cache.py", "tests/test_a_detached_frame_answers_detached.py", "tests/test_a_dialog_is_a_protocol_object.py", "tests/test_a_dialog_is_answered_after_a_pause.py", "tests/test_a_docs_only_change_runs_nothing_heavy_in_the_queue.py", "tests/test_a_download_finished_before_it_was_announced_is_finished.py", "tests/test_a_failed_expect_carries_its_call_log.py", "tests/test_a_failed_generation_of_the_security_state_keeps_its_evidence.py", "tests/test_a_failed_launch_stops_the_display.py", "tests/test_a_field_is_typed_after_a_pause.py", "tests/test_a_file_chooser_is_never_dropped_in_silence.py", "tests/test_a_frame_tap_needs_a_context_with_touch.py", "tests/test_a_handle_action_walks_like_a_selector_action.py", "tests/test_a_launch_asks_nobody_on_the_internet_where_it_leaves_from.py", "tests/test_a_launch_gives_the_core_its_engine_for_the_security_state.py", "tests/test_a_launch_has_one_deadline.py", "tests/test_a_launch_without_a_session_gets_one.py", "tests/test_a_live_event_does_not_overtake_the_replay_of_a_new_page.py", "tests/test_a_module_that_leaves_a_browser_open_fails.py", "tests/test_a_new_page_waits_for_the_engine.py", "tests/test_a_non_finite_number_crosses_the_wire_as_a_tag.py", "tests/test_a_page_closed_before_its_announcement_is_not_announced.py", "tests/test_a_page_is_handed_over_only_when_the_engine_says_it_is_ready.py", "tests/test_a_path_leaves_as_one_stroke.py", "tests/test_a_port_number_is_held_until_it_is_used.py", "tests/test_a_read_whose_probe_ran_out_is_the_callers_timeout.py", "tests/test_a_request_and_a_response_are_light.py", "tests/test_a_request_says_what_it_is.py", "tests/test_a_screenshot_sends_its_scale_to_the_engine.py", "tests/test_a_session_ends_before_the_next_test_starts.py", "tests/test_a_streamed_upload_is_staged_in_the_session.py", "tests/test_a_stroke_is_judged_by_its_shape_not_its_length.py", "tests/test_a_unit_test_does_not_read_the_seal_of_the_job.py", "tests/test_ab_host.py", "tests/test_ab_host_aa_stable.py", "tests/test_ab_network.py", "tests/test_ab_oracle.py", "tests/test_actions_without_a_point.py", "tests/test_add_script_tag.py", "tests/test_an_element_handle_serves_every_method_of_the_client.py", "tests/test_an_expect_reads_its_value_once.py", "tests/test_async_api.py", "tests/test_browser_output_is_drained.py", "tests/test_ci_downloads_are_authenticated.py", "tests/test_ci_drive_gate_goes_through_the_core.py", "tests/test_ci_host_gate.py", "tests/test_ci_host_gate_ab.py", "tests/test_ci_lab_geoip.py", "tests/test_ci_lab_geoip_verify.py", "tests/test_ci_lab_intermediates.py", "tests/test_ci_lab_security_state.py", "tests/test_ci_linux_legs_read_no_mirror.py", "tests/test_ci_poison_host.py", "tests/test_ci_real_geoip_check.py", "tests/test_ci_real_geoip_exit_code.py", "tests/test_ci_runs_once_per_commit.py", "tests/test_ci_suite_run.py", "tests/test_ci_verdict.py", "tests/test_ci_workflows_build_the_geoip_database.py", "tests/test_ci_workflows_set_the_intermediates_list.py", "tests/test_ci_workflows_set_the_security_state.py", "tests/test_cli.py", "tests/test_click_rhythm.py", "tests/test_connect_does_not_start_threads_on_the_loop.py", "tests/test_context_locale_is_a_list.py", "tests/test_core_pin.py", "tests/test_cpu_by_type_window.py", "tests/test_cross_origin_iframe.py", "tests/test_cursor_dispatch.py", "tests/test_cursor_wiring.py", "tests/test_docs_name_the_mcp_repo_as_it_is.py", "tests/test_doh_session_prefs_unit.py", "tests/test_drag_motion.py", "tests/test_e2e_hermetic.py", "tests/test_element_handle_actions.py", "tests/test_every_action_is_pinned_by_commit_sha.py", "tests/test_every_argument_reaches_the_page_as_playwright_sends_it.py", "tests/test_every_held_request_of_the_journey_starts_after_the_load.py", "tests/test_every_order_of_the_events_of_a_popup_gives_one_page_event.py", "tests/test_every_page_draws_its_own_acts.py", "tests/test_every_refusal_is_declared.py", "tests/test_every_route_command_is_answered_may_fail.py", "tests/test_every_suite_runs_on_linux_and_windows.py", "tests/test_every_wire_method_is_served_or_refused.py", "tests/test_expose_binding_refusal.py", "tests/test_fakeweb_p4_report.py", "tests/test_fakeweb_stock_unsettled.py", "tests/test_fission_identity_parity_e2e.py", "tests/test_fixtures_name_why_the_package_is_missing.py", "tests/test_fork.py", "tests/test_frame_dispatch.py", "tests/test_geoip_used.py", "tests/test_glean_ready.py", "tests/test_goto_follows_the_base_url.pyLine truncated
|
||||
{"id": "wrapper.e2e.securitystate", "giro": "G2", "os": ["linux", "windows"], "min_tests": 4, "exact": true, "tests": ["tests/test_security_state_engine_e2e.py"], "marker": "e2e", "needs_root": false, "note": "The security state the core declares, against the engine: the engine launched directly in its generate mode makes what it is given (the contract's result, security_state/ with the bytes of the full filter and of the delta, the core's own validation of it); a normal launch declares no pref of the mode and re-imports nothing; a certificate that Mozilla's CRLite test data say is revoked in a delta is refused at the first navigation (SEC_ERROR_REVOKED_CERTIFICATE) while a valid one loads, and the revoked one loads when the ready directory has no data; a ready directory with no or an empty security_state/ starts. Certificates made on the run (a fresh root trusted in cert9.db by the engine's own xpcshell, Mozilla's default test key as the key of CN=int), servers on loopback, no network. Red on firefox-67 (no generate mode).", "core_dumps": "invpw-cores"},
|
||||
{"id": "wrapper.e2e.suite.linux.1", "giro": "G2", "os": ["linux"], "min_tests": 415, "exact": true, "tests": ["tests/test_a_closed_browser_leaves_the_others_alone_e2e.py", "tests/test_a_context_that_ends_leaves_no_process_e2e.py", "tests/test_a_cors_preflight_is_not_a_request_of_the_page_e2e.py", "tests/test_a_declared_webgl_extension_survives_its_use_e2e.py", "tests/test_a_granted_permission_is_the_one_the_page_asks_for_e2e.py", "tests/test_a_held_ice_port_blinds_the_loopback_checks_e2e.py", "tests/test_a_launch_without_a_session_gets_one_e2e.py", "tests/test_a_left_documents_body_is_evicted_e2e.py", "tests/test_a_mouse_click_makes_one_mousemove_on_its_point_e2e.py", "tests/test_a_page_over_ipv6_gathers_on_a_machine_declared_without_it_e2e.py", "tests/test_a_popup_is_reported_when_the_engine_says_it_is_ready_as_playwright_does_e2e.py", "tests/test_a_screenshot_draws_the_text_of_the_bundled_fonts_as_the_content_does_e2e.py", "tests/test_a_screenshot_honours_its_scale_e2e.py", "tests/test_a_served_browser_answers_a_plain_client_e2e.py", "tests/test_a_tiny_download_on_a_served_browser_is_saved_e2e.py", "tests/test_a_turn_name_over_tcp_goes_through_the_proxy_of_the_context_e2e.py", "tests/test_accept_language_on_the_wire_e2e.py", "tests/test_browser_output_is_drained.py", "tests/test_click_rhythm.py", "tests/test_closing_one_of_four_browsers_does_not_hold_the_loop_e2e.py", "tests/test_control_a_selects_all_in_a_field_e2e.py", "tests/test_cross_origin_iframe.py", "tests/test_declared_host_network_e2e.py", "tests/test_detectors_e2e.py", "tests/test_e2e.py", "tests/test_element_handle_actions.py", "tests/test_element_screenshot_e2e.py", "tests/test_every_page_draws_its_own_acts.py", "tests/test_file_chooser.py", "tests/test_fingerprint_surface.py", "tests/test_fission_frames_history_and_processes_e2e.py", "tests/test_fission_frames_workers_storage_and_special_frames_e2e.py", "tests/test_frames_outlive_the_back_forward_cache_e2e.py", "tests/test_goto_networkidle_after_spa_e2e.py", "tests/test_goto_script_redirect_e2e.py", "tests/test_hidden_display_linux.py", "tests/test_ice_names_by_the_context_proxy_e2e.py::test_the_ice_name_of_a_context_goes_by_the_proxy_of_that_context", "tests/test_ignore_https_errors_e2e.py", "tests/test_injected_node_surface.py", "tests/test_juggler_connection.py", "tests/test_juggler_posix_pipe.py", "tests/test_juggler_transport.py", "tests/test_navigation_across_processes_e2e.py", "tests/test_navigation_response.py", "tests/test_networkidle_reaches_the_client_e2e.py", "tests/test_oop_frame_element.py", "tests/test_oop_frame_geometry.py", "tests/test_page_number_follows_the_call.py", "tests/test_persistent_profile_keeps_state.py", "tests/test_pointer_position.py", "tests/test_popups_reach_the_client_e2e.py", "tests/test_preload_newtab_turns_the_privileged_about_process_off_e2e.py", "tests/test_realness_behind_a_declared_exit_e2e.py", "tests/test_resolver_race_e2e.py", "tests/test_route_header_order_e2e.py", "tests/test_same_document_goto_e2e.py", "tests/test_screencast.py", "tests/test_screencast_stop_e2e.py", "tests/test_screenshot_looks_where_you_are.py", "tests/test_security_state_engine_e2e.py", "tests/test_service_worker.py", "tests/test_service_worker_controller_e2e.py", "tests/test_set_offline_e2e.py", "tests/test_shadow_trusted_input.py", "tests/test_strict_and_force.py", "tests/test_the_callers_code_is_not_counted_e2e.py", "tests/test_the_device_enumeration_takes_the_declared_time_e2e.py", "tests/test_the_engine_is_born_in_the_job_e2e.py::test_a_launch_scans_no_process_of_the_machine", "tests/test_the_engine_is_born_in_the_job_e2e.py::test_after_close_no_process_of_the_session_is_left", "tests/test_the_hosts_file_of_the_host_is_never_read_e2e.py", "tests/test_trial_does_not_act.py", "tests/test_turn_over_tcp_is_tried_for_real_e2e.py", "tests/test_ua_widget_not_selectable.py", "tests/test_voices_e2e.py", "tests/test_wait_for_function.py", "tests/test_webgl_draws_on_the_engine_s_own_gl_e2e.py", "tests/test_webgl_noise_active.py", "tests/test_webrtc_realness.py::test_a_gateway_that_is_far_away_still_gives_the_page_a_srflx_born_through_its_relay", "tests/test_webrtc_realness.py::test_a_gather_after_the_page_loaded_through_the_gateway_costs_only_the_road_to_the_server", "tests/test_webrtc_realness.py::test_a_host_with_ipv6_addresses_gathers_through_an_ipv4_relay", "tests/test_webrtc_realness.py::test_a_proxy_that_does_not_relay_udp_gives_no_srflx_at_all", "tests/test_webrtc_realness.py::test_a_proxy_whose_relay_never_answers_gives_no_srflx_at_all", "tests/test_webrtc_realness.py::test_a_proxy_whose_udp_leaves_from_another_address_gives_no_srflx_at_all", "tests/test_webrtc_realness.py::test_not_blocked_behind_tcp_only_socks", "tests/test_webrtc_realness.py::test_the_first_candidate_of_a_gather_does_not_wait_for_a_gateway_that_is_far_away", "tests/test_webrtc_realness.py::test_the_turn_over_tcp_of_a_context_goes_through_the_proxy_of_that_context", "tests/test_webrtc_realness.py::test_Line truncated
|
||||
{"id": "wrapper.e2e.suite.linux.2", "giro": "G2", "os": ["linux"], "min_tests": 414, "exact": true, "tests": ["tests/test_a_click_waits_for_the_navigation_it_plans_e2e.py", "tests/test_a_context_init_script_runs_once_e2e.py", "tests/test_a_drag_keeps_its_buttons_pressed_e2e.py", "tests/test_a_field_is_typed_after_a_pause.py", "tests/test_a_goto_to_a_response_with_no_document_ends_e2e.py", "tests/test_a_keepalive_request_reaches_the_client_e2e.py", "tests/test_a_latin_letter_on_a_cyrillic_persona_e2e.py", "tests/test_a_page_cannot_probe_the_juggler_e2e.py", "tests/test_a_page_that_moves_on_e2e.py", "tests/test_a_pointer_event_is_handled_before_the_call_returns_e2e.py", "tests/test_a_request_says_what_it_is_e2e.py", "tests/test_a_worker_comes_back_with_its_page_from_the_cache_e2e.py", "tests/test_actions_without_a_point.py", "tests/test_add_script_tag.py", "tests/test_an_isolated_page_and_the_next_e2e.py", "tests/test_bypass_csp_e2e.py", "tests/test_caller_world_handles_e2e.py", "tests/test_canvas_reads_as_drawn.py", "tests/test_canvas_render_stealth.py", "tests/test_context_locale_e2e.py", "tests/test_context_proxy_only_resolves_by_doh_e2e.py", "tests/test_doh_through_the_proxy_e2e.py", "tests/test_doh_under_stress_e2e.py", "tests/test_download_is_intercepted_e2e.py", "tests/test_drag_motion.py", "tests/test_expose_binding_e2e.py", "tests/test_fakeweb_p4_e2e.py", "tests/test_fingerprint_consistency.py", "tests/test_fission_frames_dialogs_downloads_popups_e2e.py", "tests/test_fission_frames_route_and_bindings_e2e.py", "tests/test_fission_identity_parity_e2e.py", "tests/test_fission_iframe_crash_e2e.py", "tests/test_fission_strategy1_bench.py", "tests/test_goto_to_the_same_url_e2e.py", "tests/test_http3_through_the_proxy_e2e.py", "tests/test_input_is_born_before_the_page_sees_it_e2e.py", "tests/test_juggler_actions.py", "tests/test_juggler_event_listeners.py", "tests/test_juggler_injected.py::test_a_javascript_that_THROWS_arrives_as_an_error_not_as_None", "tests/test_juggler_injected.py::test_actionability_DISTINGUISHES_instead_of_always_saying_yes", "tests/test_juggler_injected.py::test_reads_that_make_no_sense_are_REJECTED", "tests/test_juggler_injected.py::test_states_DISCRIMINATE_instead_of_always_saying_true", "tests/test_juggler_injected.py::test_the_DOM_READING_group", "tests/test_juggler_injected.py::test_the_selector_engines_respond", "tests/test_juggler_injected.py::test_the_text_reads", "tests/test_juggler_lifecycle_e2e.py", "tests/test_key_delay_reaches_the_keyboard.py", "tests/test_keyboard_rhythm.py", "tests/test_long_session_e2e.py", "tests/test_mouse.py", "tests/test_mouse_events_keep_their_values_e2e.py", "tests/test_new_page_defaults.py", "tests/test_popup_destinations_e2e.py", "tests/test_popup_pages.py", "tests/test_proxy_http_auth_e2e.py", "tests/test_proxy_reaches_the_browser.py", "tests/test_proxy_socks_auth_e2e.py", "tests/test_requestless_navigation.py", "tests/test_route_abort_code.py", "tests/test_route_e2e.py", "tests/test_route_post_data_e2e.py", "tests/test_route_sends_a_navigation_elsewhere_e2e.py", "tests/test_route_superseded_e2e.py", "tests/test_same_document_navigation.py", "tests/test_screenshot_of_text_returns_linux_e2e.py", "tests/test_scroll_into_view.py", "tests/test_scroll_only_if_needed_e2e.py", "tests/test_service_workers_blocked.py", "tests/test_set_input_files_payloads.py", "tests/test_software_compositing_is_declared_e2e.py", "tests/test_the_association_is_ready_when_the_peerconnection_is_born_e2e.py", "tests/test_the_callers_code_runs_once_e2e.py", "tests/test_the_close_returns_when_the_browser_has_exited_e2e.py", "tests/test_the_favicon_stays_out_of_sight_e2e.py", "tests/test_the_font_list_is_the_bundle_e2e.py", "tests/test_the_parent_reads_the_bundle_from_fontconfig_s_cache_linux_e2e.py", "tests/test_the_scheme_is_the_personas_e2e.py", "tests/test_the_whole_udp_chain_by_name_e2e.py::test_a_turn_srflx_by_name_arrives_through_the_relay_when_the_exit_of_the_lab_is_loopback", "tests/test_typing_a_character_without_a_key_e2e.py", "tests/test_wait_for_timeout.py", "tests/test_web_fonts_of_closed_contexts_e2e.py"], "marker": "e2e", "needs_root": false, "windows_twin": "wrapper.e2e.suite.windows.2", "note": "Part 2 of the whole e2e suite of the wrapper (every test that opens the browser: what e2e.yml runs on the published engine), on the engine under test, as two passes through scripts/ci_suite_run.py (4 browsers at once, then the wall_clock tests alone; no rerun). The files of the 2 rows of linux are the files of tests/ that tests/test_the_e2e_suite_is_accounted_for.py holds one by one: a file whole when every test of it is here, else its tests by name. Partition from the junits of runs 44942540063 and 44985244053, test time balanced (about 564 s of estimated wall time, 4 browsers). A new file is added by hand to a row of each system and the minimum of the row goes up by hand. Left out of every row, with the reason in the accounting test: the files and tests of wrapLine truncated
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
"""Does a change have anything for a heavy workflow to test? The job `changes` of e2e.yml and of fakeweb.yml.
|
||||
|
||||
python scripts/ci_changes.py <e2e|fakeweb> <github.event_name> [BASE_SHA HEAD_SHA]
|
||||
|
||||
GitHub applies no `paths` filter to a merge queue run (`merge_group`), so without this a docs-only change would run the whole e2e and the whole fake web in
|
||||
the queue. In a queue run this lists the files that differ between the base and the head of the entry (`github.event.merge_group.base_sha` and
|
||||
`head_sha`) and applies the path rules the `push` trigger of the same workflow has, so the queue and main agree on what is worth a run:
|
||||
|
||||
e2e `paths-ignore`: a change runs it unless EVERY file matches IGNORE (`**.md`, `docs/**`, `LICENSE`);
|
||||
fakeweb `paths`: a change runs it only if SOME file matches ONLY (the fake web, its report, the pin, its workflow).
|
||||
|
||||
On any other event (push and workflow_dispatch: a push was already filtered by GitHub, a dispatch is a person asking) the answer is always `run=true`.
|
||||
|
||||
Prints `run=true|false` and `files=<n>` (the lines go to $GITHUB_OUTPUT). `run=false` is an explicit answer, "nothing to test": the verdict job of the workflow
|
||||
(scripts/ci_gate.py) then expects every other job `skipped` and says so in its last line; it is never a skip the verdict waves through. A change that cannot be
|
||||
listed (a commit that cannot be fetched) is an error: the job is red, and so is the verdict. A change that lists no file at all cannot be told from a broken
|
||||
diff, so it runs.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
# e2e.yml `on.push.paths-ignore`: a change of only these files is not a change the browsers can observe (tests/test_the_workflows_are_ready_for_the_merge_queue.py
|
||||
# holds this table equal to the filter of the workflow).
|
||||
IGNORE = {
|
||||
"e2e": ("**.md", "docs/**", "LICENSE"),
|
||||
}
|
||||
# fakeweb.yml `on.push.paths`.
|
||||
ONLY = {
|
||||
"fakeweb": (
|
||||
"tests/fakeweb/**",
|
||||
"tests/test_fakeweb_*.py",
|
||||
"scripts/run_fakeweb.py",
|
||||
"scripts/fakeweb_p4_report.py",
|
||||
"scripts/playwright_pin.txt",
|
||||
".github/workflows/fakeweb.yml",
|
||||
),
|
||||
}
|
||||
WORKFLOWS = tuple(sorted(set(IGNORE) | set(ONLY)))
|
||||
|
||||
|
||||
def glob_regex(pattern: str) -> "re.Pattern[str]":
|
||||
"""A path filter of a workflow as a regular expression: `**` is any characters, `*` any characters but `/`, `?` one character but `/`."""
|
||||
out = []
|
||||
i = 0
|
||||
while i < len(pattern):
|
||||
if pattern.startswith("**", i):
|
||||
out.append(".*")
|
||||
i += 2
|
||||
continue
|
||||
char = pattern[i]
|
||||
out.append("[^/]*" if char == "*" else "[^/]" if char == "?" else re.escape(char))
|
||||
i += 1
|
||||
return re.compile("".join(out) + r"\Z")
|
||||
|
||||
|
||||
def matches(path: str, patterns) -> bool:
|
||||
return any(glob_regex(p).match(path) for p in patterns)
|
||||
|
||||
|
||||
def should_run(workflow: str, files: list) -> bool:
|
||||
"""Is there something in `files` (the paths a change touches) for `workflow` to test?"""
|
||||
if workflow not in WORKFLOWS:
|
||||
raise ValueError("unknown workflow %r (one of %s)" % (workflow, ", ".join(WORKFLOWS)))
|
||||
if not files:
|
||||
return True
|
||||
if workflow in IGNORE:
|
||||
return any(not matches(f, IGNORE[workflow]) for f in files)
|
||||
return any(matches(f, ONLY[workflow]) for f in files)
|
||||
|
||||
|
||||
def changed_files(base: str, head: str, run=subprocess.run) -> list:
|
||||
"""The files that differ between the base and the head of a queue entry (fetched when the shallow checkout does not have them)."""
|
||||
for sha in (base, head):
|
||||
if run(["git", "cat-file", "-e", sha + "^{commit}"], capture_output=True, text=True).returncode != 0:
|
||||
run(["git", "fetch", "--no-tags", "--depth=1", "origin", sha], check=True, capture_output=True, text=True)
|
||||
done = run(["git", "diff", "--name-only", base, head], check=True, capture_output=True, text=True)
|
||||
return [line.strip() for line in done.stdout.splitlines() if line.strip()]
|
||||
|
||||
|
||||
def main(argv=None) -> int:
|
||||
args = sys.argv[1:] if argv is None else argv
|
||||
if len(args) not in (2, 4) or args[0] not in WORKFLOWS:
|
||||
print("usage: ci_changes.py <%s> EVENT_NAME [BASE_SHA HEAD_SHA]" % "|".join(WORKFLOWS), file=sys.stderr)
|
||||
return 2
|
||||
workflow, event = args[0], args[1]
|
||||
sys.stdout.reconfigure(newline="\n") # the lines go to $GITHUB_OUTPUT: a carriage return would be part of the value
|
||||
if event != "merge_group":
|
||||
print("%s: %s is not a merge queue run, it always runs" % (workflow, event or "no event"), file=sys.stderr)
|
||||
print("run=true")
|
||||
print("files=0")
|
||||
return 0
|
||||
if len(args) != 4 or not args[2] or not args[3]:
|
||||
print("FAIL changes: a merge queue run without the base and the head of its entry. Fix: pass github.event.merge_group.base_sha and head_sha", file=sys.stderr)
|
||||
return 2
|
||||
files = changed_files(args[2], args[3])
|
||||
run = should_run(workflow, files)
|
||||
print("%s: %d files changed, %s" % (workflow, len(files), "something to test" if run else "none under its paths: nothing to test"), file=sys.stderr)
|
||||
for name in files[:20]:
|
||||
print(" " + name, file=sys.stderr)
|
||||
print("run=%s" % ("true" if run else "false"))
|
||||
print("files=%d" % len(files))
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
@@ -0,0 +1,193 @@
|
||||
"""The verdict job of a workflow that gates a merge: every job it waits for must have ended in `success`.
|
||||
|
||||
NEEDS='<toJSON(needs)>' EVENT_NAME=<github.event_name> WORKFLOW=<tests|e2e|fakeweb> [CHANGES_RUN=<needs.changes.outputs.run>] python scripts/ci_gate.py
|
||||
|
||||
Three workflows have one: the job `gate` of tests.yml, `e2e verdict` of e2e.yml and `fakeweb verdict` of fakeweb.yml. WORKFLOW (default `tests`) picks
|
||||
the tables that belong to the workflow. A pull request runs the fast set (tests.yml); e2e.yml and fakeweb.yml run in the merge queue run
|
||||
(`merge_group`), and that run decides. `gate` is the one context main requires on a pull request.
|
||||
|
||||
Rule ci-13: nothing counts as passed that did not pass, so `skipped`, `cancelled` and `failure` are all red. A job that was skipped ran nothing: when
|
||||
`unit` was skipped for a core that was not on the index, the old gate said "ok".
|
||||
|
||||
The only jobs that may end in something else than `success` are the ones that are conditional BY DESIGN, and each says when:
|
||||
|
||||
* CONDITIONAL: the events on which the job runs; on any other event it is expected to be `skipped`, and on those events it must be `success`;
|
||||
* E2E_BY_OUTPUT: a job that runs only when another job of the workflow says so by an output (the final-seed shards, when the page oracle is touched);
|
||||
* E2E_NARROWED: what `workflow_dispatch` with `only: windows-control-a` leaves out on purpose (that run is the Windows job of one shortcut alone).
|
||||
|
||||
* NOTHING TO TEST: e2e.yml and fakeweb.yml start with the job `changes` (scripts/ci_changes.py: in a merge queue run, do the files of the entry fall under the
|
||||
paths of the workflow?). Its output `run` comes in as CHANGES_RUN. `run=false` is an explicit answer: `changes` must be `success` and every other job
|
||||
`skipped` (a job that ran anyway is red, so is one that is `success` here), and the verdict ends with `ok: nothing to test (<n> files changed, none under the
|
||||
paths of <workflow>)`. `run=true`: every job as above. A `run` that is missing or is not `true` or `false` is red: nothing is judged on a guess.
|
||||
|
||||
Nothing else is forgiven, and a job the workflow waits for that the table does not know is red as well (the table and the `needs:` of the verdict job
|
||||
cannot drift apart without tests/test_the_gate_is_red_when_a_needed_job_is_skipped.py and tests/test_the_workflows_are_ready_for_the_merge_queue.py
|
||||
saying so).
|
||||
|
||||
Prints one line per job that is not as expected, `FAIL <verdict job>: job <name> is <result>. Fix: <how>. Rule: ci-13 ...`, and exits 1; prints `ok` and
|
||||
exits 0 when every job is.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
|
||||
RULE = "ci-13 nothing counts as passed that did not pass"
|
||||
|
||||
_CHANGES = "open the job `changes` and fix scripts/ci_changes.py (or the diff it lists): it must succeed and print run=true|false"
|
||||
_CORE = "wait for the publish of the pinned invisible-core to finish, or pin a published core, then re-run"
|
||||
|
||||
# tests.yml: the jobs `gate` waits for, each with what to do when it is not green.
|
||||
FIX = {
|
||||
"core-on-index": _CORE,
|
||||
"unit": "open the job pytest of the failing system and fix its test; when it is skipped, fix the job it needs (core-on-index) first",
|
||||
"docs-api": "open the job and fix the guide that names an API that does not exist; when it is skipped, fix core-on-index first",
|
||||
"english": "open the job and translate the lines it names; when it is skipped, fix core-on-index first",
|
||||
"claims": "open the job and fix the README sentence no measurement supports; when it is skipped, fix core-on-index first",
|
||||
"way-in": "open the job and make the install instruction uv; when it is skipped, fix core-on-index first",
|
||||
"install-job": "open the job and fix the user-install workflow; when it is skipped, fix core-on-index first",
|
||||
"noreply-identity": "open the job and rewrite the commit or tag whose email is not a GitHub noreply address",
|
||||
"version": "bump the version in pyproject.toml: the one this change proposes is already published",
|
||||
}
|
||||
|
||||
# Conditional by design: job -> the events on which it runs. On any other event it must be `skipped`.
|
||||
CONDITIONAL = {
|
||||
# `version` runs where a change is proposed: on a pull request and in the merge queue run (it compares the version the change proposes with the
|
||||
# published one, so it must run in the queue too). On main straight after a release the version IS the published one until somebody bumps, and a
|
||||
# check that is red at rest is one people learn to skip. So a push to main skips it on purpose.
|
||||
"version": ("pull_request", "merge_group"),
|
||||
}
|
||||
|
||||
# e2e.yml: the jobs `e2e verdict` waits for.
|
||||
E2E_FIX = {
|
||||
"changes": _CHANGES,
|
||||
"core-on-index": _CORE,
|
||||
"linux-deps-e2e": "open the job linux-deps-e2e and fix the package list of the Linux jobs; when it is skipped, fix core-on-index first",
|
||||
"e2e-linux": "open the failing part of `e2e (linux, part N)` and fix its test; when it is skipped, fix core-on-index or linux-deps-e2e first",
|
||||
"e2e": "open the job `e2e (linux, xvfb)`: one of the three Linux parts did not pass",
|
||||
"e2e-windows-control-a": "open the job `e2e (windows, Control+A)` and fix the shortcut test",
|
||||
"e2e-windows": "open the failing part of `e2e (windows, part N)` and fix its test; when it is skipped, fix core-on-index first",
|
||||
"e2e-network": "open the job of the network oracle on Linux and fix its test; when it is skipped, fix core-on-index or linux-deps-e2e first",
|
||||
"e2e-network-windows": "open the job of the network oracle on Windows and fix its test; when it is skipped, fix core-on-index first",
|
||||
"e2e-host": "open the job of the host oracle on Linux and fix its test; when it is skipped, fix core-on-index or linux-deps-e2e first",
|
||||
"e2e-host-windows": "open the job of the host oracle on Windows and fix its test; when it is skipped, fix core-on-index first",
|
||||
"e2e-page": "open the job of the page oracle on Linux and fix its test; when it is skipped, fix core-on-index or linux-deps-e2e first",
|
||||
"e2e-page-windows": "open the job of the page oracle on Windows and fix its test; when it is skipped, fix core-on-index first",
|
||||
"e2e-page-final-touched": "open the job and fix scripts/ci_ab_oracle.py touched: in the merge queue run it must print touched=true|false",
|
||||
"e2e-page-final": "open the failing shard of the page oracle on the final seeds (linux) and fix its test; when it is skipped, fix the job that decides it",
|
||||
"e2e-page-final-windows": "open the failing shard of the page oracle on the final seeds (windows) and fix its test; when it is skipped, fix the job that decides it",
|
||||
}
|
||||
E2E_CONDITIONAL = {
|
||||
# The base of the change is the one of the merge queue entry (`github.event.merge_group.base_sha`): the job runs there and nowhere else.
|
||||
"e2e-page-final-touched": ("merge_group",),
|
||||
}
|
||||
# A job that runs only when another job says so: job -> (the job that decides, its output, the value that makes it run). Otherwise it is `skipped`.
|
||||
E2E_BY_OUTPUT = {
|
||||
"e2e-page-final": ("e2e-page-final-touched", "touched", "true"),
|
||||
"e2e-page-final-windows": ("e2e-page-final-touched", "touched", "true"),
|
||||
}
|
||||
# What `workflow_dispatch` with `only: windows-control-a` skips on purpose: every job but the two that run it.
|
||||
E2E_NARROWED = tuple(sorted(set(E2E_FIX) - {"changes", "core-on-index", "e2e-windows-control-a"}))
|
||||
|
||||
# fakeweb.yml: every job runs on every event the workflow listens to.
|
||||
FAKEWEB_FIX = {
|
||||
"changes": _CHANGES,
|
||||
"core-on-index": _CORE,
|
||||
"linux-deps-fakeweb": "open the job linux-deps-fakeweb and fix the package list; when it is skipped, fix core-on-index first",
|
||||
"walk": "open the failing leg (`fakeweb p2` or `p4`, on linux or windows) and fix what differs from stock; when it is skipped, fix core-on-index first",
|
||||
}
|
||||
|
||||
# The workflows that start with the job `changes`, and the name of that job.
|
||||
CHANGES_JOB = "changes"
|
||||
HAS_CHANGES = ("e2e", "fakeweb")
|
||||
|
||||
# WORKFLOW -> (the name of the verdict job, its FIX table, its CONDITIONAL table).
|
||||
TABLES = {
|
||||
"tests": ("gate", FIX, CONDITIONAL),
|
||||
"e2e": ("e2e verdict", E2E_FIX, E2E_CONDITIONAL),
|
||||
"fakeweb": ("fakeweb verdict", FAKEWEB_FIX, {}),
|
||||
}
|
||||
|
||||
|
||||
def expected_result(name: str, needs: dict, event: str, workflow: str = "tests", only: str = "", changes_run: str = "true") -> str:
|
||||
"""`success`, or `skipped` for a job that is conditional by design on this event (or on this input, or on the output of another job, or because
|
||||
`changes` said there is nothing to test)."""
|
||||
conditional = TABLES[workflow][2]
|
||||
if workflow in HAS_CHANGES and name != CHANGES_JOB and changes_run == "false":
|
||||
return "skipped"
|
||||
if workflow == "e2e":
|
||||
if only == "windows-control-a" and name in E2E_NARROWED:
|
||||
return "skipped"
|
||||
if name in E2E_BY_OUTPUT:
|
||||
decider, output, value = E2E_BY_OUTPUT[name]
|
||||
entry = needs.get(decider)
|
||||
outputs = entry.get("outputs") if isinstance(entry, dict) else None
|
||||
ran = isinstance(outputs, dict) and outputs.get(output) == value
|
||||
return "success" if ran else "skipped"
|
||||
if name in conditional and event not in conditional[name]:
|
||||
return "skipped"
|
||||
return "success"
|
||||
|
||||
|
||||
def nothing_to_test(needs: dict, workflow: str) -> str:
|
||||
"""The last line of a verdict whose `changes` job said there is nothing to test."""
|
||||
entry = needs.get(CHANGES_JOB)
|
||||
outputs = entry.get("outputs") if isinstance(entry, dict) else None
|
||||
files = outputs.get("files") if isinstance(outputs, dict) else None
|
||||
count = files if isinstance(files, str) and files.isdigit() else "?"
|
||||
return "ok: nothing to test (%s files changed, none under the paths of %s)" % (count, workflow)
|
||||
|
||||
|
||||
def verdict(needs: dict, event: str, workflow: str = "tests", only: str = "", changes_run: "str | None" = None) -> list[str]:
|
||||
"""The FAIL lines for the results of `needs` (the object `toJSON(needs)` gives) of `workflow` on `event`; empty when every job is as expected.
|
||||
`changes_run` is the output `run` of the job `changes` (workflows that have one): `true` or `false`, anything else is red."""
|
||||
label, fix, _conditional = TABLES[workflow]
|
||||
out = []
|
||||
if workflow in HAS_CHANGES:
|
||||
if changes_run not in ("true", "false"):
|
||||
return ["FAIL %s: the output run of the job changes is %r, not true or false. Fix: pass CHANGES_RUN=${{ needs.changes.outputs.run }} and make the job changes print "
|
||||
"run=true|false. Rule: %s" % (label, "missing" if changes_run in (None, "") else changes_run, RULE)]
|
||||
else:
|
||||
changes_run = "true"
|
||||
for name in sorted(set(fix) | set(needs)):
|
||||
entry = needs.get(name)
|
||||
result = entry.get("result") if isinstance(entry, dict) else None
|
||||
if name not in fix:
|
||||
out.append(
|
||||
"FAIL %s: job %s is %s. Fix: add it to the table of %s in scripts/ci_gate.py, or take it out of `needs:` of the job %s. Rule: %s"
|
||||
% (label, name, result, workflow, label, RULE))
|
||||
elif result != expected_result(name, needs, event, workflow, only, changes_run):
|
||||
out.append("FAIL %s: job %s is %s. Fix: %s. Rule: %s" % (label, name, result or "missing", fix[name], RULE))
|
||||
return out
|
||||
|
||||
|
||||
def main() -> int:
|
||||
workflow = os.environ.get("WORKFLOW", "") or "tests"
|
||||
if workflow not in TABLES:
|
||||
print("FAIL gate: WORKFLOW is %r, not one of %s. Fix: pass WORKFLOW=tests, e2e or fakeweb. Rule: %s" % (workflow, "|".join(sorted(TABLES)), RULE))
|
||||
return 1
|
||||
label = TABLES[workflow][0]
|
||||
try:
|
||||
needs = json.loads(os.environ.get("NEEDS", ""))
|
||||
if not isinstance(needs, dict):
|
||||
raise ValueError("not an object")
|
||||
except ValueError as exc:
|
||||
print("FAIL %s: the results of the needed jobs cannot be read (%s). Fix: pass NEEDS=${{ toJSON(needs) }}. Rule: %s" % (label, exc, RULE))
|
||||
return 1
|
||||
event = os.environ.get("EVENT_NAME", "")
|
||||
for name in sorted(needs):
|
||||
entry = needs[name]
|
||||
print("%-24s %s" % (name + ":", entry.get("result") if isinstance(entry, dict) else entry))
|
||||
changes_run = os.environ.get("CHANGES_RUN")
|
||||
lines = verdict(needs, event, workflow, os.environ.get("INPUT_ONLY", ""), changes_run)
|
||||
for line in lines:
|
||||
print(line)
|
||||
if lines:
|
||||
return 1
|
||||
print(nothing_to_test(needs, workflow) if workflow in HAS_CHANGES and changes_run == "false" else "ok")
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
@@ -0,0 +1,384 @@
|
||||
"""A docs-only change runs nothing heavy in the merge queue, and "nothing to test" is an explicit success the verdict knows.
|
||||
|
||||
GitHub applies no `paths` filter to a merge queue run (`merge_group`), so e2e.yml and fakeweb.yml would run in full for a change to a Markdown file. Both
|
||||
workflows now start with the job `changes` (scripts/ci_changes.py): in a queue run it lists the files between `github.event.merge_group.base_sha` and
|
||||
`head_sha` and applies the path rules the `push` trigger of the same workflow has (e2e: `paths-ignore` of `**.md`, `docs/**`, `LICENSE`; fakeweb: its
|
||||
`paths`); on push and workflow_dispatch it always says run=true. Every other job needs `changes` and runs only on `needs.changes.outputs.run == 'true'`.
|
||||
|
||||
That is NOT a skip the verdict waves through: scripts/ci_gate.py gets the output as CHANGES_RUN, and
|
||||
|
||||
* run=false: `changes` is success, every other job is `skipped` (one that ran anyway is red), and the verdict ends with
|
||||
`ok: nothing to test (<n> files changed, none under the paths of <workflow>)`;
|
||||
* run=true: every job is `success`, a skipped one is red;
|
||||
* a CHANGES_RUN that is missing or is not true or false is red, and so is a `changes` job that did not succeed.
|
||||
|
||||
Known-bad inputs: a heavy job that ran when there was nothing to test, a heavy job skipped when there was something to test, no output at all.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import importlib.util
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
pytestmark = pytest.mark.unit
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
WORKFLOWS = ROOT / ".github" / "workflows"
|
||||
|
||||
|
||||
def _load(name: str):
|
||||
spec = importlib.util.spec_from_file_location(name + "_for_changes", ROOT / "scripts" / (name + ".py"))
|
||||
module = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(module)
|
||||
return module
|
||||
|
||||
|
||||
ci_changes = _load("ci_changes")
|
||||
ci_gate = _load("ci_gate")
|
||||
CHANGES = ROOT / "scripts" / "ci_changes.py"
|
||||
GATE = ROOT / "scripts" / "ci_gate.py"
|
||||
HEAVY = ("e2e", "fakeweb")
|
||||
RULE = "Rule: ci-13 nothing counts as passed that did not pass"
|
||||
|
||||
# ------------------------------------------------------------------------------ the path rules
|
||||
|
||||
|
||||
@pytest.mark.parametrize("files", [
|
||||
["README.md"],
|
||||
["docs/ARCHITECTURE.md"],
|
||||
["docs/diagram.png"],
|
||||
["docs/deep/er/file.txt"],
|
||||
["LICENSE"],
|
||||
["src/invisible_playwright/NOTES.md"],
|
||||
["README.md", "docs/a.png", "LICENSE"],
|
||||
])
|
||||
def test_a_docs_only_change_gives_run_false_for_both_workflows(files):
|
||||
assert ci_changes.should_run("e2e", files) is False
|
||||
assert ci_changes.should_run("fakeweb", files) is False
|
||||
|
||||
|
||||
@pytest.mark.parametrize("files", [
|
||||
["src/invisible_playwright/launcher.py"],
|
||||
["tests/test_a_launch_has_one_deadline.py"],
|
||||
["README.md", "src/invisible_playwright/launcher.py"],
|
||||
["docs/a.md", "tests/test_something_e2e.py"],
|
||||
["pyproject.toml"],
|
||||
["scripts/ci_gate.py"],
|
||||
[".github/workflows/e2e.yml"],
|
||||
["LICENSE.txt"],
|
||||
])
|
||||
def test_a_change_to_a_test_or_to_src_gives_run_true_for_e2e(files):
|
||||
assert ci_changes.should_run("e2e", files) is True
|
||||
|
||||
|
||||
@pytest.mark.parametrize("path", [
|
||||
"tests/fakeweb/pages.json",
|
||||
"tests/fakeweb/deep/er/site.py",
|
||||
"tests/test_fakeweb_p4_report.py",
|
||||
"tests/test_fakeweb_p2_e2e.py",
|
||||
"scripts/run_fakeweb.py",
|
||||
"scripts/fakeweb_p4_report.py",
|
||||
"scripts/playwright_pin.txt",
|
||||
".github/workflows/fakeweb.yml",
|
||||
])
|
||||
def test_a_fake_web_file_gives_run_true_for_fakeweb(path):
|
||||
assert ci_changes.should_run("fakeweb", [path]) is True
|
||||
assert ci_changes.should_run("fakeweb", ["docs/a.md", path]) is True
|
||||
|
||||
|
||||
@pytest.mark.parametrize("path", [
|
||||
"src/invisible_playwright/launcher.py",
|
||||
"tests/test_a_launch_has_one_deadline.py",
|
||||
"tests/fakewebs/other.py",
|
||||
"tests/sub/test_fakeweb_x.py",
|
||||
"scripts/run_fakeweb.pyc",
|
||||
"README.md",
|
||||
])
|
||||
def test_a_file_that_is_not_the_fake_web_gives_run_false_for_fakeweb(path):
|
||||
assert ci_changes.should_run("fakeweb", [path]) is False
|
||||
|
||||
|
||||
def test_a_change_that_lists_no_file_runs_because_it_cannot_be_told_from_a_broken_diff():
|
||||
assert ci_changes.should_run("e2e", []) is True
|
||||
assert ci_changes.should_run("fakeweb", []) is True
|
||||
|
||||
|
||||
def test_an_unknown_workflow_is_an_error():
|
||||
with pytest.raises(ValueError):
|
||||
ci_changes.should_run("tests", ["README.md"])
|
||||
|
||||
|
||||
def _push_block(workflow_file: str) -> str:
|
||||
text = (WORKFLOWS / workflow_file).read_text(encoding="utf-8")
|
||||
on = re.search(r"^on:\s*\n(.*?)(?=^\S)", text, re.M | re.S).group(1)
|
||||
code = "\n".join(line for line in on.splitlines() if not line.lstrip().startswith("#"))
|
||||
return re.search(r"^ push:\s*\n(.*?)(?=^ \S|\Z)", code + "\n", re.M | re.S).group(1)
|
||||
|
||||
|
||||
def test_the_tables_are_the_path_filters_of_the_push_triggers():
|
||||
ignore = re.findall(r"- '([^']+)'", _push_block("e2e.yml").split("paths-ignore:", 1)[1])
|
||||
assert tuple(ignore) == ci_changes.IGNORE["e2e"]
|
||||
only = re.findall(r"- '([^']+)'", _push_block("fakeweb.yml").split("paths:", 1)[1])
|
||||
assert tuple(only) == ci_changes.ONLY["fakeweb"]
|
||||
|
||||
|
||||
# ------------------------------------------------------------------------------ the script on events and on a real diff
|
||||
|
||||
|
||||
def _changes(*args: str, cwd=ROOT) -> subprocess.CompletedProcess:
|
||||
return subprocess.run([sys.executable, str(CHANGES), *args], cwd=str(cwd), capture_output=True, text=True, timeout=60)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("event", ["push", "workflow_dispatch", "schedule", ""])
|
||||
@pytest.mark.parametrize("workflow", HEAVY)
|
||||
def test_a_push_and_a_dispatch_always_run(workflow, event):
|
||||
done = _changes(workflow, event)
|
||||
assert done.returncode == 0 and done.stdout.splitlines() == ["run=true", "files=0"], (done.stdout, done.stderr)
|
||||
|
||||
|
||||
def test_a_queue_run_without_its_commits_is_an_error():
|
||||
assert _changes("e2e", "merge_group").returncode == 2
|
||||
assert _changes("e2e", "merge_group", "", "").returncode == 2
|
||||
assert _changes("nope", "push").returncode == 2
|
||||
|
||||
|
||||
def _git(cwd, *args: str) -> str:
|
||||
done = subprocess.run(["git", "-c", "user.name=t", "-c", "user.email=t@users.noreply.github.com", "-c", "commit.gpgsign=false", *args],
|
||||
cwd=str(cwd), capture_output=True, text=True, timeout=60, check=True)
|
||||
return done.stdout.strip()
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
def repo(tmp_path):
|
||||
_git(tmp_path, "init", "-q")
|
||||
(tmp_path / "src").mkdir()
|
||||
(tmp_path / "docs").mkdir()
|
||||
(tmp_path / "src" / "a.py").write_text("a = 1\n")
|
||||
(tmp_path / "README.md").write_text("one\n")
|
||||
_git(tmp_path, "add", "-A")
|
||||
_git(tmp_path, "commit", "-q", "-m", "base")
|
||||
return tmp_path
|
||||
|
||||
|
||||
def _entry(repo, files: dict) -> tuple:
|
||||
base = _git(repo, "rev-parse", "HEAD")
|
||||
for name, text in files.items():
|
||||
path = repo / name
|
||||
path.parent.mkdir(parents=True, exist_ok=True)
|
||||
path.write_text(text)
|
||||
_git(repo, "add", "-A")
|
||||
_git(repo, "commit", "-q", "-m", "change")
|
||||
return base, _git(repo, "rev-parse", "HEAD")
|
||||
|
||||
|
||||
def test_a_queue_entry_that_changes_only_markdown_says_run_false_and_the_count(repo):
|
||||
base, head = _entry(repo, {"README.md": "two\n", "docs/new.md": "x\n", "docs/pic.png": "y\n"})
|
||||
for workflow in HEAVY:
|
||||
done = _changes(workflow, "merge_group", base, head, cwd=repo)
|
||||
assert done.returncode == 0 and done.stdout.splitlines() == ["run=false", "files=3"], (workflow, done.stdout, done.stderr)
|
||||
|
||||
|
||||
def test_a_queue_entry_that_changes_src_says_run_true_for_e2e_and_false_for_fakeweb(repo):
|
||||
base, head = _entry(repo, {"src/a.py": "a = 2\n"})
|
||||
assert _changes("e2e", "merge_group", base, head, cwd=repo).stdout.splitlines() == ["run=true", "files=1"]
|
||||
assert _changes("fakeweb", "merge_group", base, head, cwd=repo).stdout.splitlines() == ["run=false", "files=1"]
|
||||
|
||||
|
||||
def test_a_queue_entry_that_changes_a_fake_web_file_says_run_true_for_fakeweb(repo):
|
||||
base, head = _entry(repo, {"tests/fakeweb/pages.json": "{}\n"})
|
||||
assert _changes("fakeweb", "merge_group", base, head, cwd=repo).stdout.splitlines() == ["run=true", "files=1"]
|
||||
|
||||
|
||||
def test_a_commit_that_cannot_be_listed_fails_the_job_instead_of_guessing(repo):
|
||||
done = _changes("e2e", "merge_group", "0" * 40, "1" * 40, cwd=repo)
|
||||
assert done.returncode != 0 and "run=" not in done.stdout
|
||||
|
||||
|
||||
# ------------------------------------------------------------------------------ the workflows
|
||||
|
||||
|
||||
def _text(name: str) -> str:
|
||||
return (WORKFLOWS / name).read_text(encoding="utf-8")
|
||||
|
||||
|
||||
def _jobs(text: str) -> dict:
|
||||
body = text.split("\njobs:\n", 1)[1]
|
||||
ids = list(re.finditer(r"^ ([A-Za-z0-9_-]+):\s*$", body, re.M))
|
||||
return {m.group(1): body[m.end(): ids[i + 1].start() if i + 1 < len(ids) else len(body)] for i, m in enumerate(ids)}
|
||||
|
||||
|
||||
def _needs(job_text: str) -> list:
|
||||
flow = re.search(r"^ needs: \[([^\]]*)\]\s*$", job_text, re.M)
|
||||
if flow:
|
||||
return [n.strip() for n in flow.group(1).split(",") if n.strip()]
|
||||
one = re.search(r"^ needs: ([A-Za-z0-9_-]+)\s*$", job_text, re.M)
|
||||
return [one.group(1)] if one else []
|
||||
|
||||
|
||||
def problems_changes(name: str, text: str) -> list:
|
||||
workflow = name.split(".")[0]
|
||||
out = []
|
||||
jobs = _jobs(text)
|
||||
if list(jobs)[0:1] != ["changes"]:
|
||||
return ["%s: the first job is not `changes`: %s" % (name, list(jobs)[:1])]
|
||||
body = jobs["changes"]
|
||||
if _needs(body):
|
||||
out.append("%s: `changes` needs %s: it must be the first job and wait for nothing" % (name, _needs(body)))
|
||||
if not re.search(r"^ run: \$\{\{ steps\.changes\.outputs\.run \}\}\s*$", body, re.M):
|
||||
out.append("%s: `changes` has no output `run`" % name)
|
||||
if not re.search(r"^ files: \$\{\{ steps\.changes\.outputs\.files \}\}\s*$", body, re.M):
|
||||
out.append("%s: `changes` has no output `files`" % name)
|
||||
if 'git show origin/main:scripts/ci_changes.py > "$RUNNER_TEMP/ci_changes.py"' not in body or "refs/heads/main:refs/remotes/origin/main" not in body:
|
||||
out.append("%s: `changes` does not read scripts/ci_changes.py from origin/main: a branch could decide that it needs no test" % name)
|
||||
if "ci_changes.py is not on origin/main yet: falling back to the copy of this branch" not in body:
|
||||
out.append("%s: `changes` falls back to the branch copy without saying so" % name)
|
||||
if not re.search(r'^ +python3 "\$RUNNER_TEMP/ci_changes\.py" %s "\$EVENT_NAME" "\$BASE_SHA" "\$HEAD_SHA" \| tee -a "\$GITHUB_OUTPUT"\s*$' % workflow, body, re.M):
|
||||
out.append("%s: `changes` does not run the copy it read from main with the workflow, the event and the two commits" % name)
|
||||
if "BASE_SHA: ${{ github.event.merge_group.base_sha }}" not in body or "HEAD_SHA: ${{ github.event.merge_group.head_sha }}" not in body:
|
||||
out.append("%s: `changes` does not read the base and the head of the queue entry" % name)
|
||||
if not re.search(r"^ shell: bash\s*$", body, re.M):
|
||||
out.append("%s: the step of `changes` has no `shell: bash` (the pipe to tee would hide a failure of the script: no pipefail)" % name)
|
||||
for job, text_ in jobs.items():
|
||||
if job in ("changes", "verdict"):
|
||||
continue
|
||||
if "changes" not in _needs(text_):
|
||||
out.append("%s: job %s does not need `changes`" % (name, job))
|
||||
cond = re.search(r"^ if: (.*)$", text_, re.M)
|
||||
if not cond or "needs.changes.outputs.run == 'true'" not in cond.group(1):
|
||||
out.append("%s: job %s does not run only on `needs.changes.outputs.run == 'true'`" % (name, job))
|
||||
verdict = jobs["verdict"]
|
||||
if "changes" not in _needs(verdict):
|
||||
out.append("%s: the verdict does not need `changes`" % name)
|
||||
if not re.search(r"^ +CHANGES_RUN: \$\{\{ needs\.changes\.outputs\.run \}\}\s*$", verdict, re.M):
|
||||
out.append("%s: the verdict does not pass CHANGES_RUN" % name)
|
||||
return out
|
||||
|
||||
|
||||
@pytest.mark.parametrize("name", ["e2e.yml", "fakeweb.yml"])
|
||||
def test_the_workflow_starts_with_changes_and_every_other_job_waits_for_its_answer(name):
|
||||
assert problems_changes(name, _text(name)) == []
|
||||
|
||||
|
||||
def test_a_workflow_that_forgets_changes_somewhere_is_refused():
|
||||
e2e = _text("e2e.yml")
|
||||
host = _jobs(e2e)["e2e-host"]
|
||||
assert any("job e2e-host does not need" in p for p in problems_changes("e2e.yml", e2e.replace(host, host.replace("needs: [changes, ", "needs: [", 1), 1)))
|
||||
no_if = e2e.replace(" if: needs.changes.outputs.run == 'true'\n uses: ./.github/workflows/core-on-index.yml", " uses: ./.github/workflows/core-on-index.yml", 1)
|
||||
assert no_if != e2e and any("job core-on-index does not run only on" in p for p in problems_changes("e2e.yml", no_if))
|
||||
fake = _text("fakeweb.yml")
|
||||
assert any("CHANGES_RUN" in p for p in problems_changes("fakeweb.yml", fake.replace("CHANGES_RUN: ${{ needs.changes.outputs.run }}", "X: 1", 1)))
|
||||
assert any("from origin/main" in p for p in problems_changes("fakeweb.yml", fake.replace('git show origin/main:scripts/ci_changes.py > "$RUNNER_TEMP/ci_changes.py"', "true", 1)))
|
||||
assert any("pipefail" in p for p in problems_changes("fakeweb.yml", fake.replace(" shell: bash\n env:\n EVENT_NAME", " env:\n EVENT_NAME", 1)))
|
||||
|
||||
|
||||
# ------------------------------------------------------------------------------ the verdict
|
||||
|
||||
|
||||
def _all_run(workflow: str) -> dict:
|
||||
"""Every job of the workflow as it ends when there was something to test."""
|
||||
needs = {name: {"result": "success", "outputs": {}} for name in ci_gate.TABLES[workflow][1]}
|
||||
needs["changes"]["outputs"] = {"run": "true", "files": "4"}
|
||||
if workflow == "e2e":
|
||||
needs["e2e-page-final-touched"]["outputs"] = {"touched": "true"}
|
||||
return needs
|
||||
|
||||
|
||||
def _nothing_to_test(workflow: str, files: str = "3") -> dict:
|
||||
"""Every job as it ends when `changes` said there was nothing to test."""
|
||||
needs = {name: {"result": "skipped", "outputs": {}} for name in ci_gate.TABLES[workflow][1]}
|
||||
needs["changes"] = {"result": "success", "outputs": {"run": "false", "files": files}}
|
||||
return needs
|
||||
|
||||
|
||||
def _heavy(workflow: str) -> list:
|
||||
return sorted(n for n in ci_gate.TABLES[workflow][1] if n != "changes")
|
||||
|
||||
|
||||
def _run(workflow: str, needs: dict, changes_run, event: str = "merge_group") -> subprocess.CompletedProcess:
|
||||
env = {k: v for k, v in os.environ.items() if k not in ("NEEDS", "EVENT_NAME", "WORKFLOW", "INPUT_ONLY", "CHANGES_RUN")}
|
||||
env.update(NEEDS=json.dumps(needs), EVENT_NAME=event, WORKFLOW=workflow)
|
||||
if changes_run is not None:
|
||||
env["CHANGES_RUN"] = changes_run
|
||||
return subprocess.run([sys.executable, str(GATE)], env=env, capture_output=True, text=True, timeout=60)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("workflow", HEAVY)
|
||||
def test_every_job_ran_and_passed_is_ok_when_there_was_something_to_test(workflow):
|
||||
done = _run(workflow, _all_run(workflow), "true")
|
||||
assert done.returncode == 0 and done.stdout.splitlines()[-1] == "ok", done.stdout
|
||||
|
||||
|
||||
@pytest.mark.parametrize("workflow", HEAVY)
|
||||
def test_nothing_to_test_with_every_heavy_job_skipped_is_green_and_says_so(workflow):
|
||||
needs = _nothing_to_test(workflow)
|
||||
assert ci_gate.verdict(needs, "merge_group", workflow, "", "false") == []
|
||||
done = _run(workflow, needs, "false")
|
||||
assert done.returncode == 0, done.stdout
|
||||
assert done.stdout.splitlines()[-1] == "ok: nothing to test (3 files changed, none under the paths of %s)" % workflow
|
||||
|
||||
|
||||
@pytest.mark.parametrize("workflow", HEAVY)
|
||||
def test_nothing_to_test_but_a_heavy_job_ran_and_failed_is_red(workflow):
|
||||
for job in _heavy(workflow):
|
||||
needs = _nothing_to_test(workflow)
|
||||
needs[job]["result"] = "failure"
|
||||
done = _run(workflow, needs, "false")
|
||||
assert done.returncode == 1 and "job %s is failure" % job in done.stdout, (job, done.stdout)
|
||||
assert not done.stdout.splitlines()[-1].startswith("ok"), job
|
||||
|
||||
|
||||
@pytest.mark.parametrize("workflow", HEAVY)
|
||||
def test_nothing_to_test_but_a_heavy_job_ran_is_red_even_when_it_passed(workflow):
|
||||
for job in _heavy(workflow):
|
||||
needs = _nothing_to_test(workflow)
|
||||
needs[job]["result"] = "success"
|
||||
assert any("job %s is success" % job in line for line in ci_gate.verdict(needs, "merge_group", workflow, "", "false")), job
|
||||
|
||||
|
||||
@pytest.mark.parametrize("workflow", HEAVY)
|
||||
def test_something_to_test_but_a_heavy_job_skipped_is_red(workflow):
|
||||
for job in _heavy(workflow):
|
||||
if workflow == "e2e" and job in ci_gate.E2E_BY_OUTPUT:
|
||||
continue # skipped on purpose when the page oracle is not touched (run=true and touched=false)
|
||||
needs = _all_run(workflow)
|
||||
needs[job]["result"] = "skipped"
|
||||
done = _run(workflow, needs, "true")
|
||||
assert done.returncode == 1 and "FAIL %s: job %s is skipped. Fix: " % (ci_gate.TABLES[workflow][0], job) in done.stdout, (job, done.stdout)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("workflow", HEAVY)
|
||||
@pytest.mark.parametrize("value", [None, "", "maybe", "True", "1"])
|
||||
def test_a_missing_or_unreadable_answer_is_red_whatever_the_jobs_say(workflow, value):
|
||||
for needs in (_all_run(workflow), _nothing_to_test(workflow)):
|
||||
done = _run(workflow, needs, value)
|
||||
assert done.returncode == 1, (value, done.stdout)
|
||||
assert "FAIL %s: the output run of the job changes is" % ci_gate.TABLES[workflow][0] in done.stdout and RULE in done.stdout
|
||||
assert "ok" not in done.stdout.splitlines()
|
||||
assert ci_gate.verdict(_all_run(workflow), "merge_group", workflow)[0].startswith("FAIL "), "no answer given at all"
|
||||
|
||||
|
||||
@pytest.mark.parametrize("workflow", HEAVY)
|
||||
@pytest.mark.parametrize("result", ["failure", "cancelled", "skipped"])
|
||||
@pytest.mark.parametrize("run", ["true", "false"])
|
||||
def test_a_changes_job_that_did_not_succeed_is_red_either_way(workflow, result, run):
|
||||
needs = _all_run(workflow) if run == "true" else _nothing_to_test(workflow)
|
||||
needs["changes"]["result"] = result
|
||||
assert any("job changes is %s" % result in line for line in ci_gate.verdict(needs, "merge_group", workflow, "", run))
|
||||
|
||||
|
||||
def test_a_push_and_a_dispatch_run_everything_so_nothing_there_may_be_skipped():
|
||||
for event in ("push", "workflow_dispatch"):
|
||||
needs = _all_run("fakeweb")
|
||||
needs["walk"]["result"] = "skipped"
|
||||
assert any("job walk is skipped" in line for line in ci_gate.verdict(needs, event, "fakeweb", "", "true"))
|
||||
|
||||
|
||||
def test_the_tests_workflow_has_no_changes_job_and_is_judged_as_before():
|
||||
assert "changes" not in ci_gate.FIX and "tests" not in ci_gate.HAS_CHANGES
|
||||
assert ci_gate.verdict({n: {"result": "success", "outputs": {}} for n in ci_gate.FIX}, "pull_request") == []
|
||||
@@ -629,7 +629,7 @@ def _job(text, name):
|
||||
def _needs_core_on_index(body, linux):
|
||||
"""A Linux job of e2e.yml waits for the core on the index and for the run's linux-deps-e2e job (its Ubuntu packages, from the archive once, never by the job);
|
||||
a Windows job waits for the core only."""
|
||||
return ("needs: [core-on-index, linux-deps-e2e]" in body) if linux else ("needs: core-on-index\n" in body)
|
||||
return ("needs: [changes, core-on-index, linux-deps-e2e]" in body) if linux else ("needs: [changes, core-on-index]\n" in body)
|
||||
|
||||
|
||||
def _linux_deps_e2e_packages(text):
|
||||
@@ -638,12 +638,12 @@ def _linux_deps_e2e_packages(text):
|
||||
return job[job.index("packages:"):].split("\n", 1)[0]
|
||||
|
||||
|
||||
def test_the_e2e_workflow_runs_the_step_on_a_pull_request_in_the_jobs_that_run_the_oracles_and_the_e2e_tests_read_its_variables():
|
||||
def test_the_e2e_workflow_runs_the_step_in_the_merge_queue_run_in_the_jobs_that_run_the_oracles_and_the_e2e_tests_read_its_variables():
|
||||
root = Path(__file__).resolve().parents[1]
|
||||
text = (root / ".github" / "workflows" / "e2e.yml").read_text(encoding="utf-8")
|
||||
legs = {name: _job(text, name) for name in ("e2e-linux", "e2e-windows-control-a", "e2e-windows", "e2e-network", "e2e-network-windows", "e2e-host", "e2e-host-windows", "e2e-page", "e2e-page-windows")}
|
||||
step = (' - name: How many seeds the A/A of each oracle visits (all of them when the pull request touches the oracle)\n'
|
||||
" if: github.event_name == 'pull_request'\n shell: bash\n env:\n BASE_SHA: ${{ github.event.pull_request.base.sha }}\n"
|
||||
" if: github.event_name == 'merge_group'\n shell: bash\n env:\n BASE_SHA: ${{ github.event.merge_group.base_sha }}\n"
|
||||
' run: python scripts/ci_ab_pr_seeds.py "$BASE_SHA" >> "$GITHUB_ENV"\n')
|
||||
assert [name for name, body in legs.items() if step in body] == ["e2e-linux", "e2e-windows", "e2e-network", "e2e-network-windows", "e2e-host", "e2e-host-windows", "e2e-page", "e2e-page-windows"], "the jobs that run the oracles' tests, and only those"
|
||||
for name in ("e2e-linux", "e2e-windows", "e2e-network", "e2e-network-windows", "e2e-host", "e2e-host-windows", "e2e-page", "e2e-page-windows"):
|
||||
@@ -1089,10 +1089,10 @@ def test_the_final_set_has_jobs_of_its_own_in_four_shards_on_each_system_and_the
|
||||
for body in (linux, windows):
|
||||
assert "shard: [1, 2, 3, 4]" in body and "AB_ORACLE_SEED_SET: final" in body and "AB_ORACLE_SHARD: ${{ matrix.shard }}/4" in body
|
||||
assert body.count(page) == 1 and "scripts/run_e2e.py" not in body and "timeout-minutes: 40" in body and "fail-fast: false" in body
|
||||
assert ("needs: [core-on-index, e2e-page-final-touched, linux-deps-e2e]" if body is linux else "needs: [core-on-index, e2e-page-final-touched]") in body and "needs.e2e-page-final-touched.outputs.touched == 'true'" in body
|
||||
assert ("needs: [changes, core-on-index, e2e-page-final-touched, linux-deps-e2e]" if body is linux else "needs: [changes, core-on-index, e2e-page-final-touched]") in body and "needs.e2e-page-final-touched.outputs.touched == 'true'" in body
|
||||
assert "skipped\": 0" in body and '{"tests": 1, "failures": 0, "errors": 0, "skipped": 0}' in body, "one test, passed: a skipped one is red"
|
||||
assert "matrix.shard" in body.split("name: invpw-evidence-page-final", 1)[1].split("path:", 1)[0], "four shards, four artifact names"
|
||||
assert "scripts/ci_ab_oracle.py touched" in touched and "pull_request" in touched and "outputs:" in touched
|
||||
assert "scripts/ci_ab_oracle.py touched" in touched and "github.event_name == 'merge_group'" in touched and "github.event.merge_group.base_sha" in touched and "outputs:" in touched
|
||||
shared_linux, shared_windows = _job(text, "e2e-linux"), _job(text, "e2e-windows")
|
||||
assert "AB_ORACLE_SEED_SET" not in shared_linux + shared_windows + _job(text, "e2e-windows-control-a"), "the shared jobs run the candidate set and do not grow"
|
||||
|
||||
|
||||
@@ -25,17 +25,19 @@ the files themselves:
|
||||
a job of its own that waits for them. A job that `needs` another is
|
||||
SKIPPED when that one fails unless its `if:` says `always()`, and a
|
||||
skipped check is not red. So: the job `e2e` needs the parts and
|
||||
`core-on-index`; its `if:` is `always()` and the gate of the parts (the
|
||||
core on the index, not the Windows-only dispatch) joined by `&&`, so that
|
||||
it is skipped exactly when the parts are skipped for the core, as the
|
||||
Linux job was before the split, and runs in every other case; its one
|
||||
`core-on-index`; its `if:` is `always()` and the gate of the parts (not the
|
||||
Windows-only dispatch) joined by `&&`, so that it is skipped exactly when
|
||||
the parts are skipped by that dispatch, and runs in every other case (a
|
||||
core that is not on the index fails `core-on-index`, the parts are then
|
||||
skipped and this job runs and is red: no output of `core-on-index` is
|
||||
read by any `if:`, ci-13); its one
|
||||
step binds `needs.e2e-linux.result` (`success` only when every part
|
||||
succeeded) and fails unless it is `success`, in exactly the form
|
||||
`if [ "$PARTS" != "success" ]; then ... exit 1 ... fi`, with no other
|
||||
result named in its code (a cancelled part measured nothing, a skipped
|
||||
one ran nothing); no `continue-on-error`; no other job has its name.
|
||||
Known-bad: without `always()`, accepting `skipped`, not needing the
|
||||
parts, exiting 0, reading another job, dropping the gate of the core,
|
||||
parts, exiting 0, reading another job, dropping the gate of the dispatch,
|
||||
`success() || failure()`, the single job before the split.
|
||||
|
||||
The checkers are tested on known-bad inputs first, because a check that has
|
||||
@@ -205,8 +207,8 @@ def problems_concurrency(name: str, spec: dict) -> list[str]:
|
||||
if "github.run_id" not in group:
|
||||
out.append(f"{name}: outside a pull request the group is not unique to the run, "
|
||||
f"so a newer pending run of main replaces an older one")
|
||||
if "github.ref" in group or "head_ref" in group:
|
||||
out.append(f"{name}: the group is keyed on the ref, which is main for every push to main")
|
||||
if ("github.ref" in group and "merge_group" not in group) or "head_ref" in group:
|
||||
out.append(f"{name}: the group is keyed on the ref, which is main for every push to main (only a merge queue run may key on it: its ref is its own)")
|
||||
return out
|
||||
|
||||
|
||||
@@ -317,9 +319,9 @@ def test_the_push_triggers_the_release_reads_are_still_there():
|
||||
e2e = triggers(_load(WORKFLOWS / "e2e.yml"))
|
||||
assert e2e["push"]["branches"] == ["main"], \
|
||||
"scripts/e2e_is_green.py needs the e2e of the push to main on the tagged commit"
|
||||
assert "pull_request" in e2e
|
||||
assert "merge_group" in e2e and "pull_request" not in e2e, "e2e runs in the merge queue run, not on the pull request"
|
||||
tests = triggers(_load(WORKFLOWS / "tests.yml"))
|
||||
assert tests["push"]["branches"] == ["main"] and "pull_request" in tests
|
||||
assert tests["push"]["branches"] == ["main"] and "pull_request" in tests and "merge_group" in tests
|
||||
publish = triggers(_load(WORKFLOWS / "publish.yml"))
|
||||
assert publish["push"]["tags"] == ["v*"], "publish must start on a release tag"
|
||||
|
||||
@@ -387,7 +389,7 @@ def problems_linux_check(text: str) -> list:
|
||||
if PARTS_JOB not in needs:
|
||||
out.append("the check does not need the parts (%s): it would not wait for them, nor read their result" % PARTS_JOB)
|
||||
if INDEX_GATE not in needs:
|
||||
out.append("the check does not need %s: its `if:` cannot read whether the core is on the index" % INDEX_GATE)
|
||||
out.append("the check does not need %s: it would run before the index was asked" % INDEX_GATE)
|
||||
if "||" in str(check.get("if", "")):
|
||||
out.append("the `if:` of the check has a `||`: it must be `always()` and the gate of the parts")
|
||||
cond = _conjuncts(check.get("if"))
|
||||
@@ -442,7 +444,7 @@ def test_a_linux_check_that_accepts_skipped_is_refused():
|
||||
|
||||
|
||||
def test_a_linux_check_that_does_not_need_the_parts_is_refused():
|
||||
body = _check_body().replace("needs: [core-on-index, e2e-linux]", "needs: [core-on-index]", 1)
|
||||
body = _check_body().replace("needs: [changes, core-on-index, e2e-linux]", "needs: [changes, core-on-index]", 1)
|
||||
assert body != _check_body()
|
||||
assert any("does not need the parts" in p for p in problems_linux_check(_e2e_with_check(body)))
|
||||
|
||||
@@ -457,8 +459,8 @@ def test_a_linux_check_that_reads_another_job_is_refused():
|
||||
assert any("does not bind PARTS" in p for p in problems_linux_check(_e2e_with_check(body)))
|
||||
|
||||
|
||||
def test_a_linux_check_that_drops_the_gate_of_the_core_is_refused():
|
||||
body = _check_body().replace(" && needs.core-on-index.outputs.available == 'true'", "", 1)
|
||||
def test_a_linux_check_that_drops_the_gate_of_the_dispatch_is_refused():
|
||||
body = _check_body().replace(" && inputs.only != 'windows-control-a'", "", 1)
|
||||
assert body != _check_body()
|
||||
assert any("not `always()` and the gate of the parts" in p for p in problems_linux_check(_e2e_with_check(body)))
|
||||
|
||||
|
||||
@@ -593,12 +593,14 @@ WORKFLOW = (ROOT / ".github" / "workflows" / "fakeweb.yml").read_text(encoding="
|
||||
|
||||
|
||||
def test_the_workflow_has_four_legs_and_one_verdict_job():
|
||||
assert len(re.findall(r"^ [a-z0-9_-]+:\n (?:name|uses):", WORKFLOW, re.MULTILINE)) == 4 # core-on-index, linux-deps-fakeweb, walk, verdict
|
||||
assert len(re.findall(r"^ [a-z0-9_-]+:\n (?:name|uses|needs):", WORKFLOW, re.MULTILINE)) == 5 # changes, core-on-index, linux-deps-fakeweb, walk, verdict
|
||||
assert WORKFLOW.count("{ profile: ") == 4
|
||||
for leg in ("p2, os: linux", "p2, os: windows", "p4, os: linux", "p4, os: windows"):
|
||||
assert "profile: " + leg in WORKFLOW
|
||||
assert "name: fakeweb verdict" in WORKFLOW and "if: always()" in WORKFLOW.split("name: fakeweb verdict", 1)[1]
|
||||
assert '"${{ needs.walk.result }}" != "success"' in WORKFLOW # a leg that did not run is not green
|
||||
verdict = WORKFLOW.split("name: fakeweb verdict", 1)[1]
|
||||
assert "needs: [changes, core-on-index, linux-deps-fakeweb, walk]" in verdict and "WORKFLOW: fakeweb" in verdict and "NEEDS: ${{ toJSON(needs) }}" in verdict
|
||||
# a leg that did not run is not green: scripts/ci_gate.py (read from main) expects `success` of `walk`, see tests/test_the_workflows_are_ready_for_the_merge_queue.py
|
||||
|
||||
|
||||
def test_every_action_is_pinned_to_a_commit():
|
||||
@@ -616,7 +618,8 @@ def test_the_workflow_runs_stock_and_ours_and_never_reruns_or_forgives():
|
||||
assert WORKFLOW.index("scripts/ci_lab_geoip.py build") < first_run and WORKFLOW.index("scripts/ci_lab_security_state.py set") < WORKFLOW.index("fetch | tail -1")
|
||||
|
||||
|
||||
def test_the_workflow_starts_on_the_fake_web_files_of_a_pull_request_and_of_main_and_by_hand():
|
||||
def test_the_workflow_starts_in_the_merge_queue_run_and_on_the_fake_web_files_of_main_and_by_hand():
|
||||
on = WORKFLOW.split("\npermissions:", 1)[0]
|
||||
assert " push:\n branches: [main]\n paths:" in on and " pull_request:\n paths:" in on and " workflow_dispatch:" in on
|
||||
assert on.count("'tests/fakeweb/**'") == 2 and on.count("'.github/workflows/fakeweb.yml'") == 2
|
||||
assert " push:\n branches: [main]\n paths:" in on and " merge_group:\n types: [checks_requested]\n" in on and " workflow_dispatch:" in on
|
||||
assert "pull_request" not in on.split("\non:\n", 1)[1], "a pull request runs the fast set; this workflow runs in the queue run"
|
||||
assert on.count("'tests/fakeweb/**'") == 1 and on.count("'.github/workflows/fakeweb.yml'") == 1
|
||||
@@ -0,0 +1,278 @@
|
||||
"""Rule ci-13, nothing counts as passed that did not pass: the verdict `gate` of tests.yml is red when a job it waits for is skipped.
|
||||
|
||||
`gate` is the one context main requires. It used to treat `skipped` as a pass, and `unit` was skipped when `core-on-index` said the pinned
|
||||
invisible-core was not on the package index yet: a pull request could merge with no test run. Now:
|
||||
|
||||
* `core-on-index` FAILS (it does not skip anything) when the pinned core is not on the index, with the message
|
||||
`FAIL core-on-index: the pinned invisible-core <version> is not on the index. Fix: ... Rule: ci-13 ...`, and it has no `available` output;
|
||||
no `if:` of any workflow reads that output (a missing output reads as '' and would silently skip the job it guards);
|
||||
* `gate` runs `scripts/ci_gate.py`, read from origin/main and never from the branch it judges, on `toJSON(needs)`: every needed job must be `success`, one `FAIL gate: job <name> is <result>. Fix: ...` line
|
||||
for each that is not. The only job conditional by design is `version` (pull requests only): `skipped` on any other event, `success` on a pull request.
|
||||
|
||||
Known-bad inputs: a `skipped`, a `cancelled` and a `failure` job, a skipped `version` on a pull request, a needed job that the script does not
|
||||
know, an unreadable `NEEDS`, the tests.yml with the old generic `case ... failure|cancelled` arms, a workflow with an `if:` that reads the removed
|
||||
output. The green case is the state of the repository.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import importlib.util
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
pytestmark = pytest.mark.unit
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
WORKFLOWS = ROOT / ".github" / "workflows"
|
||||
SCRIPT = ROOT / "scripts" / "ci_gate.py"
|
||||
RULE = "Rule: ci-13 nothing counts as passed that did not pass"
|
||||
|
||||
_spec = importlib.util.spec_from_file_location("ci_gate", SCRIPT)
|
||||
ci_gate = importlib.util.module_from_spec(_spec)
|
||||
_spec.loader.exec_module(ci_gate)
|
||||
|
||||
|
||||
def _needs(result: str = "success", **overrides: str) -> dict:
|
||||
jobs = {name: {"result": result, "outputs": {}} for name in ci_gate.FIX}
|
||||
for name, value in overrides.items():
|
||||
jobs[name.replace("_", "-")] = {"result": value, "outputs": {}}
|
||||
return jobs
|
||||
|
||||
|
||||
# ------------------------------------------------------------------ the script
|
||||
|
||||
|
||||
def test_every_job_green_on_a_pull_request_is_ok():
|
||||
assert ci_gate.verdict(_needs(), "pull_request") == []
|
||||
|
||||
|
||||
@pytest.mark.parametrize("result", ["skipped", "cancelled", "failure"])
|
||||
def test_a_needed_job_that_is_not_success_is_red(result):
|
||||
lines = ci_gate.verdict(_needs(unit=result), "pull_request")
|
||||
assert len(lines) == 1
|
||||
assert lines[0].startswith("FAIL gate: job unit is %s. Fix: " % result)
|
||||
assert lines[0].endswith(RULE)
|
||||
|
||||
|
||||
def test_a_skipped_unit_is_red_on_a_push_too():
|
||||
assert any("job unit is skipped" in line for line in ci_gate.verdict(_needs(unit="skipped"), "push"))
|
||||
|
||||
|
||||
def test_a_skipped_core_on_index_is_red():
|
||||
assert any("job core-on-index is skipped" in line for line in ci_gate.verdict(_needs(core_on_index="skipped"), "pull_request"))
|
||||
|
||||
|
||||
def test_every_job_that_is_not_success_gets_its_own_line():
|
||||
lines = ci_gate.verdict(_needs(unit="skipped", docs_api="skipped", english="failure"), "pull_request")
|
||||
assert [line.split(" is ")[0] for line in lines] == ["FAIL gate: job docs-api", "FAIL gate: job english", "FAIL gate: job unit"]
|
||||
|
||||
|
||||
def test_version_is_skipped_on_a_push_and_must_succeed_on_a_pull_request():
|
||||
assert ci_gate.verdict(_needs(version="skipped"), "push") == []
|
||||
assert any("job version is skipped" in line for line in ci_gate.verdict(_needs(version="skipped"), "pull_request"))
|
||||
assert any("job version is failure" in line for line in ci_gate.verdict(_needs(version="failure"), "push"))
|
||||
|
||||
|
||||
def test_only_version_is_conditional():
|
||||
assert set(ci_gate.CONDITIONAL) == {"version"}
|
||||
|
||||
|
||||
def test_a_needed_job_the_script_does_not_know_is_red():
|
||||
needs = _needs()
|
||||
needs["brand-new"] = {"result": "success", "outputs": {}}
|
||||
assert any("job brand-new is success" in line for line in ci_gate.verdict(needs, "pull_request"))
|
||||
|
||||
|
||||
def test_a_job_that_is_missing_from_needs_is_red():
|
||||
needs = _needs()
|
||||
del needs["unit"]
|
||||
assert any("job unit is missing" in line for line in ci_gate.verdict(needs, "pull_request"))
|
||||
|
||||
|
||||
def _run(needs_text: str, event: str = "pull_request") -> subprocess.CompletedProcess:
|
||||
env = {k: v for k, v in os.environ.items() if k not in ("NEEDS", "EVENT_NAME")}
|
||||
env.update(NEEDS=needs_text, EVENT_NAME=event)
|
||||
return subprocess.run([sys.executable, str(SCRIPT)], env=env, capture_output=True, text=True, timeout=60)
|
||||
|
||||
|
||||
def test_the_script_exits_1_with_the_fail_line_when_unit_is_skipped():
|
||||
done = _run(json.dumps(_needs(unit="skipped")))
|
||||
assert done.returncode == 1
|
||||
assert "FAIL gate: job unit is skipped. Fix: " in done.stdout and RULE in done.stdout
|
||||
assert "ok" not in done.stdout.splitlines()
|
||||
|
||||
|
||||
def test_the_script_exits_0_when_every_job_is_as_expected():
|
||||
done = _run(json.dumps(_needs()))
|
||||
assert done.returncode == 0 and done.stdout.splitlines()[-1] == "ok"
|
||||
|
||||
|
||||
@pytest.mark.parametrize("text", ["", "not json", "[]"])
|
||||
def test_the_script_is_red_when_it_cannot_read_the_results(text):
|
||||
done = _run(text)
|
||||
assert done.returncode == 1 and done.stdout.startswith("FAIL gate: ")
|
||||
|
||||
|
||||
# ---------------------------------------------------------------- the workflow
|
||||
|
||||
|
||||
def _job_text(text: str, job: str) -> str:
|
||||
body = text.split("\njobs:\n", 1)[1] if "\njobs:\n" in text else ""
|
||||
found = re.search(r"^ %s:\s*\n(.*?)(?=^ [A-Za-z0-9_-]+:\s*$|\Z)" % re.escape(job), body, re.M | re.S)
|
||||
return found.group(1) if found else ""
|
||||
|
||||
|
||||
def problems_gate(tests_yml: str) -> list:
|
||||
"""What is wrong with the job `gate` of this tests.yml, as the rule ci-13 reads it."""
|
||||
out = []
|
||||
body = _job_text(tests_yml, "gate")
|
||||
if not body:
|
||||
return ["tests.yml has no job `gate`"]
|
||||
needs = re.search(r"^ needs: \[([^\]]*)\]\s*$", body, re.M)
|
||||
names = [n.strip() for n in needs.group(1).split(",")] if needs else []
|
||||
if sorted(names) != sorted(ci_gate.FIX):
|
||||
out.append("the `needs:` of gate (%s) is not the table of scripts/ci_gate.py (%s)" % (sorted(names), sorted(ci_gate.FIX)))
|
||||
if not re.search(r"^ +if: always\(\)\s*$", body, re.M):
|
||||
out.append("gate has no `if: always()`: a failed job would leave it skipped")
|
||||
if not re.search(r"^ +NEEDS: \$\{\{ toJSON\(needs\) \}\}\s*$", body, re.M):
|
||||
out.append("gate does not pass `toJSON(needs)` to the script")
|
||||
if 'git show origin/main:scripts/ci_gate.py > "$RUNNER_TEMP/ci_gate.py"' not in body:
|
||||
out.append("gate does not read scripts/ci_gate.py from origin/main: the judge would come from the branch it judges")
|
||||
if "git fetch" not in body or "refs/heads/main:refs/remotes/origin/main" not in body:
|
||||
out.append("gate does not fetch main before it reads the judge")
|
||||
if "ci_gate.py is not on origin/main yet: falling back to the copy of this branch" not in body:
|
||||
out.append("gate falls back to the branch copy without saying so")
|
||||
if not re.search(r'^ +python3 "\$RUNNER_TEMP/ci_gate\.py"\s*$', body, re.M):
|
||||
out.append("gate does not run the copy it read from main")
|
||||
if re.search(r"python3? +(\./)?scripts/ci_gate\.py", body):
|
||||
out.append("gate runs the script of the branch directly")
|
||||
for line in body.splitlines():
|
||||
code = line.split("#", 1)[0]
|
||||
if re.search(r"failure\|cancelled|\bskipped\b|continue-on-error", code):
|
||||
out.append("gate names a result or `continue-on-error` outside the script: %s" % line.strip())
|
||||
return out
|
||||
|
||||
|
||||
def _tests_yml() -> str:
|
||||
return (WORKFLOWS / "tests.yml").read_text(encoding="utf-8")
|
||||
|
||||
|
||||
def test_the_gate_of_tests_yml_runs_the_script_on_every_needed_job():
|
||||
assert problems_gate(_tests_yml()) == []
|
||||
|
||||
|
||||
def _gate_run_replaced(text: str, run: str) -> str:
|
||||
body = _job_text(text, "gate")
|
||||
start = body.index(" # The judge is read from main")
|
||||
end = body.index("\n\n", start) if "\n\n" in body[start:] else len(body)
|
||||
return text.replace(body, body[:start] + run + body[end:])
|
||||
|
||||
|
||||
def test_a_gate_with_the_old_generic_case_arms_is_refused():
|
||||
run = ' run: |\n case "${{ needs.unit.result }}" in\n failure|cancelled) exit 1 ;;\n esac'
|
||||
found = problems_gate(_gate_run_replaced(_tests_yml(), run))
|
||||
assert any("failure|cancelled" in p for p in found) and any("from origin/main" in p for p in found), found
|
||||
|
||||
|
||||
def test_a_gate_that_runs_the_script_of_the_branch_it_judges_is_refused():
|
||||
found = problems_gate(_gate_run_replaced(_tests_yml(), " run: python3 scripts/ci_gate.py"))
|
||||
assert any("from origin/main" in p for p in found) and any("of the branch directly" in p for p in found), found
|
||||
|
||||
|
||||
def test_a_gate_that_falls_back_in_silence_is_refused():
|
||||
text = _tests_yml()
|
||||
quiet = text.replace("ci_gate.py is not on origin/main yet: falling back to the copy of this branch", "fallback", 1)
|
||||
assert quiet != text
|
||||
assert any("without saying so" in p for p in problems_gate(quiet))
|
||||
|
||||
|
||||
def test_a_gate_that_does_not_fetch_main_is_refused():
|
||||
text = _tests_yml()
|
||||
no_fetch = text.replace("git fetch --no-tags --depth=1 origin +refs/heads/main:refs/remotes/origin/main", "true", 1)
|
||||
assert no_fetch != text
|
||||
assert any("does not fetch main" in p for p in problems_gate(no_fetch))
|
||||
|
||||
|
||||
def test_a_gate_that_forgets_a_job_is_refused():
|
||||
text = _tests_yml()
|
||||
body = _job_text(text, "gate")
|
||||
assert any("table of scripts/ci_gate.py" in p for p in problems_gate(text.replace(body, body.replace(" unit,", "", 1))))
|
||||
|
||||
|
||||
def test_a_gate_that_is_skipped_when_a_job_fails_is_refused():
|
||||
text = _tests_yml()
|
||||
body = _job_text(text, "gate")
|
||||
assert any("no `if: always()`" in p for p in problems_gate(text.replace(body, body.replace(" if: always()\n", "", 1))))
|
||||
|
||||
|
||||
# ------------------------------------------------- the removed `available` output
|
||||
|
||||
|
||||
def problems_available(workflows: dict) -> list:
|
||||
"""`workflows` maps a file name to its text. Nothing may read, set or declare the `available` answer of core-on-index."""
|
||||
out = []
|
||||
for name, text in sorted(workflows.items()):
|
||||
for number, line in enumerate(text.splitlines(), 1):
|
||||
code = line.split("#", 1)[0]
|
||||
if re.search(r"core-on-index\.outputs\.available|steps\.probe\.outputs\.available|jobs\.probe\.outputs\.available|available=(true|false)", code):
|
||||
out.append("%s:%d reads or sets the removed `available` output: %s" % (name, number, line.strip()))
|
||||
if name == "core-on-index.yml" and re.match(r"\s+available:", code):
|
||||
out.append("%s:%d declares an `available` output" % (name, number))
|
||||
return out
|
||||
|
||||
|
||||
def _workflows() -> dict:
|
||||
return {p.name: p.read_text(encoding="utf-8") for p in sorted(WORKFLOWS.glob("*.yml"))}
|
||||
|
||||
|
||||
def test_no_workflow_reads_or_sets_the_available_output_of_core_on_index():
|
||||
assert problems_available(_workflows()) == []
|
||||
|
||||
|
||||
def test_no_job_of_tests_yml_has_an_if_that_reads_core_on_index():
|
||||
for number, line in enumerate(_tests_yml().splitlines(), 1):
|
||||
code = line.split("#", 1)[0]
|
||||
assert not (re.match(r"\s+if:", code) and "core-on-index" in code), "tests.yml:%d: %s" % (number, line.strip())
|
||||
|
||||
|
||||
def test_an_if_that_reads_the_removed_output_is_refused():
|
||||
workflows = _workflows()
|
||||
workflows["tests.yml"] = workflows["tests.yml"].replace(" needs: core-on-index\n runs-on: ${{ matrix.os }}", " needs: core-on-index\n if: needs.core-on-index.outputs.available == 'true'\n runs-on: ${{ matrix.os }}", 1)
|
||||
assert any("tests.yml" in p for p in problems_available(workflows))
|
||||
|
||||
|
||||
# ------------------------------------------------- core-on-index fails, never skips
|
||||
|
||||
|
||||
def problems_core_on_index(text: str) -> list:
|
||||
out = []
|
||||
if "FAIL core-on-index: the pinned {DIST} {pin} is not on the index. " not in text:
|
||||
out.append("core-on-index does not fail with `FAIL core-on-index: the pinned invisible-core <version> is not on the index`")
|
||||
if "Fix: wait for its publish to finish, or pin a published core. " not in text:
|
||||
out.append("the failure of core-on-index does not say how to fix it")
|
||||
if "Rule: ci-13 nothing counts as passed that did not pass" not in text:
|
||||
out.append("the failure of core-on-index does not name ci-13")
|
||||
unpublished = text.partition("if unpublished:")[2].partition("versions = data.get(")[0]
|
||||
if "sys.exit(0)" in unpublished or "die(" not in unpublished:
|
||||
out.append("a core that is not on the index at all does not end in a failure")
|
||||
if "sys.exit(0)" in text:
|
||||
out.append("core-on-index has a `sys.exit(0)`: a path that ends green without a verdict")
|
||||
return out
|
||||
|
||||
|
||||
def test_core_on_index_fails_when_the_pinned_core_is_not_on_the_index():
|
||||
assert problems_core_on_index((WORKFLOWS / "core-on-index.yml").read_text(encoding="utf-8")) == []
|
||||
|
||||
|
||||
def test_a_core_on_index_that_skips_during_the_window_is_refused():
|
||||
text = (WORKFLOWS / "core-on-index.yml").read_text(encoding="utf-8")
|
||||
skipping = text.replace(" die(f\"FAIL core-on-index: the pinned {DIST} {pin} is not on the index. \"\n f\"Fix: wait for its publish to finish, or pin a published core. \"\n f\"Rule: ci-13 nothing counts as passed that did not pass\")\n",
|
||||
" write(\"GITHUB_OUTPUT\", \"available=false\")\n sys.exit(0)\n", 1)
|
||||
assert skipping != text
|
||||
assert problems_core_on_index(skipping)
|
||||
assert problems_available({"core-on-index.yml": skipping})
|
||||
@@ -0,0 +1,403 @@
|
||||
"""The workflows are ready for a GitHub merge queue (rule ci-13, nothing counts as passed that did not pass).
|
||||
|
||||
The design: a pull request runs the fast set (tests.yml: unit and the rules jobs). The heavy e2e.yml and fakeweb.yml run in the merge queue run
|
||||
(`merge_group`), and that run decides. Each workflow that gates a merge has ONE verdict job, red on any needed job that is not `success`, skipped
|
||||
included (scripts/ci_gate.py, read from origin/main, WORKFLOW=tests|e2e|fakeweb picks its tables):
|
||||
|
||||
tests.yml the job `gate`
|
||||
e2e.yml the job named `e2e verdict`
|
||||
fakeweb.yml the job named `fakeweb verdict`
|
||||
|
||||
What is held here, on the files themselves:
|
||||
|
||||
* the three listen to `merge_group` (`checks_requested`); e2e.yml and fakeweb.yml do not listen to `pull_request`;
|
||||
* no `if:` of the three compares `github.event_name` with 'pull_request' without also allowing `merge_group`, and e2e.yml and fakeweb.yml read
|
||||
no field of the pull request: the base of a queue entry is `github.event.merge_group.base_sha`;
|
||||
* in a merge queue run the concurrency group is the ref of the entry and nothing is cancelled;
|
||||
* each verdict job waits for EVERY other job of its workflow, is `if: always()`, reads ci_gate.py from origin/main (and says so when it falls back),
|
||||
and names its WORKFLOW;
|
||||
* ci_gate.py, per workflow: `success` passes; `skipped`, `cancelled`, `failure` or a missing job is red; a job the table does not know is red;
|
||||
the table has an entry for every job the verdict job needs (and nothing else), parsed from the YAML; the jobs that may be skipped are exactly
|
||||
the ones that are conditional by design.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import importlib.util
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
pytestmark = pytest.mark.unit
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
WORKFLOWS = ROOT / ".github" / "workflows"
|
||||
SCRIPT = ROOT / "scripts" / "ci_gate.py"
|
||||
RULE = "Rule: ci-13 nothing counts as passed that did not pass"
|
||||
|
||||
_spec = importlib.util.spec_from_file_location("ci_gate_for_the_queue", SCRIPT)
|
||||
ci_gate = importlib.util.module_from_spec(_spec)
|
||||
_spec.loader.exec_module(ci_gate)
|
||||
|
||||
# workflow file -> (WORKFLOW of ci_gate.py, the id of its verdict job, the name of that job)
|
||||
VERDICTS = {
|
||||
"tests.yml": ("tests", "gate", None),
|
||||
"e2e.yml": ("e2e", "verdict", "e2e verdict"),
|
||||
"fakeweb.yml": ("fakeweb", "verdict", "fakeweb verdict"),
|
||||
}
|
||||
QUEUE_ONLY = ("e2e.yml", "fakeweb.yml")
|
||||
|
||||
|
||||
def _text(name: str) -> str:
|
||||
return (WORKFLOWS / name).read_text(encoding="utf-8")
|
||||
|
||||
|
||||
def _code(text: str) -> str:
|
||||
"""The text without its comment lines."""
|
||||
return "\n".join(line for line in text.splitlines() if not line.lstrip().startswith("#"))
|
||||
|
||||
|
||||
def _triggers(text: str) -> list:
|
||||
found = re.search(r"^on:\s*\n(.*?)(?=^\S)", text, re.M | re.S)
|
||||
assert found, "no `on:` block"
|
||||
return re.findall(r"^ ([a-z_]+):", _code(found.group(1)), re.M)
|
||||
|
||||
|
||||
def _top_block(text: str, key: str) -> str:
|
||||
found = re.search(r"^%s:\s*\n(.*?)(?=^\S)" % re.escape(key), text, re.M | re.S)
|
||||
return found.group(1) if found else ""
|
||||
|
||||
|
||||
def _jobs(text: str) -> dict:
|
||||
"""job id -> its text, for the jobs of the file."""
|
||||
body = text.split("\njobs:\n", 1)[1]
|
||||
ids = list(re.finditer(r"^ ([A-Za-z0-9_-]+):\s*$", body, re.M))
|
||||
return {m.group(1): body[m.end(): ids[i + 1].start() if i + 1 < len(ids) else len(body)] for i, m in enumerate(ids)}
|
||||
|
||||
|
||||
def _needs(job_text: str) -> list:
|
||||
flow = re.search(r"^ needs: \[([^\]]*)\]\s*$", job_text, re.M)
|
||||
if flow:
|
||||
return [n.strip() for n in flow.group(1).split(",") if n.strip()]
|
||||
one = re.search(r"^ needs: ([A-Za-z0-9_-]+)\s*$", job_text, re.M)
|
||||
return [one.group(1)] if one else []
|
||||
|
||||
|
||||
def _ifs(text: str) -> list:
|
||||
"""(line number, condition) of every `if:` of the file, job or step."""
|
||||
return [(n, m.group(1)) for n, line in enumerate(text.splitlines(), 1)
|
||||
if (m := re.match(r"^\s+(?:- )?if: (.*)$", line)) and not line.lstrip().startswith("#")]
|
||||
|
||||
|
||||
def _needs_of_verdict(name: str) -> list:
|
||||
return _needs(_jobs(_text(name))[VERDICTS[name][1]])
|
||||
|
||||
|
||||
# ------------------------------------------------------------------------------ the triggers
|
||||
|
||||
|
||||
@pytest.mark.parametrize("name", sorted(VERDICTS))
|
||||
def test_every_workflow_with_a_verdict_listens_to_the_merge_queue(name):
|
||||
text = _text(name)
|
||||
assert "merge_group" in _triggers(text), "%s has a verdict job and does not listen to merge_group" % name
|
||||
assert re.search(r"^ merge_group:\s*\n types: \[checks_requested\]\s*$", text, re.M), "%s: merge_group without types: [checks_requested]" % name
|
||||
|
||||
|
||||
@pytest.mark.parametrize("name", QUEUE_ONLY)
|
||||
def test_the_heavy_workflows_do_not_run_on_the_pull_request(name):
|
||||
triggers = _triggers(_text(name))
|
||||
assert "pull_request" not in triggers and "pull_request_target" not in triggers, triggers
|
||||
assert "push" in triggers and "workflow_dispatch" in triggers, "push (main) and workflow_dispatch stay: %s" % triggers
|
||||
|
||||
|
||||
def test_the_fast_set_still_runs_on_the_pull_request_and_on_main():
|
||||
triggers = _triggers(_text("tests.yml"))
|
||||
assert {"push", "pull_request", "merge_group", "workflow_dispatch"} <= set(triggers), triggers
|
||||
assert re.search(r"^ push:\s*\n branches: \[main\]", _text("tests.yml"), re.M)
|
||||
|
||||
|
||||
# ------------------------------------------------------------------------------ the conditions
|
||||
|
||||
|
||||
def problems_conditions(name: str, text: str) -> list:
|
||||
out = []
|
||||
for number, cond in _ifs(text):
|
||||
if re.search(r"event_name\s*==\s*'pull_request'", cond) and "merge_group" not in cond:
|
||||
out.append("%s:%d `if: %s` runs on a pull request and not in the merge queue run" % (name, number, cond))
|
||||
if name in QUEUE_ONLY:
|
||||
for number, line in enumerate(_code(text).splitlines(), 1):
|
||||
if "github.event.pull_request" in line or "github.head_ref" in line or "github.base_ref" in line:
|
||||
out.append("%s: %s reads the pull request, which a queue run does not have (use github.event.merge_group.base_sha)" % (name, line.strip()))
|
||||
return out
|
||||
|
||||
|
||||
@pytest.mark.parametrize("name", sorted(VERDICTS))
|
||||
def test_no_condition_runs_on_the_pull_request_and_skips_the_merge_queue(name):
|
||||
assert problems_conditions(name, _text(name)) == []
|
||||
|
||||
|
||||
def test_every_step_that_reads_the_base_reads_the_one_of_the_queue_entry():
|
||||
for name in QUEUE_ONLY:
|
||||
text = _code(_text(name))
|
||||
assert text.count("BASE_SHA: ${{ github.event.merge_group.base_sha }}") == text.count("BASE_SHA:"), name
|
||||
e2e = _code(_text("e2e.yml"))
|
||||
assert e2e.count("BASE_SHA:") == 10 and len(re.findall(r"^\s+if: github\.event_name == 'merge_group'\s*$", e2e, re.M)) == 8
|
||||
assert "if: needs.changes.outputs.run == 'true' && github.event_name == 'merge_group' && inputs.only != 'windows-control-a'" in e2e
|
||||
|
||||
|
||||
def test_the_version_check_runs_in_the_merge_queue_run_too():
|
||||
version = _jobs(_text("tests.yml"))["version"]
|
||||
assert re.search(r"^ if: github\.event_name == 'pull_request' \|\| github\.event_name == 'merge_group'\s*$", version, re.M)
|
||||
|
||||
|
||||
def test_a_condition_that_skips_the_queue_is_refused():
|
||||
text = _text("e2e.yml").replace("if: github.event_name == 'merge_group'\n shell: bash", "if: github.event_name == 'pull_request'\n shell: bash", 1)
|
||||
assert problems_conditions("e2e.yml", text)
|
||||
assert problems_conditions("tests.yml", _text("tests.yml").replace("|| github.event_name == 'merge_group'", "", 1))
|
||||
assert problems_conditions("fakeweb.yml", _text("fakeweb.yml") + "\n - run: echo ${{ github.event.pull_request.base.sha }}\n")
|
||||
|
||||
|
||||
# ------------------------------------------------------------------------------ the concurrency
|
||||
|
||||
|
||||
@pytest.mark.parametrize("name", sorted(VERDICTS))
|
||||
def test_a_queue_run_is_grouped_on_its_ref_and_never_cancelled(name):
|
||||
block = _code(_top_block(_text(name), "concurrency"))
|
||||
group = re.search(r"^ group: (.*)$", block, re.M).group(1)
|
||||
cancel = re.search(r"^ cancel-in-progress: (.*)$", block, re.M).group(1).strip()
|
||||
assert "github.event_name == 'merge_group' && github.ref" in group, group
|
||||
assert "github.run_id" in group, "outside a queue run the group is unique to the run: %s" % group
|
||||
if name == "tests.yml":
|
||||
assert cancel == "${{ github.event_name == 'pull_request' }}", cancel # false in a queue run; a pull request keeps its behaviour
|
||||
assert "format('pr-{0}', github.event.pull_request.number)" in group
|
||||
else:
|
||||
assert cancel == "false", cancel
|
||||
|
||||
|
||||
# ------------------------------------------------------------------------------ the verdict jobs
|
||||
|
||||
|
||||
def problems_verdict(name: str, text: str) -> list:
|
||||
workflow, job_id, job_name = VERDICTS[name]
|
||||
out = []
|
||||
jobs = _jobs(text)
|
||||
if job_id not in jobs:
|
||||
return ["%s has no job `%s`" % (name, job_id)]
|
||||
body = jobs[job_id]
|
||||
if job_name is None:
|
||||
if re.search(r"^ name:", body, re.M):
|
||||
out.append("%s: the verdict job `gate` has a name, and the branch protection reads the context `gate`" % name)
|
||||
elif not re.search(r"^ name: %s\s*$" % re.escape(job_name), body, re.M):
|
||||
out.append("%s: the verdict job is not named exactly `%s`" % (name, job_name))
|
||||
named = [i for i, b in jobs.items() if job_name and re.search(r"^ name: %s\s*$" % re.escape(job_name), b, re.M)]
|
||||
if job_name and named != [job_id]:
|
||||
out.append("%s: more than one job is named `%s`: %s" % (name, job_name, named))
|
||||
others = sorted(set(jobs) - {job_id})
|
||||
needs = _needs(body)
|
||||
if sorted(needs) != others:
|
||||
out.append("%s: the verdict job needs %s, not every other job of the workflow %s" % (name, sorted(needs), others))
|
||||
if not re.search(r"^ if: always\(\)\s*$", body, re.M):
|
||||
out.append("%s: the verdict job has no `if: always()`: a failed job would leave it skipped" % name)
|
||||
if "actions/checkout@" not in body:
|
||||
out.append("%s: the verdict job does not check out the repository" % name)
|
||||
if not re.search(r"^ +NEEDS: \$\{\{ toJSON\(needs\) \}\}\s*$", body, re.M):
|
||||
out.append("%s: the verdict job does not pass `toJSON(needs)`" % name)
|
||||
if not re.search(r"^ +EVENT_NAME: \$\{\{ github\.event_name \}\}\s*$", body, re.M):
|
||||
out.append("%s: the verdict job does not pass the event" % name)
|
||||
if not re.search(r"^ +WORKFLOW: %s\s*$" % workflow, body, re.M):
|
||||
out.append("%s: the verdict job does not set WORKFLOW: %s" % (name, workflow))
|
||||
if 'git show origin/main:scripts/ci_gate.py > "$RUNNER_TEMP/ci_gate.py"' not in body:
|
||||
out.append("%s: the verdict job does not read scripts/ci_gate.py from origin/main" % name)
|
||||
if "git fetch" not in body or "refs/heads/main:refs/remotes/origin/main" not in body:
|
||||
out.append("%s: the verdict job does not fetch main before it reads the judge" % name)
|
||||
if "ci_gate.py is not on origin/main yet: falling back to the copy of this branch" not in body:
|
||||
out.append("%s: the verdict job falls back to the branch copy without saying so" % name)
|
||||
if not re.search(r'^ +python3 "\$RUNNER_TEMP/ci_gate\.py"\s*$', body, re.M):
|
||||
out.append("%s: the verdict job does not run the copy it read from main" % name)
|
||||
if re.search(r"python3? +(\./)?scripts/ci_gate\.py", body):
|
||||
out.append("%s: the verdict job runs the script of the branch directly" % name)
|
||||
for line in body.splitlines():
|
||||
code = line.split("#", 1)[0]
|
||||
if re.search(r"failure\|cancelled|\bskipped\b|continue-on-error|needs\.[A-Za-z0-9_-]+\.result", code):
|
||||
out.append("%s: the verdict job names a result outside the script: %s" % (name, line.strip()))
|
||||
return out
|
||||
|
||||
|
||||
@pytest.mark.parametrize("name", sorted(VERDICTS))
|
||||
def test_each_verdict_job_waits_for_every_job_and_reads_the_judge_from_main(name):
|
||||
assert problems_verdict(name, _text(name)) == []
|
||||
|
||||
|
||||
def test_a_verdict_that_forgets_a_job_or_is_not_always_or_reads_the_branch_is_refused():
|
||||
text = _text("e2e.yml")
|
||||
assert any("not every other job" in p for p in problems_verdict("e2e.yml", text.replace("e2e-page-windows, ", "", 1)))
|
||||
assert any("no `if: always()`" in p for p in problems_verdict("fakeweb.yml", _text("fakeweb.yml").replace(" name: fakeweb verdict\n needs: [changes, core-on-index, linux-deps-fakeweb, walk]\n if: always()\n", " name: fakeweb verdict\n needs: [changes, core-on-index, linux-deps-fakeweb, walk]\n", 1)))
|
||||
assert any("origin/main" in p for p in problems_verdict("e2e.yml", text.replace('git show origin/main:scripts/ci_gate.py > "$RUNNER_TEMP/ci_gate.py"', "true", 1)))
|
||||
assert any("WORKFLOW" in p for p in problems_verdict("e2e.yml", text.replace("WORKFLOW: e2e\n", "", 1)))
|
||||
assert any("not named exactly" in p for p in problems_verdict("fakeweb.yml", _text("fakeweb.yml").replace("name: fakeweb verdict", "name: verdict", 1)))
|
||||
assert any("names a result" in p for p in problems_verdict("fakeweb.yml", _text("fakeweb.yml").replace('python3 "$RUNNER_TEMP/ci_gate.py"', 'python3 "$RUNNER_TEMP/ci_gate.py" || [ "${{ needs.walk.result }}" = skipped ]', 1)))
|
||||
|
||||
|
||||
def test_the_names_the_release_and_the_branch_protection_read_are_kept():
|
||||
e2e = _jobs(_text("e2e.yml"))["e2e"]
|
||||
assert re.search(r"^ name: e2e \(linux, xvfb\)\s*$", e2e, re.M), "scripts/e2e_is_green.py reads the Linux check of the push to main"
|
||||
assert "gate" in _jobs(_text("tests.yml"))
|
||||
|
||||
|
||||
# ------------------------------------------------------------------------------ ci_gate.py, per workflow
|
||||
|
||||
|
||||
def _table(workflow: str) -> dict:
|
||||
return ci_gate.TABLES[workflow][1]
|
||||
|
||||
|
||||
def _all_green(workflow: str, touched: str = "true") -> dict:
|
||||
needs = {name: {"result": "success", "outputs": {}} for name in _table(workflow)}
|
||||
if workflow == "e2e":
|
||||
needs["e2e-page-final-touched"]["outputs"] = {"touched": touched}
|
||||
if touched != "true":
|
||||
for name in ci_gate.E2E_BY_OUTPUT:
|
||||
needs[name]["result"] = "skipped"
|
||||
return needs
|
||||
|
||||
|
||||
def _lines(workflow: str, needs: dict, event: str, only: str = "", changes_run: str = "true") -> list:
|
||||
return ci_gate.verdict(needs, event, workflow, only, changes_run)
|
||||
|
||||
|
||||
def _event_for(workflow: str) -> str:
|
||||
return "pull_request" if workflow == "tests" else "merge_group"
|
||||
|
||||
|
||||
@pytest.mark.parametrize("workflow", ["tests", "e2e", "fakeweb"])
|
||||
def test_every_job_green_passes(workflow):
|
||||
assert _lines(workflow, _all_green(workflow), _event_for(workflow)) == []
|
||||
|
||||
|
||||
@pytest.mark.parametrize("workflow", ["tests", "e2e", "fakeweb"])
|
||||
@pytest.mark.parametrize("result", ["skipped", "cancelled", "failure"])
|
||||
def test_a_needed_job_that_is_not_success_is_red(workflow, result):
|
||||
event = _event_for(workflow)
|
||||
label = ci_gate.TABLES[workflow][0]
|
||||
for job in sorted(_table(workflow)):
|
||||
if job in ci_gate.CONDITIONAL and workflow == "tests" or job in ci_gate.E2E_BY_OUTPUT or job in ci_gate.E2E_CONDITIONAL:
|
||||
continue # the conditional ones are tested below
|
||||
needs = _all_green(workflow)
|
||||
needs[job]["result"] = result
|
||||
lines = _lines(workflow, needs, event)
|
||||
assert any(line.startswith("FAIL %s: job %s is %s. Fix: " % (label, job, result)) and line.endswith(RULE) for line in lines), (job, lines)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("workflow", ["tests", "e2e", "fakeweb"])
|
||||
def test_a_job_that_is_missing_is_red(workflow):
|
||||
for job in sorted(_table(workflow)):
|
||||
needs = _all_green(workflow)
|
||||
del needs[job]
|
||||
assert any("job %s is missing" % job in line for line in _lines(workflow, needs, _event_for(workflow))), job
|
||||
|
||||
|
||||
@pytest.mark.parametrize("workflow", ["tests", "e2e", "fakeweb"])
|
||||
def test_a_job_the_table_does_not_know_is_red(workflow):
|
||||
needs = _all_green(workflow)
|
||||
needs["brand-new"] = {"result": "success", "outputs": {}}
|
||||
label = ci_gate.TABLES[workflow][0]
|
||||
assert any(line.startswith("FAIL %s: job brand-new is success" % label) for line in _lines(workflow, needs, _event_for(workflow)))
|
||||
|
||||
|
||||
@pytest.mark.parametrize("name", sorted(VERDICTS))
|
||||
def test_the_table_has_an_entry_for_every_job_the_verdict_needs_and_nothing_else(name):
|
||||
workflow = VERDICTS[name][0]
|
||||
needed = _needs_of_verdict(name)
|
||||
assert sorted(needed) == sorted(_table(workflow)), "%s: needs %s, table %s" % (name, sorted(needed), sorted(_table(workflow)))
|
||||
assert all(_table(workflow)[job].strip() for job in needed), "every entry says what to do"
|
||||
|
||||
|
||||
def test_version_runs_in_the_queue_and_on_a_pull_request_and_is_skipped_on_a_push():
|
||||
for event in ("pull_request", "merge_group"):
|
||||
assert ci_gate.CONDITIONAL["version"] and event in ci_gate.CONDITIONAL["version"]
|
||||
needs = _all_green("tests")
|
||||
needs["version"]["result"] = "skipped"
|
||||
assert any("job version is skipped" in line for line in _lines("tests", needs, event)), event
|
||||
needs = _all_green("tests")
|
||||
needs["version"]["result"] = "skipped"
|
||||
assert _lines("tests", needs, "push") == []
|
||||
needs["version"]["result"] = "failure"
|
||||
assert any("job version is failure" in line for line in _lines("tests", needs, "push"))
|
||||
|
||||
|
||||
def test_the_final_seed_shards_run_exactly_when_the_page_oracle_is_touched():
|
||||
for name in ci_gate.E2E_BY_OUTPUT:
|
||||
needs = _all_green("e2e", touched="true")
|
||||
needs[name]["result"] = "skipped"
|
||||
assert any("job %s is skipped" % name in line for line in _lines("e2e", needs, "merge_group")), "touched, and a shard did not run"
|
||||
needs = _all_green("e2e", touched="false")
|
||||
assert _lines("e2e", needs, "merge_group") == [], "not touched: the shards are skipped on purpose"
|
||||
needs[name]["result"] = "failure"
|
||||
assert any("job %s is failure" % name in line for line in _lines("e2e", needs, "merge_group"))
|
||||
needs = _all_green("e2e", touched="true")
|
||||
needs["e2e-page-final-touched"]["result"] = "skipped"
|
||||
assert any("job e2e-page-final-touched is skipped" in line for line in _lines("e2e", needs, "merge_group")), "the job that decides must run in the queue run"
|
||||
|
||||
|
||||
def test_the_dispatch_of_the_windows_job_alone_skips_what_it_leaves_out_and_nothing_else():
|
||||
needs = {name: {"result": "skipped", "outputs": {}} for name in ci_gate.E2E_FIX}
|
||||
for name in ("changes", "core-on-index", "e2e-windows-control-a"):
|
||||
needs[name]["result"] = "success"
|
||||
assert _lines("e2e", needs, "workflow_dispatch", "windows-control-a") == []
|
||||
assert any("job e2e-windows is skipped" in line for line in _lines("e2e", needs, "workflow_dispatch", "")), "a full run does not forgive a skipped job"
|
||||
needs["e2e-windows-control-a"]["result"] = "skipped"
|
||||
assert any("job e2e-windows-control-a is skipped" in line for line in _lines("e2e", needs, "workflow_dispatch", "windows-control-a"))
|
||||
|
||||
|
||||
def test_the_jobs_that_may_be_skipped_are_the_ones_the_workflow_says_it_skips():
|
||||
text = _text("e2e.yml")
|
||||
jobs = _jobs(text)
|
||||
only = {j for j, body in jobs.items() if re.search(r"^ if: .*inputs\.only != 'windows-control-a'", body, re.M)}
|
||||
by_output = {j for j, body in jobs.items() if re.search(r"^ if: needs\.changes\.outputs\.run == 'true' && needs\.[A-Za-z0-9_-]+\.outputs\.[a-z]+ == 'true'\s*$", body, re.M)}
|
||||
assert by_output == set(ci_gate.E2E_BY_OUTPUT), by_output
|
||||
assert set(ci_gate.E2E_NARROWED) - set(ci_gate.E2E_BY_OUTPUT) == only, (sorted(only), ci_gate.E2E_NARROWED)
|
||||
for job, (decider, output, value) in ci_gate.E2E_BY_OUTPUT.items():
|
||||
assert "needs.%s.outputs.%s == '%s'" % (decider, output, value) in jobs[job], job
|
||||
assert decider in _needs(jobs[job]) and "%s: ${{ steps.%s.outputs.%s }}" % (output, output, output) in jobs[decider]
|
||||
conditional = {j for j, body in jobs.items() if re.search(r"^ if: .*event_name", body, re.M)}
|
||||
assert conditional == set(ci_gate.E2E_CONDITIONAL), conditional
|
||||
assert set(_triggers(text)) >= {"merge_group"} and all("merge_group" in ci_gate.E2E_CONDITIONAL[j] for j in conditional)
|
||||
fake = _jobs(_text("fakeweb.yml"))
|
||||
assert all(re.search(r"^ if: needs\.changes\.outputs\.run == 'true'\s*$", body, re.M) for j, body in fake.items() if j not in ("verdict", "changes")), "a job of fakeweb.yml runs on `changes` and on nothing else"
|
||||
|
||||
|
||||
def test_the_conditional_jobs_of_tests_yml_are_the_ones_whose_if_reads_the_event():
|
||||
jobs = _jobs(_text("tests.yml"))
|
||||
conditional = {j for j, body in jobs.items() if re.search(r"^ if: .*event_name", body, re.M)}
|
||||
assert conditional == set(ci_gate.CONDITIONAL) == {"version"}, conditional
|
||||
|
||||
|
||||
def _run(workflow: str, needs: dict, event: str, only: str = "") -> subprocess.CompletedProcess:
|
||||
env = {k: v for k, v in os.environ.items() if k not in ("NEEDS", "EVENT_NAME", "WORKFLOW", "INPUT_ONLY", "CHANGES_RUN")}
|
||||
env.update(NEEDS=json.dumps(needs), EVENT_NAME=event, INPUT_ONLY=only, CHANGES_RUN="true")
|
||||
if workflow:
|
||||
env["WORKFLOW"] = workflow
|
||||
return subprocess.run([sys.executable, str(SCRIPT)], env=env, capture_output=True, text=True, timeout=60)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("workflow", ["tests", "e2e", "fakeweb"])
|
||||
def test_the_script_exits_0_on_green_and_1_with_the_verdict_job_named_on_a_skipped_job(workflow):
|
||||
done = _run(workflow, _all_green(workflow), _event_for(workflow))
|
||||
assert done.returncode == 0 and done.stdout.splitlines()[-1] == "ok", done.stdout
|
||||
needs = _all_green(workflow)
|
||||
first = sorted(j for j in _table(workflow) if j not in ci_gate.E2E_BY_OUTPUT and j not in ci_gate.E2E_CONDITIONAL and j != "version")[0]
|
||||
needs[first]["result"] = "skipped"
|
||||
done = _run(workflow, needs, _event_for(workflow))
|
||||
assert done.returncode == 1 and "FAIL %s: job %s is skipped. Fix: " % (ci_gate.TABLES[workflow][0], first) in done.stdout, done.stdout
|
||||
|
||||
|
||||
def test_the_default_workflow_is_tests_and_an_unknown_one_is_red():
|
||||
assert _run("", _all_green("tests"), "pull_request").returncode == 0
|
||||
done = _run("nope", _all_green("tests"), "pull_request")
|
||||
assert done.returncode == 1 and done.stdout.startswith("FAIL gate: WORKFLOW is 'nope'")
|
||||
done = _run("e2e", _all_green("tests"), "merge_group")
|
||||
assert done.returncode == 1, "the tables of another workflow are not forgiven"
|
||||
Reference in new issue
Block a user