Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions .github/workflows/ci-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3533,7 +3533,7 @@ jobs:
inputs = json.loads(os.environ["MACOS_INPUTS"])
needs = json.loads(os.environ["MACOS_NEEDS"])
# The caller leaves compile_admitted unset when its build-input reuse
# steps are skipped (full suite) or fail; unset means "compile", the
# steps are skipped (full suite or unit-ci) or fail; unset means "compile", the
# same reading the macos-compile-admission job condition uses.
if inputs.get("compile_admitted") == "":
inputs["compile_admitted"] = "false"
Expand All @@ -3551,9 +3551,14 @@ jobs:
# The package lane is routed from changed paths, so it is required
# whenever the router selected it even under the compile-only suite.
swift_packages = inputs["swift_packages"] == "true"
# `unit-ci` asks for app-host unit tests without the full suite, and
# clears suite-coverage on the strength of them, so a skip here must
# fail rather than read as a job nobody routed. Empty or missing
# means a caller that predates the input.
unit_suite = inputs.get("unit_suite", "") == "true"
required = {
"macos-compile-admission": macos and inputs["compile_admitted"] != "true",
"app-host-unit-tests": macos and full_suite,
"app-host-unit-tests": macos and (full_suite or unit_suite),
"swift-package-tests": (macos and full_suite) or swift_packages,
"tests-build-and-lag": macos and full_suite,
"release-admission": macos and full_suite and inputs["release_build"] == "true",
Expand Down
8 changes: 5 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,9 @@ jobs:
# compile. Each pull request run publishes its build-input fingerprint as
# an artifact name, and a compile-only run whose fingerprint an earlier run
# of the same in-org branch already compiled skips compile admission. Runs
# with the full suite always compile, because the shards need the product.
# with the full suite or unit-ci always compile, because the app-host
# shards need the product and only run behind a compile admission that
# succeeded in this run.
# The artifact name carries the run attempt, so a pass only vouches for the
# fingerprint published in its own attempt. These steps are an optimization:
# any of them failing leaves compile_admitted unset, which compiles.
Expand All @@ -596,7 +598,7 @@ jobs:
- name: Skip compile when build inputs are unchanged
id: unchanged_inputs
continue-on-error: true
if: ${{ steps.inputs.outputs.fingerprint != '' && steps.suite.outputs.full_suite == 'false' }}
if: ${{ steps.inputs.outputs.fingerprint != '' && steps.suite.outputs.full_suite == 'false' && steps.suite.outputs.unit_suite != 'true' }}
env:
# Both steps are pull-request-only, and the xcode= extra exists so the
# fingerprint moves when the pinned toolchain does. Read the same lane
Expand Down Expand Up @@ -635,7 +637,7 @@ jobs:
- name: Look for an earlier run that compiled these inputs
id: admitted
continue-on-error: true
if: ${{ steps.inputs.outputs.fingerprint != '' && steps.suite.outputs.full_suite == 'false' && steps.unchanged_inputs.outputs.compile_admitted != 'true' }}
if: ${{ steps.inputs.outputs.fingerprint != '' && steps.suite.outputs.full_suite == 'false' && steps.suite.outputs.unit_suite != 'true' && steps.unchanged_inputs.outputs.compile_admitted != 'true' }}
env:
GH_TOKEN: ${{ github.token }}
BRANCH: ${{ github.head_ref }}
Expand Down
29 changes: 29 additions & 0 deletions tests/test_ci_change_areas.py
Original file line number Diff line number Diff line change
Expand Up @@ -3466,6 +3466,35 @@ def test_a_unit_ci_run_still_requires_the_macos_workflow_to_pass() -> None:
assert "unit_suite" in gate.split("macos_work_required")[1].split(")")[0]


def test_a_unit_ci_run_cannot_pass_with_the_unit_tests_skipped() -> None:
# unit-ci clears suite-coverage, so the app-host tests it asked for are the
# only thing that judges the diff. Reusing an earlier run's compile skips
# compile admission, and app-host hangs off admission succeeding -- the
# usual label-after-first-push run would go green having run nothing.
for step in (
"Skip compile when build inputs are unchanged",
"Look for an earlier run that compiled these inputs",
):
condition = workflow_step_block("changes", step)
assert "steps.suite.outputs.unit_suite != 'true'" in condition, step

# And the status fails closed if the job the label asked for still skipped.
inputs = {
"macos": "true",
"full_suite": "false",
"unit_suite": "true",
"compile_admitted": "true",
"release_build": "false",
"source_identity_valid": "true",
"source_tree": "tree",
"source_parent1": "parent",
}
skipped = dict.fromkeys(MACOS_JOBS, "skipped")
assert run_macos_status(inputs=inputs, results=skipped).returncode != 0
ran = {**skipped, "app-host-unit-tests": "success"}
assert run_macos_status(inputs=inputs, results=ran).returncode == 0


def test_ci_status_requires_the_suite_coverage_gate() -> None:
block = workflow_job_block("ci-status")
assert " - suite-coverage" in block
Expand Down
Loading