Skip to content

Commit 1635ed9

Browse files
authored
ci: Skip macOS tests in forks (#27017)
## Which issue does this PR close? Related to #25148. ## Rationale for this change Fork CI can fail waiting for a macOS runner before any tests start, blocking the `Rust (fork)` check. ## What changes are included in this PR? Skip macOS tests in fork repositories, register the condition with the existing workflow validator, and document the exclusion in the contributor guide. Upstream coverage is unchanged, including the required merge-queue check, following apache/arrow-rs#11991. Windows remains unchanged; its job is already disabled. ## What is the testing strategy for this PR? Existing workflow-validator tests, all-features Clippy, and all checks in `./dev/rust_lint.sh` pass. No new tests: the existing validator checks exact job conditions against the policy table. ## Are there any user-facing changes? Contributors no longer need a macOS runner for fork CI. No runtime or API changes.
1 parent d38fde4 commit 1635ed9

3 files changed

Lines changed: 12 additions & 6 deletions

File tree

‎.github/workflows/rust.yml‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@
5050
# # Pull requests from forks
5151
#
5252
# A PR from a fork runs this workflow on the fork, on the contributor's own
53-
# runners, and `fork_ci_status.yml` mirrors that run as the `Rust (fork)` check
53+
# runners, except macOS, which runs upstream, including in the merge queue.
54+
# `fork_ci_status.yml` mirrors that run as the `Rust (fork)` check
5455
# on the PR. Upstream runs `check-fmt`, `check-workflow-tool-installs`, and
5556
# `examples-check-datafusion-crates` for such a PR; the other jobs carry an
5657
# `if:` that skips them. The merge queue runs every job on the merged result,
@@ -762,7 +763,7 @@ jobs:
762763
# flaky sqllogictest metrics.
763764
macos-aarch64:
764765
name: cargo test (macos-aarch64)
765-
if: ${{ !(github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork && github.base_ref == 'main') }}
766+
if: ${{ !(github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork && github.base_ref == 'main') && !(github.repository != 'apache/datafusion') }}
766767
runs-on: macos-15
767768
steps:
768769
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

‎ci/scripts/check_rust_workflow_skips.py‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"""
77
Validate the job-level skip conditions in rust.yml.
88
9-
rust.yml skips jobs on two events. Each skip set below pairs a clause with
9+
rust.yml skips jobs by event and repository. Each skip set below pairs a clause with
1010
the jobs that carry it: a job's `if:` is exactly `!(clause)` for every set
1111
it belongs to, joined with ` && ` in the order of SKIP_POLICIES, and a job
1212
in no set carries no job-level `if:`. A new job therefore runs everywhere
@@ -95,9 +95,13 @@
9595
}
9696
)
9797

98+
FORK_REPOSITORY = "github.repository != 'apache/datafusion'"
99+
FORK_REPO_SKIPPED_JOBS = frozenset({"macos-aarch64"})
100+
98101
SKIP_POLICIES = (
99102
("POST_MERGE_SKIPPED_JOBS", POST_MERGE_SKIPPED_JOBS, POST_MERGE_PUSH),
100103
("FORK_PR_SKIPPED_JOBS", FORK_PR_SKIPPED_JOBS, FORK_PULL_REQUEST),
104+
("FORK_REPO_SKIPPED_JOBS", FORK_REPO_SKIPPED_JOBS, FORK_REPOSITORY),
101105
)
102106

103107

@@ -183,9 +187,7 @@ def check_skip_conditions(workflow, required_checks):
183187
f" - job `{job}` is not in {set_name} but needs "
184188
f"{blocked}; GitHub would skip it with them"
185189
)
186-
# Only the merge queue gates a job that skips after the merge. A job
187-
# that skips on a fork PR still runs on the fork, in the queue, and on
188-
# main.
190+
# Only the merge queue gates a job that skips after the merge.
189191
if required_checks and set_name == "POST_MERGE_SKIPPED_JOBS":
190192
for job in sorted(members & set(jobs)):
191193
name = jobs[job].get("name", job)

‎docs/source/contributor-guide/index.md‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,9 @@ such a pull request and adds a `Rust (fork)` check that links to the run on
275275
your fork. The merge queue runs the full workflow on the merged result before
276276
a pull request merges, so a green fork run does not replace it.
277277

278+
macOS tests skip fork runs to avoid runner timeouts. They remain required in the
279+
merge queue, and other upstream coverage is unchanged.
280+
278281
To make this work:
279282

280283
1. Before you push your branch, open the **Actions** tab on your fork.

0 commit comments

Comments
 (0)