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
96 changes: 88 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1143,6 +1143,50 @@ jobs:
git push origin main
fi

# ---------------------------------------------------------------------------
# Wait for the released stack to be installable from production PyPI.
#
# The wiki-currency checks below `pip install <lib>==<version>` from PyPI a
# few minutes after the upload. PyPI's simple index can lag that upload, and
# on 2026-11-06 and 2026-11-07 the autolens check ran before
# `autolens==<version>` was listed ("No matching distribution found"), which
# turned two fully shipped releases red (PyAutoHands#334). This job polls the
# index for every package, bypassing pip's cache, with a bounded wait, and
# fails loudly if a version never appears. It never falls back to an older or
# unpinned install.
# ---------------------------------------------------------------------------
wait_for_released_stack:
needs:
- resolve_mode
- version_number
- release_workspaces
if: "${{ needs.resolve_mode.outputs.rehearsal != 'true' }}"
runs-on: ubuntu-latest
steps:
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Wait for every released package on PyPI
env:
VERSION: ${{ needs.version_number.outputs.version_number }}
run: |
PACKAGES=(autonerves autoarray autofit autogalaxy autolens autocti)
# 60 attempts x 10s = 10 min per package, far beyond the ~3 min lag seen.
for PACKAGE in "${PACKAGES[@]}"; do
cnt=0
until python3 -m pip download --no-deps --no-cache-dir --dest /tmp/pyauto-stack \
--index-url https://pypi.org/simple/ "$PACKAGE==$VERSION" >/dev/null 2>&1; do
cnt=$((cnt+1))
if [ "$cnt" -ge 60 ]; then
echo "::error::$PACKAGE==$VERSION not installable from PyPI after 10 min"
exit 1
fi
echo " waiting for $PACKAGE==$VERSION on PyPI (attempt $cnt)"
sleep 10
done
echo "found $PACKAGE==$VERSION"
done

# ---------------------------------------------------------------------------
# Wiki-currency check (autolens_assistant).
#
Expand All @@ -1159,6 +1203,7 @@ jobs:
- resolve_mode
- version_number
- release_workspaces
- wait_for_released_stack
if: "${{ needs.resolve_mode.outputs.rehearsal != 'true' }}"
uses: PyAutoLabs/autolens_assistant/.github/workflows/wiki-currency.yml@main
with:
Expand All @@ -1176,6 +1221,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Download drift report
id: drift_report
continue-on-error: true
uses: actions/download-artifact@v4
with:
name: wiki-drift-report
Expand All @@ -1194,13 +1241,19 @@ jobs:
GH_TOKEN: ${{ steps.app_token.outputs.token }}
run: |
VERSION="${{ needs.version_number.outputs.version_number }}"
RUN_URL="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
BODY=drift/drift-report.md
TITLE="wiki drift detected at release $VERSION"
if [ ! -f "$BODY" ]; then
printf '# Wiki-currency drift at release %s\n\nThe check failed but no drift-report artifact was found; see the run logs.\n' "$VERSION" > "$BODY"
# No report means the check failed before grading anything (e.g. the
# released stack would not install), so this is not drift.
mkdir -p drift
printf '# Wiki-currency check could not complete at release %s\n\nThe check failed before producing a drift report, so no drift was graded. See the run: %s\n' "$VERSION" "$RUN_URL" > "$BODY"
TITLE="wiki-currency check could not complete at release $VERSION"
fi
gh issue create \
--repo PyAutoLabs/autolens_assistant \
--title "wiki drift detected at release $VERSION" \
--title "$TITLE" \
--body-file "$BODY" \
|| echo "::warning::could not open wiki-drift issue (non-fatal)"

