Clean-machine quickstart lifecycle #21
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Clean-machine quickstart lifecycle | |
| on: | |
| schedule: | |
| # Weekly clean-machine drift detection is sufficient during development; | |
| # release candidates can dispatch the same three-OS matrix on demand. | |
| - cron: "30 7 * * 2" # Tuesdays 07:30 UTC | |
| workflow_dispatch: | |
| concurrency: | |
| group: quickstart-lifecycle-${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| jobs: | |
| lifecycle: | |
| name: lifecycle (${{ matrix.os }}) | |
| # Windows otherwise inherits the legacy console code page. Keep the | |
| # harness, child CLIs, and uploaded JSON/log evidence on one UTF-8 contract. | |
| env: | |
| PYTHONUTF8: "1" | |
| PYTHONIOENCODING: "utf-8" | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 | |
| with: | |
| python-version: "3.12" | |
| cache: pip | |
| cache-dependency-path: pyproject.toml | |
| - name: Build wheel | |
| run: | | |
| python -m pip install build | |
| python -m build --wheel --outdir lifecycle-dist | |
| # The Linux lane passes --browser-with-deps, so the harness shells out to | |
| # `playwright install --with-deps`, and that runs apt on the hosted | |
| # runner. Point apt at the canonical archive first, and prove the archive | |
| # answers inside a bounded step, so a mirror fault fails here in seconds | |
| # instead of stalling inside the lifecycle harness. | |
| - name: Prefer the canonical Ubuntu archive (Linux) | |
| if: runner.os == 'Linux' | |
| timeout-minutes: 5 | |
| run: | | |
| set -uo pipefail | |
| # The hosted runner resolves its Ubuntu mirror through | |
| # /etc/apt/apt-mirrors.txt, which points at azure.archive.ubuntu.com. | |
| # That mirror fails intermittently, and every failure costs minutes of | |
| # apt retries before the canonical archive is tried. Keep this | |
| # best-effort: if the file is absent or already canonical, the run | |
| # continues unchanged. | |
| sudo sed -i \ | |
| 's|http://azure.archive.ubuntu.com/ubuntu|http://archive.ubuntu.com/ubuntu|g' \ | |
| /etc/apt/apt-mirrors.txt 2>/dev/null || true | |
| update_ok="" | |
| for attempt in 1 2 3; do | |
| if sudo apt-get update; then | |
| update_ok=1 | |
| break | |
| fi | |
| echo "::warning::apt-get update failed (attempt ${attempt}/3); retrying" | |
| sleep $((attempt * 10)) | |
| done | |
| if [ -z "$update_ok" ]; then | |
| echo "::error::apt-get update failed three times; the Ubuntu mirror is unreachable" | |
| exit 1 | |
| fi | |
| - name: Full lifecycle (Linux) | |
| if: runner.os == 'Linux' | |
| run: >- | |
| python scripts/quickstart_lifecycle.py | |
| --wheel "lifecycle-dist/*.whl" | |
| --work-dir "runs/lifecycle" | |
| --install-browser | |
| --browser-with-deps | |
| --source-revision "${{ github.sha }}" | |
| - name: Full lifecycle (macOS / Windows) | |
| if: runner.os != 'Linux' | |
| run: >- | |
| python scripts/quickstart_lifecycle.py | |
| --wheel "lifecycle-dist/*.whl" | |
| --work-dir "runs/lifecycle" | |
| --install-browser | |
| --source-revision "${{ github.sha }}" | |
| - name: Upload lifecycle evidence | |
| if: always() | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: quickstart-lifecycle-${{ matrix.os }} | |
| path: | | |
| runs/lifecycle/summary.json | |
| runs/lifecycle/logs/*.log | |
| runs/lifecycle/artifacts/**/REPORT.md | |
| runs/lifecycle/artifacts/**/report.json | |
| runs/lifecycle/artifacts/**/patch.json | |
| if-no-files-found: error |