Skip to content

Commit 4e6033d

Browse files
authored
Infra: Enable Merge Queue with required CI gates (#3832)
* Infra: Require CI checks before auto-merge * Infra: Group required CI contexts * Infra: Add stable required CI gates * Infra: Remove repeated workflow comments * Infra: Enable GitHub Merge Queue * Infra: Remove unsupported CodeQL queue gate * Infra: Document required CI dependencies
1 parent 47ba4aa commit 4e6033d

10 files changed

Lines changed: 78 additions & 26 deletions

.asf.yaml

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,44 @@ github:
3636
protected_branches:
3737
main:
3838
required_status_checks:
39-
# strict means "Require branches to be up to date before merging".
40-
strict: true
39+
contexts:
40+
# Repository policy and security checks.
41+
- Analyze Actions
42+
- Run zizmor 🌈
43+
- asf-allowlist-check
44+
- rat
45+
46+
# Documentation checks.
47+
- docs
48+
- markdown-link-check
49+
50+
# Python workflow gates.
51+
- python-ci-required
52+
- python-integration-required
4153

4254
required_pull_request_reviews:
4355
required_approving_review_count: 1
4456

4557
required_linear_history: true
58+
rulesets:
59+
- name: Merge Queue
60+
target: branch
61+
enforcement: active
62+
conditions:
63+
ref_name:
64+
include:
65+
- "~DEFAULT_BRANCH"
66+
exclude: []
67+
rules:
68+
- type: merge_queue
69+
parameters:
70+
check_response_timeout_minutes: 90
71+
grouping_strategy: ALLGREEN
72+
max_entries_to_build: 1
73+
max_entries_to_merge: 1
74+
merge_method: SQUASH
75+
min_entries_to_merge: 1
76+
min_entries_to_merge_wait_minutes: 0
4677
pull_requests:
4778
# allow pull requests to merge automatically once all requirements are met
4879
allow_auto_merge: true

.github/workflows/asf-allowlist-check.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ name: "ASF Allowlist Check"
2525

2626
on:
2727
pull_request:
28+
merge_group:
2829
push:
2930
branches:
3031
- main

.github/workflows/check-md-link.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@ on:
2727
branches:
2828
- 'main'
2929
pull_request:
30-
paths:
31-
- '.github/workflows/check-md-link.yml'
32-
- 'mkdocs/**'
30+
merge_group:
3331
workflow_dispatch:
3432

3533
permissions:

.github/workflows/codeql.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ on:
2424
branches: [ "main" ]
2525
pull_request:
2626
branches: [ "main" ]
27+
merge_group:
2728
schedule:
2829
- cron: '16 4 * * 1'
2930

.github/workflows/license_check.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
#
1919

2020
name: "Run License Check"
21-
on: pull_request
21+
on:
22+
pull_request:
23+
merge_group:
2224

2325
permissions:
2426
contents: read

.github/workflows/python-ci-docs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ on:
2424
branches:
2525
- 'main'
2626
pull_request:
27+
merge_group:
2728

2829
permissions:
2930
contents: read

.github/workflows/python-ci.yml

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,7 @@ on:
2424
branches:
2525
- 'main'
2626
pull_request:
27-
paths:
28-
- '**' # Include all files and directories in the repository by default.
29-
- '!.github/workflows/**' # Exclude all workflow files
30-
- '.github/workflows/python-ci.yml' # except the current file.
31-
- '!.github/ISSUE_TEMPLATE/**' # Exclude files and directories that don't impact tests or code like templates, metadata, and documentation.
32-
- '!.gitignore'
33-
- '!.asf.yml'
34-
- '!mkdocs/**'
35-
- '!.gitattributes'
36-
- '!README.md'
37-
- '!CONTRIBUTING.md'
38-
- '!LICENSE'
39-
- '!NOTICE'
27+
merge_group:
4028

4129
permissions:
4230
contents: read
@@ -127,3 +115,17 @@ jobs:
127115
run: uv sync --directory . --only-group dev --no-install-project
128116
- name: Mirror wheel CIBW_TEST_COMMAND
129117
run: uv run --directory . pytest tests/avro/test_decoder.py
118+
119+
python-ci-required:
120+
if: ${{ always() }}
121+
needs: [lint-and-unit-test, windows-unit-test, cibw-dev-env-smoke-test]
122+
runs-on: ubuntu-latest
123+
steps:
124+
- name: Verify Python CI jobs succeeded
125+
env:
126+
RESULTS: ${{ join(needs.*.result, ' ') }}
127+
run: |
128+
read -ra results <<< "$RESULTS"
129+
for result in "${results[@]}"; do
130+
test "$result" = "success"
131+
done

.github/workflows/python-integration.yml

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,7 @@ on:
2424
branches:
2525
- 'main'
2626
pull_request:
27-
paths: # Only run integration tests when Python (or the code they exercise) changes.
28-
- '**/*.py'
29-
- 'pyproject.toml'
30-
- 'uv.lock'
31-
- 'Makefile'
32-
- 'dev/**' # docker-compose files and fixtures used by the integration suites.
33-
- '.github/workflows/python-integration.yml' # this file itself.
27+
merge_group:
3428

3529
permissions:
3630
contents: read
@@ -183,3 +177,17 @@ jobs:
183177
merge-multiple: true
184178
- name: Generate coverage report (75%) # Coverage threshold should only increase over time — never decrease it!
185179
run: COVERAGE_FAIL_UNDER=75 make coverage-report
180+
181+
python-integration-required:
182+
if: ${{ always() }}
183+
needs: [integration-test, integration-test-s3, integration-test-adls, integration-test-gcs, integration-coverage-report]
184+
runs-on: ubuntu-latest
185+
steps:
186+
- name: Verify Python integration jobs succeeded
187+
env:
188+
RESULTS: ${{ join(needs.*.result, ' ') }}
189+
run: |
190+
read -ra results <<< "$RESULTS"
191+
for result in "${results[@]}"; do
192+
test "$result" = "success"
193+
done

.github/workflows/zizmor.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ on:
2424
branches: ["main"]
2525
pull_request:
2626
branches: ["**"]
27+
merge_group:
2728

2829
permissions: {}
2930

AGENTS.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,13 @@ lives under `pyiceberg/`, organized by concern rather than by engine:
6262
- Use existing test fixtures when possible.
6363
- We have a strong bias towards integration testing over mocks. Mocks should be avoided whenever possible and should only be used if similar, existing tests are using mocks.
6464

65+
### Required CI and Merge Queue
66+
67+
- Keep the `required_status_checks.contexts` list in `.asf.yaml` synchronized whenever a required job/check is added, renamed, or removed. Each entry is a job/check context name, not a workflow filename.
68+
- Verify that every required context reports for both `pull_request` and `merge_group`. Its producer workflow must run on both events.
69+
- When a workflow uses an aggregate required job, such as `python-ci-required`, keep `if: always()` and its `needs` list in sync with every job whose result should block merging.
70+
- Do not use `pull_request` path filters in workflows that produce required contexts. A skipped workflow does not report its required context, which blocks pull requests and causes Merge Queue entries to time out.
71+
6572
## Commands
6673

6774
- **Install / set up dev env:** `make install` (installs `uv`, syncs all extras, builds Cython, installs pre-commit hooks)

0 commit comments

Comments
 (0)