Expand All @@ -1216,6 +1269,7 @@ jobs:
- resolve_mode
- version_number
- release_workspaces
- wait_for_released_stack
if: "${{ needs.resolve_mode.outputs.rehearsal != 'true' }}"
uses: PyAutoLabs/autofit_assistant/.github/workflows/wiki-currency.yml@main
with:
Expand All @@ -1230,6 +1284,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Download drift report
id: drift_report
continue-on-error: true
uses: actions/download-artifact@v4
with:
name: wiki-drift-report-autofit
Expand All @@ -1248,13 +1304,19 @@ jobs:
GH_TOKEN: ${{ steps.app_token.outputs.token }}
run: |
VERSION="${{ needs.version_number.outputs.version_number }}"
RUN_URL="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
BODY=drift/drift-report.md
TITLE="wiki drift detected at release $VERSION"
if [ ! -f "$BODY" ]; then
printf '# Wiki-currency drift at release %s\n\nThe check failed but no drift-report artifact was found; see the run logs.\n' "$VERSION" > "$BODY"
# No report means the check failed before grading anything (e.g. the
# released stack would not install), so this is not drift.
mkdir -p drift
printf '# Wiki-currency check could not complete at release %s\n\nThe check failed before producing a drift report, so no drift was graded. See the run: %s\n' "$VERSION" "$RUN_URL" > "$BODY"
TITLE="wiki-currency check could not complete at release $VERSION"
fi
gh issue create \
--repo PyAutoLabs/autofit_assistant \
--title "wiki drift detected at release $VERSION" \
--title "$TITLE" \
--body-file "$BODY" \
|| echo "::warning::could not open wiki-drift issue (non-fatal)"

Expand All @@ -1272,6 +1334,7 @@ jobs:
- resolve_mode
- version_number
- release_workspaces
- wait_for_released_stack
if: "${{ needs.resolve_mode.outputs.rehearsal != 'true' }}"
uses: PyAutoLabs/autogalaxy_assistant/.github/workflows/wiki-currency.yml@main
with:
Expand All @@ -1286,6 +1349,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Download drift report
id: drift_report
continue-on-error: true
uses: actions/download-artifact@v4
with:
name: wiki-drift-report-autogalaxy
Expand All @@ -1304,13 +1369,19 @@ jobs:
GH_TOKEN: ${{ steps.app_token.outputs.token }}
run: |
VERSION="${{ needs.version_number.outputs.version_number }}"
RUN_URL="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
BODY=drift/drift-report.md
TITLE="wiki drift detected at release $VERSION"
if [ ! -f "$BODY" ]; then
printf '# Wiki-currency drift at release %s\n\nThe check failed but no drift-report artifact was found; see the run logs.\n' "$VERSION" > "$BODY"
# No report means the check failed before grading anything (e.g. the
# released stack would not install), so this is not drift.
mkdir -p drift
printf '# Wiki-currency check could not complete at release %s\n\nThe check failed before producing a drift report, so no drift was graded. See the run: %s\n' "$VERSION" "$RUN_URL" > "$BODY"
TITLE="wiki-currency check could not complete at release $VERSION"
fi
gh issue create \
--repo PyAutoLabs/autogalaxy_assistant \
--title "wiki drift detected at release $VERSION" \
--title "$TITLE" \
--body-file "$BODY" \
|| echo "::warning::could not open wiki-drift issue (non-fatal)"

