ci: scope native acceptance and bind release candidate artifacts (#6378)

* ci: scope native acceptance and bind release candidate artifacts

* ci: isolate Windows installers and use portable Git tree fixtures

* test: preserve installer subprocess diagnostics on timeout
This commit is contained in:
chengyongru authored and GitHub committed 2026-10-21 23:50:58 +08:00
1 parent 4dc695ca76
commit 67fc220c8a
15 files changed
+1222 -288

No files matched your search

+62 -162
View File
@@ -4,30 +4,8 @@ on:
workflow_dispatch:
push:
branches: [main]
paths-ignore:
- docs/**
- .agent/**
- .github/ISSUE_TEMPLATE/**
- AGENTS.md
- CLAUDE.md
- COMMUNICATION.md
- CONTRIBUTING.md
- README.md
- SECURITY.md
- webui/README.md
pull_request:
branches: [main]
paths-ignore:
- docs/**
- .agent/**
- .github/ISSUE_TEMPLATE/**
- AGENTS.md
- CLAUDE.md
- COMMUNICATION.md
- CONTRIBUTING.md
- README.md
- SECURITY.md
- webui/README.md
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
@@ -45,96 +23,23 @@ jobs:
webui_required: ${{ steps.paths.outputs.webui_required }}
tui_required: ${{ steps.paths.outputs.tui_required }}
docker_required: ${{ steps.paths.outputs.docker_required }}
native_required: ${{ steps.paths.outputs.native_required }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Detect Python-relevant changes
- name: Select checks by affected contracts
id: paths
shell: bash
env:
EVENT_NAME: ${{ github.event_name }}
BASE_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.base.sha || github.event.before }}
HEAD_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
run: |
python_required=true
webui_required=true
tui_required=true
docker_required=true
if [[ "$EVENT_NAME" == "pull_request" ]]; then
diff_range="${BASE_SHA}...${HEAD_SHA}"
else
diff_range="${BASE_SHA}..${HEAD_SHA}"
fi
if git cat-file -e "${BASE_SHA}^{commit}" 2>/dev/null &&
changed_files="$(git diff --name-only --no-renames "$diff_range")" &&
[[ -n "$changed_files" ]]; then
python_required=false
webui_required=false
tui_required=false
docker_required=false
while IFS= read -r file; do
case "$file" in
.github/workflows/*)
# A workflow change must exercise every affected execution path.
python_required=true
webui_required=true
tui_required=true
docker_required=true
;;
webui/*|nanobot/channels/*/webui/*|nanobot/channels/*/tests/webui/*)
webui_required=true
# The Docker image builds and bundles both WebUI trees.
docker_required=true
;;
nanobot/*)
# Channel WebUI files were handled by the previous case.
python_required=true
docker_required=true
;;
tests/test_docker.sh)
docker_required=true
;;
pyproject.toml|hatch_build.py|scripts/install_channel_dependencies.py)
python_required=true
docker_required=true
;;
scripts/check_client_import_boundaries.*)
webui_required=true
tui_required=true
;;
tests/*|conftest.py|uv.lock|scripts/*)
python_required=true
;;
Dockerfile|Dockerfile.*|.dockerignore|docker-compose*.yml|entrypoint.sh|render-config.json|README.md|LICENSE|THIRD_PARTY_NOTICES.md)
docker_required=true
;;
tui/*)
tui_required=true
;;
docs/*|.agent/*|.github/ISSUE_TEMPLATE/*|AGENTS.md|CLAUDE.md|COMMUNICATION.md|CONTRIBUTING.md|README.md|SECURITY.md|webui/README.md|render.yaml)
# Documentation-only changes are already filtered at the event level.
;;
*)
# Keep new or unclassified paths covered until they are categorized.
python_required=true
webui_required=true
tui_required=true
docker_required=true
;;
esac
done <<< "$changed_files"
fi
echo "python_required=$python_required" >> "$GITHUB_OUTPUT"
echo "webui_required=$webui_required" >> "$GITHUB_OUTPUT"
echo "tui_required=$tui_required" >> "$GITHUB_OUTPUT"
echo "docker_required=$docker_required" >> "$GITHUB_OUTPUT"
run: >-
python scripts/ci_scope.py --event "$EVENT_NAME"
--base "$BASE_SHA" --head "$HEAD_SHA"
test:
name: Python (${{ matrix.name }})
@@ -213,7 +118,7 @@ jobs:
# later uv run sync pruning the packages installed by the previous step.
- name: Lint with ruff
if: matrix.coverage
run: uv run --no-sync ruff check nanobot tests conftest.py scripts/check_import_boundaries.py scripts/pytest_timing.py
run: uv run --no-sync ruff check nanobot tests conftest.py scripts/check_import_boundaries.py scripts/pytest_timing.py scripts/ci_scope.py scripts/ci_gate.py scripts/native_acceptance_input.py scripts/verify_packaged_update.py
- name: Type check with BasedPyright (strict)
if: matrix.coverage
@@ -234,7 +139,7 @@ jobs:
# the real installation/restore checks, but avoid a loadfile straggler and
# disk contention with timing-sensitive runtime-registration checks.
- name: Run Windows isolated update jobs
if: runner.os == 'Windows'
if: runner.os == 'Windows' && github.event_name != 'push' && needs.changes.outputs.native_required == 'true'
run: >-
uv run --no-sync python -m pytest tests/test_update_jobs.py
-n 3 --dist load -vv --durations=25 --durations-min=1.0
@@ -325,16 +230,43 @@ jobs:
--junitxml=test-results/process.xml --timing-report=test-results/process.json
--durations=25 --durations-min=1.0
- name: Upload Windows process test timings
if: always()
uses: actions/upload-artifact@v4
with:
name: python-timings-windows-process
path: test-results/
retention-days: 7
windows_installers:
name: Python (Windows installer compatibility)
needs: changes
if: github.event_name != 'push' && needs.changes.outputs.python_required == 'true' && needs.changes.outputs.native_required == 'true'
runs-on: windows-latest
# The real installer matrix took 18m06s alone; process checks and teardown
# previously pushed the combined job beyond its 20-minute bound.
timeout-minutes: 25
env:
PYTEST_ADDOPTS: "-o tmp_path_retention_policy=failed -p scripts.pytest_timing"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.14'
- uses: astral-sh/setup-uv@v4
with:
enable-cache: true
cache-dependency-glob: pyproject.toml
- name: Install dependencies
run: uv sync --all-extras --dev
- name: Install pipx for offline installer checks
shell: bash
run: |
uv tool install pipx==1.17.12
uv tool dir --bin >> "$GITHUB_PATH"
# Installer subprocesses run here, parallel to the broad Windows suite.
# Each case owns an isolated manager/config root, so individual cases can
# run concurrently without sharing a console or package installation.
# Keep four workers: three exceed this job's budget on native Windows.
# Each case owns an isolated manager/config root. Keep the existing
# four-worker budget, independent of process-identity compatibility checks.
- name: Run Windows installer checks
run: >-
uv run --no-sync python -m pytest tests/test_install_scripts.py
@@ -345,7 +277,7 @@ jobs:
if: always()
uses: actions/upload-artifact@v4
with:
name: python-timings-windows-process
name: python-timings-windows-installers
path: test-results/
retention-days: 7
@@ -439,12 +371,10 @@ jobs:
tui:
needs: changes
if: needs.changes.outputs.tui_required == 'true' || needs.changes.outputs.python_required == 'true' || needs.changes.outputs.webui_required == 'true'
if: needs.changes.outputs.tui_required == 'true'
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
# Native build + clean install + recovery/next-update journeys on Windows.
# Each subprocess is separately bounded by the acceptance harness.
timeout-minutes: 60
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
@@ -521,57 +451,11 @@ jobs:
bun scripts/release-notices.ts win32-x64
python scripts/package-release.py win32-x64
- name: Build and install the native application package
shell: bash
env:
NATIVE_TARGET: ${{ runner.os == 'Windows' && 'win32-x64' || 'linux-x64' }}
run: |
python -m pip install --disable-pip-version-check build
python -m build --outdir "$RUNNER_TEMP/python-dist"
# Archive verification shares the installed launcher's dependencies.
# Install the intermediate in this build environment, not the separate
# clean-home environment used by the public-installer acceptance probe.
python -m pip install --disable-pip-version-check "$(find "$RUNNER_TEMP/python-dist" -name '*.whl' -print -quit)"
python -m scripts.build_tui_wheels \
--wheel "$(find "$RUNNER_TEMP/python-dist" -name '*.whl' -print -quit)" \
--tui-dir tui/dist --target "$NATIVE_TARGET" --out-dir "$RUNNER_TEMP/native-wheel"
version="$(python -c 'import tomllib; print(tomllib.load(open("pyproject.toml", "rb"))["project"]["version"])')"
python -I scripts/verify_installed_release.py \
--install-wheel "$(find "$RUNNER_TEMP/native-wheel" -name '*.whl' -print -quit)" \
--version "$version" --commit "$(git rev-parse HEAD)" --gateway \
--report "$RUNNER_TEMP/native-install-report.json"
- name: Exercise updates with the default Windows path policy
if: runner.os == 'Windows'
shell: pwsh
run: |
# Only this disposable runner changes. Do not require users to enable
# machine-wide long paths for an ordinary update's atomic temp files.
$key = 'HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem'
Set-ItemProperty -Path $key -Name LongPathsEnabled -Value 0
if ((Get-ItemPropertyValue -Path $key -Name LongPathsEnabled) -ne 0) {
throw 'Native update acceptance requires LongPathsEnabled=0'
}
Write-Output 'Packaged update/recovery acceptance: LongPathsEnabled=0'
- name: Verify packaged upgrades and automatic service recovery
shell: bash
run: |
python -I scripts/verify_packaged_update.py \
--wheel "$(find "$RUNNER_TEMP/native-wheel" -name '*.whl' -print -quit)" \
--commit "$(git rev-parse HEAD)" --output "$RUNNER_TEMP/packaged-update"
- name: Retain the native package acceptance report
if: always()
uses: actions/upload-artifact@v4
with:
name: native-install-${{ runner.os }}-${{ github.run_id }}-${{ github.run_attempt }}
path: |
${{ runner.temp }}/native-install-report.json
${{ runner.temp }}/packaged-update/packaged-update-report.json
${{ runner.temp }}/packaged-update/*/result.json
if-no-files-found: error
retention-days: 3
native:
name: Native package acceptance
needs: changes
if: github.event_name != 'push' && needs.changes.outputs.native_required == 'true'
uses: ./.github/workflows/native-acceptance.yml
docker:
needs: changes
@@ -634,3 +518,19 @@ jobs:
docker run --rm --user 1000:1000 --entrypoint sh nanobot:test -c
'test -w /app/.venv && test ! -w /app && test ! -w /app/nanobot &&
python -m scripts.install_channel_dependencies discord && python -c "import discord"'
required:
name: CI required
needs: [changes, test, windows_process, windows_installers, webui_checks, webui_browser, webui, tui, docker, native]
if: always()
runs-on: ubuntu-latest
timeout-minutes: 2
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Require every selected check
env:
CHECK_RESULTS: ${{ toJSON(needs) }}
EVENT_NAME: ${{ github.event_name }}
run: python scripts/ci_gate.py