Skip to content

Commit 06b91cc

Browse files
authored
Merge branch 'main' into forward-data-to-compile-req-binary
2 parents 9b8b29b + bcaf08a commit 06b91cc

119 files changed

Lines changed: 9261 additions & 2615 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.agents/rules/bzl.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
trigger: glob
3+
description: Starlark / Bazel .bzl file coding style rules
4+
globs: *.bzl
5+
---
6+
7+
# Starlark Rules
8+
9+
* Use triple-quoted strings for multi-line rule doc args.
10+
* Don't use backslash line continuation in rule doc args.

.bazelci/presubmit.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ buildifier:
8484
coverage_targets: ["..."]
8585
.coverage_targets_example_bzlmod_build_file_generation: &coverage_targets_example_bzlmod_build_file_generation
8686
coverage_targets: ["//:bzlmod_build_file_generation_test"]
87+
.coverage_targets_bootstrap: &coverage_targets_bootstrap
88+
coverage_targets:
89+
- //tests/bootstrap_impls:stdlib_shadowing_system_python_test
8790
.coverage_targets_example_multi_python: &coverage_targets_example_multi_python
8891
coverage_targets:
8992
- //tests:my_lib_3_10_test
@@ -216,6 +219,7 @@ tasks:
216219
bazel: 7.x
217220
ubuntu:
218221
<<: *reusable_config
222+
<<: *coverage_targets_bootstrap
219223
name: "Default: Ubuntu, Bazel {bazel}"
220224
platform: ubuntu2204
221225
bazel: ${{ bazel }}

.bazelignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,4 @@ tests/integration/py_cc_toolchain_registered/bazel-py_cc_toolchain_registered
3737
tests/integration/toolchain_target_settings/bazel-module_under_test
3838
tests/integration/unified_pypi/bazel-unified_pypi
3939
tests/integration/uv_lock/bazel-uv_lock
40+
tests/integration/validate_test_main/bazel-module_under_test

.bazelrc.deleted_packages

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ common --deleted_packages=tests/integration/runtime_manifests
4242
common --deleted_packages=tests/integration/toolchain_target_settings
4343
common --deleted_packages=tests/integration/unified_pypi
4444
common --deleted_packages=tests/integration/uv_lock
45+
common --deleted_packages=tests/integration/validate_test_main
4546
common --deleted_packages=tests/modules/another_module
4647
common --deleted_packages=tests/modules/other
4748
common --deleted_packages=tests/modules/other/nspkg_delta

.github/ISSUE_TEMPLATE/release_tracking_template.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name: Release Tracking Issue
33
about: Checklist for tracking a new release of rules_python.
44
title: 'Release <version>'
5-
labels: ['type:release']
5+
labels: ['type: release']
66
---
77
# Release tasks
88
- [ ] Prepare Release | status=awaiting-preparation
@@ -11,16 +11,22 @@ labels: ['type:release']
1111
- [ ] Tag Final
1212