Expand All @@ -1331,6 +1402,7 @@ jobs:
- resolve_mode
- version_number
- release_workspaces
- wait_for_released_stack
if: "${{ needs.resolve_mode.outputs.rehearsal != 'true' }}"
uses: PyAutoLabs/autocti_assistant/.github/workflows/wiki-currency.yml@main
with:
Expand All @@ -1345,6 +1417,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Download drift report
id: drift_report
continue-on-error: true
uses: actions/download-artifact@v4
with:
name: wiki-drift-report # autocti_assistant uploads it unsuffixed (wiki-currency.yml)
Expand All @@ -1363,13 +1437,19 @@ jobs:
GH_TOKEN: ${{ steps.app_token.outputs.token }}
run: |
VERSION="${{ needs.version_number.outputs.version_number }}"
RUN_URL="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
BODY=drift/drift-report.md
TITLE="wiki drift detected at release $VERSION"
if [ ! -f "$BODY" ]; then
printf '# Wiki-currency drift at release %s\n\nThe check failed but no drift-report artifact was found; see the run logs.\n' "$VERSION" > "$BODY"
# No report means the check failed before grading anything (e.g. the
# released stack would not install), so this is not drift.
mkdir -p drift
printf '# Wiki-currency check could not complete at release %s\n\nThe check failed before producing a drift report, so no drift was graded. See the run: %s\n' "$VERSION" "$RUN_URL" > "$BODY"
TITLE="wiki-currency check could not complete at release $VERSION"
fi
gh issue create \
--repo PyAutoLabs/autocti_assistant \
--title "wiki drift detected at release $VERSION" \
--title "$TITLE" \
--body-file "$BODY" \
|| echo "::warning::could not open wiki-drift issue (non-fatal)"

Expand Down
77 changes: 77 additions & 0 deletions tests/test_release_wiki_currency_wait.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
"""Guard the release wiki-currency checks against PyPI index propagation (#334).

The 2026.11.6.1 and 2026.11.7.1 releases shipped completely but ended red:
one assistant's wiki-currency check ran `pip install autolens==<version>`
about 3 minutes after the upload, before PyPI's simple index listed it. The drift
issue job then failed downloading a report that was never written, and its
fallback would have titled an install failure as "drift".

These tests hold the repaired shape: every wiki check waits for the released
stack on production PyPI, the wait is bounded and cache-free, and a drift job with
no report says the check could not complete instead of claiming drift.
"""

from pathlib import Path

import yaml

RELEASE_WORKFLOW = (
Path(__file__).resolve().parents[1] / ".github" / "workflows" / "release.yml"
)

PACKAGES = ("autonerves", "autoarray", "autofit", "autogalaxy", "autolens", "autocti")


def jobs():
return yaml.safe_load(RELEASE_WORKFLOW.read_text())["jobs"]


def wiki_checks(all_jobs):
return {n: j for n, j in all_jobs.items() if n.startswith("wiki_currency_check")}


def drift_jobs(all_jobs):
return {n: j for n, j in all_jobs.items() if n.startswith("wiki_drift_issue")}


def test_every_wiki_check_waits_for_the_released_stack():
all_jobs = jobs()
checks = wiki_checks(all_jobs)
assert len(checks) == 4
for name, job in checks.items():
assert "wait_for_released_stack" in job["needs"], name


def test_the_wait_runs_after_publish_and_is_skipped_in_rehearsal():
job = jobs()["wait_for_released_stack"]
assert "release_workspaces" in job["needs"]
assert "rehearsal != 'true'" in job["if"]


def test_the_wait_polls_production_pypi_for_every_package_without_cache_and_is_bounded():
(step,) = [
s for s in jobs()["wait_for_released_stack"]["steps"]
if s.get("name", "").startswith("Wait")
]
run = step["run"]
assert "--index-url https://pypi.org/simple/" in run
assert "--no-cache-dir" in run
assert "--no-deps" in run
for package in PACKAGES:
assert package in run, package
# bounded: the loop gives up and fails the job
assert "-ge 60" in run
assert "exit 1" in run


def test_drift_jobs_tolerate_a_missing_report_and_never_call_it_drift():
all_jobs = drift_jobs(jobs())
assert len(all_jobs) == 4
for name, job in all_jobs.items():
(download,) = [s for s in job["steps"] if s.get("name") == "Download drift report"]
assert download.get("continue-on-error") is True, name
(open_step,) = [s for s in job["steps"] if s.get("name", "").startswith("Open")]
run = open_step["run"]
assert 'if [ ! -f "$BODY" ]' in run, name
assert "could not complete" in run, name
assert '--title "$TITLE"' in run, name
Loading