Skip to content
Open
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
23 changes: 22 additions & 1 deletion .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@ jobs:
echo "git_commit: $GIT_COMMIT"
echo "cpython_release: $CPYTHON_RELEASE"

{
echo "| Variable | Value |"
echo "| --------------- | -------------------- |"
echo "| git_remote | \`$GIT_REMOTE\` |"
echo "| git_commit | \`$GIT_COMMIT\` |"
echo "| cpython_release | \`$CPYTHON_RELEASE\` |"
} >> "$GITHUB_STEP_SUMMARY"

- name: "Checkout python/release-tools"
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
Expand Down Expand Up @@ -89,7 +97,20 @@ jobs:
- name: "Select jobs"
id: select-jobs
run: |
./select_jobs.py "$CPYTHON_RELEASE" | tee -a "$GITHUB_OUTPUT"
test_flag=""
if [[ "${{ github.event_name }}" != "workflow_dispatch" ]]; then
test_flag="--test"
fi
output=$(./select_jobs.py $test_flag "$CPYTHON_RELEASE")
echo "$output" | tee -a "$GITHUB_OUTPUT"

{
echo "| Job | Enabled |"
echo "| ------- | ------- |"
echo "$output" | while IFS='=' read -r key value; do
echo "| $key | $value |"
done
} >> "$GITHUB_STEP_SUMMARY"

build-source:
runs-on: ubuntu-24.04
Expand Down
13 changes: 13 additions & 0 deletions select_jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,22 @@ def output(key: str, value: bool) -> None:
def main() -> None:
parser = argparse.ArgumentParser()
parser.add_argument("version", type=Tag)
parser.add_argument(
"--test",
action="store_true",
help="Enable all jobs for testing",
)
args = parser.parse_args()
version = args.version

if args.test:
# When testing the workflow itself (push/PR),
# enable all jobs for full coverage.
output("docs", True)
output("android", True)
output("ios", True)
return

# Docs are only built for stable releases or release candidates.
output("docs", version.level in ["rc", "f"])

Expand Down
25 changes: 25 additions & 0 deletions tests/test_select_jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,28 @@ def test_select_jobs(
ios={ios}
"""
)


@pytest.mark.parametrize(
"version",
[
"3.13.0a1",
"3.13.0",
"3.14.0b2",
"3.15.0a1",
],
)
def test_select_jobs_test_mode(
version: str,
monkeypatch: pytest.MonkeyPatch,
capsys: pytest.CaptureFixture[str],
) -> None:
monkeypatch.setattr(sys, "argv", ["select_jobs.py", "--test", version])
select_jobs.main()
assert capsys.readouterr().out == dedent(
"""\
docs=true
android=true
ios=true
"""
)
Loading