1313
## Backports
14-
<!-- Items to be cherry-picked into the next RC go here -->
14+
15+
To request a backport, add it to the checklist below and process it. See [RELEASING.md: How to add backports](https://github.com/bazel-contrib/rules_python/blob/main/RELEASING.md#how-to-add-backports) for details.
1516

1617
---
17-
*Maintainers: Automation will react to changes on this issue.*
18+
19+
To manually control the release flow, see the [RELEASING.md: Manual Editing](https://github.com/bazel-contrib/rules_python/blob/main/RELEASING.md#manual-editing-of-tracking-issue) section.
1820

1921
<details>
2022
<summary><b>Available Commands</b></summary>
2123

22-
Maintainers can trigger automation by running manual workflows:
23-
- [Process Backports Workflow](https://github.com/bazel-contrib/rules_python/actions/workflows/process_backports.yml)
24-
- [Generate RC Tag Workflow](https://github.com/bazel-contrib/rules_python/actions/workflows/generate_rc.yml)
25-
- [Promote RC to Final Release Workflow](https://github.com/bazel-contrib/rules_python/actions/workflows/promote_rc.yml)
24+
Comment commands:
25+
- `/prepare`: Determines version, creates tracking issue and preparation PR.
26+
- `/create-rc`: Tags and publishes a new release candidate (RC).
27+
- `/process-backports`: Cherry-picks pending backports.
28+
- `/add-backports <PRs>`: Adds PRs to the backports and processes backports.
29+
- `/promote`: Promotes the latest RC to final release.
30+
31+
See [RELEASING.md](https://github.com/bazel-contrib/rules_python/blob/main/RELEASING.md) for details on how to use them.
2632
</details>

.github/workflows/check_version_markers.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,8 @@ grep_exit_code=0
2020
# Exclude CONTRIBUTING.md, RELEASING.md because they document how to use these strings.
2121
grep --exclude=CONTRIBUTING.md \
2222
--exclude=RELEASING.md \
23-
--exclude=release.py \
24-
--exclude=release_test.py \
2523
--exclude-dir=.* \
24+
--exclude-dir=release \
2625
VERSION_NEXT_ -r || grep_exit_code=$?
2726

2827
if [[ $grep_exit_code -eq 0 ]]; then

.github/workflows/on_comment.yaml

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
name: "On Comment"
2+
3+
on:
4+
issue_comment:
5+
types: [created]
6+
7+
permissions:
8+
contents: write
9+
issues: write
10+
pull-requests: write
11+
12+
jobs:
13+
# This job always runs to prevent GHA from marking the run as failed when
14+
# all other jobs are skipped.
15+
noop:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- run: echo "No-op"
19+
20+
parse_comment:
21+
runs-on: ubuntu-latest
22+
if: |
23+
github.event.comment.author_association == 'OWNER' ||
24+
github.event.comment.author_association == 'MEMBER' ||
25+
github.event.comment.author_association == 'COLLABORATOR'
26+
outputs:
27+
command: ${{ steps.parse.outputs.command }}
28+
issue_number: ${{ steps.parse.outputs.issue_number }}
29+
pr_number: ${{ steps.parse.outputs.pr_number }}
30+
backports: ${{ steps.parse.outputs.backports }}
31+
steps:
32+
- name: Parse comment
33+
id: parse
34+
env:
35+
COMMENT_BODY: ${{ github.event.comment.body }}
36+
IS_PR: "${{ github.event.issue.pull_request != null }}"
37+
EVENT_NUMBER: "${{ github.event.issue.number }}"
38+
HAS_RELEASE_LABEL: "${{ contains(github.event.issue.labels.*.name, 'type: release') }}"
39+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40+
run: |
41+
if [ "$IS_PR" = "false" ] && [ "$HAS_RELEASE_LABEL" = "true" ]; then
42+
issue_number=$EVENT_NUMBER
43+
if echo "$COMMENT_BODY" | grep -qE '^[[:space:]]*/create-rc([[:space:]]|$)'; then
44+
echo "command=create-rc" >> "$GITHUB_OUTPUT"
45+
echo "issue_number=$issue_number" >> "$GITHUB_OUTPUT"
46+
elif echo "$COMMENT_BODY" | grep -qE '^[[:space:]]*/prepare([[:space:]]|$)'; then
47+
echo "command=prepare" >> "$GITHUB_OUTPUT"
48+
echo "issue_number=$issue_number" >> "$GITHUB_OUTPUT"
49+
elif echo "$COMMENT_BODY" | grep -qE '^[[:space:]]*/process-backports([[:space:]]|$)'; then
50+
echo "command=process-backports" >> "$GITHUB_OUTPUT"
51+
echo "issue_number=$issue_number" >> "$GITHUB_OUTPUT"
52+
elif echo "$COMMENT_BODY" | grep -qE '^[[:space:]]*/add-backports([[:space:]]|$)'; then
53+
args=$(echo "$COMMENT_BODY" | grep -E '^[[:space:]]*/add-backports([[:space:]]|$)' | sed -E 's/^[[:space:]]*\/add-backports[[:space:]]*//')
54+
args=$(echo "$args" | sed -e 's/^[[:space:],]*//' -e 's/[[:space:],]*$//')
55+
csv=$(echo "$args" | sed -E 's/[[:space:],]+/ /g' | tr ' ' ',')
56+
if [ -n "$csv" ]; then
57+
echo "command=add-backports" >> "$GITHUB_OUTPUT"
58+
echo "backports=$csv" >> "$GITHUB_OUTPUT"
59+
echo "issue_number=$issue_number" >> "$GITHUB_OUTPUT"
60+
else
61+
echo "command=none" >> "$GITHUB_OUTPUT"
62+
echo "Error: No PRs specified for add-backports." >&2
63+
gh api \
64+
--method POST \
65+
-H "Accept: application/vnd.github+json" \
66+
-H "X-GitHub-Api-Version: 2022-11-28" \
67+
/repos/${{ github.repository }}/issues/comments/${{ github.event.comment.id }}/reactions \
68+
-f "content=-1"
69+
fi
70+
elif echo "$COMMENT_BODY" | grep -qE '^[[:space:]]*/promote([[:space:]]|$)'; then
71+
echo "command=promote" >> "$GITHUB_OUTPUT"
72+
echo "issue_number=$issue_number" >> "$GITHUB_OUTPUT"
73+
else
74+
echo "command=none" >> "$GITHUB_OUTPUT"
75+
fi
76+
elif [ "$IS_PR" = "true" ]; then
77+
pr_number=$EVENT_NUMBER
78+
if echo "$COMMENT_BODY" | grep -qE '^[[:space:]]*/backport([[:space:]]|$)'; then
79+
echo "command=pr-backport" >> "$GITHUB_OUTPUT"
80+
echo "pr_number=$pr_number" >> "$GITHUB_OUTPUT"
81+
else
82+
echo "command=none" >> "$GITHUB_OUTPUT"
83+
fi
84+
else
85+
echo "command=none" >> "$GITHUB_OUTPUT"
86+
fi
87+
88+
call_create_rc:
89+
needs: parse_comment
90+
if: needs.parse_comment.outputs.command == 'create-rc'
91+
uses: ./.github/workflows/release_create_rc.yaml
92+
with:
93+
issue: ${{ needs.parse_comment.outputs.issue_number }}
94+
comment_id: "${{ github.event.comment.id }}"
95+
secrets: inherit
96+
97+
call_prepare:
98+
needs: parse_comment
99+
if: needs.parse_comment.outputs.command == 'prepare'
100+
uses: ./.github/workflows/release_prepare.yaml
101+
with:
102+
issue: ${{ needs.parse_comment.outputs.issue_number }}
103+
secrets: inherit
104+
105+
call_add_backports:
106+
needs: parse_comment
107+
if: |
108+
needs.parse_comment.outputs.command == 'add-backports' ||
109+
needs.parse_comment.outputs.command == 'pr-backport'
110+
uses: ./.github/workflows/release_add_backports.yaml
111+
with:
112+
prs: ${{ needs.parse_comment.outputs.command == 'pr-backport' && needs.parse_comment.outputs.pr_number || needs.parse_comment.outputs.backports }}
113+
issue: ${{ needs.parse_comment.outputs.issue_number }}
114+
secrets: inherit
115+
116+
call_process_backports_after_add:
117+
needs: [parse_comment, call_add_backports]
118+
if: needs.parse_comment.outputs.command == 'add-backports'
119+
uses: ./.github/workflows/release_process_backports.yaml
120+
with:
121+
issue: ${{ needs.parse_comment.outputs.issue_number }}
122+
comment_id: "${{ github.event.comment.id }}"
123+
secrets: inherit
124+
125+
call_process_backports_only:
126+
needs: parse_comment
127+
if: needs.parse_comment.outputs.command == 'process-backports'
128+
uses: ./.github/workflows/release_process_backports.yaml
129+
with:
130+
issue: ${{ needs.parse_comment.outputs.issue_number }}
131+
comment_id: "${{ github.event.comment.id }}"
132+
secrets: inherit
133+
134+
call_promote:
135+
needs: parse_comment
136+
if: needs.parse_comment.outputs.command == 'promote'
137+
uses: ./.github/workflows/release_promote_rc.yaml
138+
with:
139+
issue: ${{ needs.parse_comment.outputs.issue_number }}
140+
secrets: inherit
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
name: "On PR Closed"
2+
3+
on:
4+
pull_request:
5+
types: [closed]
6+
7+
permissions:
8+
contents: read
9+
issues: read
10+
pull-requests: read
11+
12+
jobs:
13+
# This job always runs to prevent GHA from marking the run as failed when
14+
# all other jobs are skipped.
15+
noop:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- run: echo "No-op"
19+
20+
check_if_backport:
21+
runs-on: ubuntu-latest
22+
if: github.event.pull_request.merged == true
23+
outputs:
24+
should_process: ${{ steps.check.outputs.should_process }}
25+
steps:
26+
- name: Check if PR is a backport candidate
27+
id: check
28+
env:
29+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30+
PR_NUMBER: ${{ github.event.pull_request.number }}
31+
run: |
32+
# Check if there is any active release issue
33+
ACTIVE_ISSUES=$(gh issue list --repo ${{ github.repository }} --label "type: release" --state open --json number)
34+
if [ "$ACTIVE_ISSUES" = "[]" ] || [ -z "$ACTIVE_ISSUES" ]; then
35+
echo "No active release tracking issue found. Skipping."
36+
echo "should_process=false" >> "$GITHUB_OUTPUT"
37+
exit 0
38+
fi
39+
40+
# Check if PR has "/backport" in comments (only comments, not body)
41+
PR_DATA=$(gh pr view "$PR_NUMBER" --repo ${{ github.repository }} --json comments)
42+
43+
if echo "$PR_DATA" | jq -r '.comments[].body' | grep -qE '^[[:space:]]*/backport([[:space:]]|$)'; then
44+
echo "Found /backport comment. Proceeding."
45+
echo "should_process=true" >> "$GITHUB_OUTPUT"
46+
else
47+
echo "No /backport comment found. Skipping."
48+
echo "should_process=false" >> "$GITHUB_OUTPUT"
49+
fi
50+
51+
process_backports:
52+
needs: check_if_backport
53+
if: needs.check_if_backport.outputs.should_process == 'true'
54+
runs-on: ubuntu-latest
55+
permissions:
56+
contents: write
57+
issues: write
58+
pull-requests: read
59+
steps:
60+
- name: Checkout repository
61+
uses: actions/checkout@v7
62+
with:
63+
fetch-depth: 0
64+
65+
- name: Setup Bazel
66+
uses: bazel-contrib/setup-bazel@0.19.0
67+
with:
68+
bazelisk-version: 1.20.0
69+
70+
- name: Configure Git Identity
71+
run: |
72+
git config --global user.name "github-actions[bot]"
73+
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
74+
75+
- name: Process Backports
76+
env:
77+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
78+
PR_NUMBER: ${{ github.event.pull_request.number }}
79+
run: |
80+
bazel run //tools/private/release -- on-pr-merged \
81+
"$PR_NUMBER" \
82+
--remote origin \
83+
--no-dry-run
84+
85+
complete_sync_changelog:
86+
if: |
87+
github.event.pull_request.merged == true &&
88+
contains(github.event.pull_request.labels.*.name, 'type: sync-changelog')
89+
runs-on: ubuntu-latest
90+
permissions:
91+
contents: write
92+
issues: write
93+
pull-requests: read
94+
steps:
95+
- name: Checkout repository
96+
uses: actions/checkout@v7
97+
with:
98+
fetch-depth: 0
99+
100+
- name: Setup Bazel
101+
uses: bazel-contrib/setup-bazel@0.19.0
102+
with:
103+
bazelisk-version: 1.20.0
104+
105+
- name: Complete Sync Changelog
106+
env:
107+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
108+
PR_NUMBER: ${{ github.event.pull_request.number }}
109+
run: |
110+
bazel run //tools/private/release -- complete-sync-changelog \
111+
--pr "$PR_NUMBER"
112+
113+

.github/workflows/prepare_release.yml

Lines changed: 0 additions & 36 deletions
This file was deleted.

0 commit comments

Comments
 (0)