* perf(ci): speed up full WebUI regression gates * perf(ci): balance browser shards with measured hosted timings
662 lines
24 KiB
YAML
662 lines
24 KiB
YAML
name: Test Suite
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches: [main]
|
|
pull_request:
|
|
branches: [main]
|
|
|
|
concurrency:
|
|
# Re-runs retain their original SHA; only checks of the same revision may supersede each other.
|
|
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.sha }}
|
|
cancel-in-progress: true
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
changes:
|
|
name: Detect changes
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
python_required: ${{ steps.paths.outputs.python_required }}
|
|
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: 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 scripts/ci_scope.py --event "$EVENT_NAME"
|
|
--base "$BASE_SHA" --head "$HEAD_SHA"
|
|
|
|
test:
|
|
name: Python (${{ matrix.name }})
|
|
needs: changes
|
|
if: needs.changes.outputs.python_required == 'true'
|
|
runs-on: ${{ matrix.os }}
|
|
# Windows runs real isolated update jobs before the complete compatibility
|
|
# suite; that suite was still progressing at the former 20-minute job cap.
|
|
timeout-minutes: ${{ matrix.os == 'windows-latest' && 30 || 20 }}
|
|
env:
|
|
PYTEST_ADDOPTS: "-o tmp_path_retention_policy=failed -p scripts.pytest_timing"
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- name: minimum, 3.11
|
|
os: ubuntu-latest
|
|
python-version: "3.11"
|
|
coverage: false
|
|
# Keep exact Rich output and real prompt_toolkit pipes in a fresh
|
|
# CLI process: long-lived workers can exceed select()'s fd limit.
|
|
pytest_args: "-n 4 --dist loadfile --ignore=tests/cli/test_commands.py --ignore=tests/cli/test_cli_input.py --ignore=tests/cli/test_desktop_target.py --ignore=tests/cli/test_desktop_target_entrypoints.py"
|
|
- name: latest, 3.14 + coverage
|
|
os: ubuntu-latest
|
|
python-version: "3.14"
|
|
coverage: true
|
|
pytest_args: "-n 4 --dist loadfile --ignore=tests/cli/test_commands.py --ignore=tests/cli/test_cli_input.py --ignore=tests/cli/test_desktop_target.py --ignore=tests/cli/test_desktop_target_entrypoints.py"
|
|
- name: Windows, 3.14
|
|
os: windows-latest
|
|
python-version: "3.14"
|
|
coverage: false
|
|
# Process identities run serially; isolated update jobs use case-level
|
|
# scheduling below so one file cannot serialize all real venv work.
|
|
# Bound real persistence contention: six workers can delay session
|
|
# startup beyond its watchdog. Keep every assertion and test enabled.
|
|
pytest_args: "-n 4 --dist loadfile --ignore=tests/cli/test_commands.py --ignore=tests/cli/test_cli_input.py --ignore=tests/cli/test_desktop_target.py --ignore=tests/cli/test_desktop_target_entrypoints.py --ignore=tests/tools/test_exec_platform.py --ignore=tests/cli/test_wsl_browser.py --ignore=tests/test_install_scripts.py --ignore=tests/test_update_jobs.py --ignore=tests/test_update_profiles.py --ignore=tests/test_update_stop.py"
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Python ${{ matrix.python-version }}
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
- name: Check Python import boundaries
|
|
if: matrix.coverage
|
|
run: python -m scripts.check_import_boundaries
|
|
|
|
- name: Install uv
|
|
uses: astral-sh/setup-uv@v4
|
|
with:
|
|
enable-cache: true
|
|
cache-dependency-glob: pyproject.toml
|
|
|
|
- name: Install system dependencies (Linux)
|
|
if: runner.os == 'Linux'
|
|
run: sudo apt-get update && sudo apt-get install -y libolm-dev build-essential
|
|
|
|
- name: Install dependencies
|
|
run: uv sync --all-extras --dev
|
|
|
|
# Feishu selects websockets<16. Check the default transport before the
|
|
# all-channel suite exercises the older compatible resolution.
|
|
- name: Test default WebSocket transport
|
|
run: >-
|
|
uv run --no-sync python -m pytest -q
|
|
nanobot/channels/websocket/tests/test_handshake_disconnect.py
|
|
nanobot/channels/websocket/tests/test_binary_http.py
|
|
|
|
- name: Install channel dependencies
|
|
run: uv run --no-sync python -m scripts.install_channel_dependencies --all-channels
|
|
|
|
- name: Verify dependency consistency
|
|
run: uv pip check
|
|
|
|
- name: Install pipx for offline installer checks
|
|
if: runner.os == 'Linux'
|
|
shell: bash
|
|
run: |
|
|
uv tool install pipx==1.17.12
|
|
uv tool dir --bin >> "$GITHUB_PATH"
|
|
|
|
# Channel requirements live in manifests rather than uv.lock. Avoid a
|
|
# 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 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
|
|
run: uv run --no-sync basedpyright
|
|
|
|
- name: Check Windows update coordination before the full suite
|
|
if: runner.os == 'Windows'
|
|
# Real gateway startup/stop must not compete with the parallel package
|
|
# and session-index fixtures. Keep its startup and lease assertions intact.
|
|
run: >-
|
|
uv run --no-sync python -m pytest
|
|
tests/test_installation_lock.py
|
|
tests/test_update_profiles.py
|
|
tests/test_update_stop.py
|
|
tests/utils/test_helpers.py::test_atomic_record_reader_does_not_block_concurrent_replacement
|
|
tests/gateway/test_runtime.py::test_runtime_state_publish_keeps_existing_snapshot_readable
|
|
tests/gateway/test_runtime.py::test_runtime_state_reader_does_not_block_publish_while_decoding
|
|
-q --junitxml=test-results/coordination.xml --timing-report=test-results/coordination.json
|
|
|
|
# Each update job owns its venv, HOME, profile and lock directory. Preserve
|
|
# the real installation/restore checks, but avoid a loadfile straggler and
|
|
# disk contention with timing-sensitive runtime-registration checks.
|
|
# Three concurrent offline pip fixture installs exceeded their 60s bounds.
|
|
# Reduce startup contention; keep every command deadline and lease assertion.
|
|
- name: Run Windows isolated update jobs
|
|
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 2 --dist load -vv --durations=25 --durations-min=1.0
|
|
--junitxml=test-results/update-jobs.xml --timing-report=test-results/update-jobs.json
|
|
|
|
- name: Run tests with coverage
|
|
if: matrix.coverage
|
|
run: >-
|
|
uv run --no-sync python -m pytest
|
|
${{ matrix.pytest_args }}
|
|
--cov=nanobot --cov-report=term-missing:skip-covered
|
|
-o faulthandler_timeout=60
|
|
--junitxml=test-results/main.xml --timing-report=test-results/main.json
|
|
--durations=25 --durations-min=1.0
|
|
|
|
- name: Run serial CLI input and command tests with coverage
|
|
if: matrix.coverage
|
|
run: >-
|
|
uv run --no-sync python -m pytest
|
|
tests/cli/test_cli_input.py tests/cli/test_desktop_target.py
|
|
tests/cli/test_desktop_target_entrypoints.py tests/cli/test_commands.py
|
|
--cov=nanobot --cov-append --cov-report=term-missing:skip-covered
|
|
--junitxml=test-results/cli.xml --timing-report=test-results/cli.json
|
|
--durations=25 --durations-min=1.0
|
|
|
|
- name: Run compatibility tests
|
|
if: ${{ !matrix.coverage }}
|
|
run: >-
|
|
uv run --no-sync python -m pytest
|
|
${{ matrix.pytest_args }}
|
|
-o faulthandler_timeout=60
|
|
--junitxml=test-results/main.xml --timing-report=test-results/main.json
|
|
--durations=25 --durations-min=1.0
|
|
|
|
- name: Run serial CLI input and command compatibility tests
|
|
if: ${{ !matrix.coverage }}
|
|
run: >-
|
|
uv run --no-sync python -m pytest
|
|
tests/cli/test_cli_input.py tests/cli/test_desktop_target.py
|
|
tests/cli/test_desktop_target_entrypoints.py tests/cli/test_commands.py
|
|
--junitxml=test-results/cli.xml --timing-report=test-results/cli.json
|
|
--durations=25 --durations-min=1.0
|
|
|
|
- name: Upload Python test timings
|
|
if: always()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: python-timings-${{ matrix.os }}-${{ matrix.python-version }}
|
|
path: test-results/
|
|
retention-days: 7
|
|
|
|
windows_process:
|
|
name: Python (Windows process compatibility)
|
|
env:
|
|
PYTEST_ADDOPTS: "-o tmp_path_retention_policy=failed -p scripts.pytest_timing"
|
|
needs: changes
|
|
if: needs.changes.outputs.python_required == 'true'
|
|
runs-on: windows-latest
|
|
timeout-minutes: 20
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
# Keep this focused job on the affected pre-3.14 ctypes runtime family;
|
|
# the full Windows suite above continues to cover the latest Python.
|
|
- name: Set up Python 3.12
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.12"
|
|
|
|
- name: Install uv
|
|
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 channel dependencies
|
|
run: uv run --no-sync python -m scripts.install_channel_dependencies --all-channels
|
|
|
|
- name: Verify dependency consistency
|
|
run: uv pip check
|
|
|
|
- name: Run Windows process compatibility tests
|
|
run: >-
|
|
uv run --no-sync python -m pytest
|
|
tests/tools/test_exec_platform.py
|
|
tests/cli/test_wsl_browser.py
|
|
tests/gateway/test_runtime.py
|
|
--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
|
|
# Two installer workers retain the per-command 90s deadline without four
|
|
# concurrent PowerShell/venv cold starts competing on the same Windows VM.
|
|
timeout-minutes: 40
|
|
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"
|
|
|
|
# Each case owns an isolated manager/config root. Four concurrent starts
|
|
# exceeded the command deadlines; reduce contention, not test coverage.
|
|
- name: Run Windows installer checks
|
|
run: >-
|
|
uv run --no-sync python -m pytest tests/test_install_scripts.py
|
|
-n 2 --dist load -x -vv --durations=10
|
|
--junitxml=test-results/installers.xml --timing-report=test-results/installers.json
|
|
|
|
- name: Upload Windows process test timings
|
|
if: always()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: python-timings-windows-installers
|
|
path: test-results/
|
|
retention-days: 7
|
|
|
|
webui_checks:
|
|
name: WebUI static checks
|
|
needs: changes
|
|
if: needs.changes.outputs.webui_required == 'true'
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 15
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Bun
|
|
uses: oven-sh/setup-bun@v2
|
|
with:
|
|
bun-version: 1.3.13
|
|
|
|
- name: Verify npm lockfile
|
|
working-directory: webui
|
|
run: npm ci --ignore-scripts --dry-run
|
|
|
|
- name: Install WebUI dependencies
|
|
working-directory: webui
|
|
run: bun install --frozen-lockfile
|
|
|
|
- name: Check WebUI import boundaries
|
|
working-directory: webui
|
|
run: bun run check:imports
|
|
|
|
- name: Test client import checker with WebUI dependencies
|
|
working-directory: webui
|
|
run: bun run test:imports
|
|
|
|
- name: Test CI shard planning and failure gates
|
|
working-directory: webui
|
|
run: bun run test:ci
|
|
|
|
- name: Lint WebUI
|
|
working-directory: webui
|
|
run: bun run lint
|
|
|
|
- name: Type check WebUI and unit tests
|
|
working-directory: webui
|
|
run: bun run typecheck
|
|
|
|
- name: Type check browser tests and fixtures
|
|
working-directory: webui
|
|
run: bun run typecheck:browser
|
|
|
|
webui_build:
|
|
name: WebUI production build
|
|
needs: changes
|
|
if: needs.changes.outputs.webui_required == 'true'
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 15
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: oven-sh/setup-bun@v2
|
|
with:
|
|
bun-version: 1.3.13
|
|
- name: Install WebUI dependencies
|
|
working-directory: webui
|
|
run: bun install --frozen-lockfile
|
|
- name: Type check production sources and build WebUI
|
|
working-directory: webui
|
|
run: bun run build
|
|
|
|
webui_unit:
|
|
name: WebUI unit and coverage
|
|
needs: changes
|
|
if: needs.changes.outputs.webui_required == 'true'
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 15
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- uses: oven-sh/setup-bun@v2
|
|
with:
|
|
bun-version: 1.3.13
|
|
- name: Install WebUI dependencies
|
|
working-directory: webui
|
|
run: bun install --frozen-lockfile
|
|
# Vitest 2's Istanbul blob merge can mark an unhit inner branch covered
|
|
# using another shard's outer range. Keep the original full V8 coverage gate.
|
|
- name: Run all unit tests with original coverage thresholds
|
|
working-directory: webui
|
|
run: bun run test:coverage --reporter=default --reporter=json --outputFile.json=test-results/unit/results.json
|
|
- name: Retain unit and coverage results
|
|
if: always()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: webui-unit-coverage
|
|
path: |
|
|
webui/test-results/unit/results.json
|
|
webui/coverage/coverage-summary.json
|
|
if-no-files-found: error
|
|
overwrite: true
|
|
retention-days: 7
|
|
|
|
webui_browser:
|
|
name: WebUI browser (${{ matrix.shard }}/4)
|
|
needs: changes
|
|
if: needs.changes.outputs.webui_required == 'true'
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 25
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
shard: [1, 2, 3, 4]
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Bun
|
|
uses: oven-sh/setup-bun@v2
|
|
with:
|
|
bun-version: 1.3.13
|
|
|
|
- name: Install WebUI dependencies
|
|
working-directory: webui
|
|
run: bun install --frozen-lockfile
|
|
|
|
- name: Install browser for layout regressions
|
|
working-directory: webui
|
|
run: bun x playwright install --with-deps chromium
|
|
|
|
- name: Test full-suite browser shard with real layout and motion
|
|
working-directory: webui
|
|
run: bun run test:browser:shard --shard=${{ matrix.shard }}/4
|
|
|
|
- name: Retain browser timings and failure details
|
|
if: always()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: browser-results-${{ matrix.shard }}
|
|
path: |
|
|
webui/test-results/browser/results-*.json
|
|
webui/test-results/browser/**/trace.zip
|
|
webui/test-results/browser/**/test-failed-*.png
|
|
webui/test-results/browser/**/error-context.md
|
|
if-no-files-found: error
|
|
overwrite: true
|
|
retention-days: 7
|
|
|
|
webui:
|
|
needs: [changes, webui_checks, webui_build, webui_unit, webui_browser]
|
|
if: always() && needs.changes.outputs.webui_required == 'true'
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 1
|
|
|
|
steps:
|
|
- name: Require every full-suite WebUI lane to pass
|
|
env:
|
|
CHECK_RESULTS: ${{ toJSON(needs) }}
|
|
run: |
|
|
python - <<'PY'
|
|
import json
|
|
import os
|
|
|
|
failed = {name: job["result"] for name, job in json.loads(os.environ["CHECK_RESULTS"]).items()
|
|
if job["result"] != "success"}
|
|
if failed:
|
|
raise SystemExit(f"WebUI checks did not all pass: {failed}")
|
|
PY
|
|
|
|
tui:
|
|
needs: changes
|
|
if: needs.changes.outputs.tui_required == 'true'
|
|
name: ${{ matrix.name }}
|
|
runs-on: ${{ matrix.os }}
|
|
timeout-minutes: 10
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
include:
|
|
- name: Terminal UI
|
|
os: ubuntu-latest
|
|
- name: Terminal UI (Windows)
|
|
os: windows-latest
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up Bun
|
|
uses: oven-sh/setup-bun@v2
|
|
with:
|
|
bun-version: 1.3.13
|
|
# Build with baseline Bun directly: its Windows cross-target extractor is unreliable.
|
|
bun-download-url: ${{ runner.os == 'Windows' && 'https://github.com/oven-sh/bun/releases/download/bun-v1.3.13/bun-windows-x64-baseline.zip' || '' }}
|
|
|
|
- name: Install TUI dependencies
|
|
working-directory: tui
|
|
run: bun install --frozen-lockfile
|
|
|
|
- name: Check TUI import boundaries
|
|
working-directory: tui
|
|
run: bun run check:imports
|
|
|
|
- name: Test client import checker with TUI dependencies
|
|
working-directory: tui
|
|
run: bun run test:imports
|
|
|
|
- name: Check TUI
|
|
working-directory: tui
|
|
run: bun run check
|
|
|
|
- name: Test TUI
|
|
working-directory: tui
|
|
run: bun run test
|
|
|
|
- name: Test TUI in a real pseudo-terminal
|
|
if: runner.os != 'Windows'
|
|
working-directory: tui
|
|
run: python3 scripts/pty_smoke.py
|
|
|
|
- name: Set up Python for native package acceptance
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: '3.11'
|
|
|
|
- name: Test TUI in a real ConPTY terminal
|
|
if: runner.os == 'Windows'
|
|
working-directory: tui
|
|
shell: pwsh
|
|
run: |
|
|
python -m pip install --disable-pip-version-check pywinpty==3.0.5
|
|
python scripts/conpty_smoke.py
|
|
|
|
- name: Build TUI
|
|
working-directory: tui
|
|
run: bun run build
|
|
|
|
- name: Retain compiled TUI size evidence
|
|
if: always()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: tui-size-${{ runner.os }}
|
|
path: tui/dist/*.size.json
|
|
if-no-files-found: ignore
|
|
retention-days: 7
|
|
|
|
- name: Verify licensed Linux release archive
|
|
if: runner.os == 'Linux'
|
|
working-directory: tui
|
|
run: |
|
|
bun scripts/release-notices.ts linux-x64
|
|
python3 scripts/package-release.py linux-x64
|
|
|
|
- name: Verify licensed Windows release archive
|
|
if: runner.os == 'Windows'
|
|
working-directory: tui
|
|
shell: pwsh
|
|
run: |
|
|
bun scripts/release-notices.ts win32-x64
|
|
python scripts/package-release.py win32-x64
|
|
|
|
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
|
|
if: needs.changes.outputs.docker_required == 'true'
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 35
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Build image with default channel dependencies
|
|
run: docker build -t nanobot:test .
|
|
|
|
- name: Verify first-boot gateway and WebUI
|
|
run: python scripts/docker_compose_smoke.py --image nanobot:test
|
|
|
|
- name: Check out the real previous release for retained-volume acceptance
|
|
uses: actions/checkout@v4
|
|
with:
|
|
ref: 1bb712d3488915ca4ed9ccc1a93067ff722f5ab9 # v0.3.5
|
|
path: .docker-baseline
|
|
persist-credentials: false
|
|
|
|
- name: Verify old-image upgrade without replacing user data
|
|
run: |
|
|
docker build -t nanobot:baseline .docker-baseline
|
|
python scripts/docker_upgrade_smoke.py --baseline-image nanobot:baseline \
|
|
--image nanobot:test --version "$(python -c 'import tomllib; print(tomllib.load(open("pyproject.toml", "rb"))["project"]["version"])')" \
|
|
--source-commit "$GITHUB_SHA" \
|
|
--output "$RUNNER_TEMP/docker-upgrade-report.json"
|
|
|
|
- name: Retain Docker upgrade acceptance report
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: docker-upgrade-${{ github.run_id }}-${{ github.run_attempt }}
|
|
path: ${{ runner.temp }}/docker-upgrade-report.json
|
|
if-no-files-found: error
|
|
retention-days: 7
|
|
|
|
- name: Verify Docker Compose startup and privilege boundary
|
|
env:
|
|
HOME: ${{ runner.temp }}
|
|
run: |
|
|
docker compose run --rm --no-deps --build -T nanobot-cli status
|
|
docker compose run --rm --no-deps -T --entrypoint sh nanobot-cli -s <<'OUTER'
|
|
set -eu
|
|
field() {
|
|
awk -v key="$1:" '$1 == key { print $2 }' /proc/self/status
|
|
}
|
|
test "$(id -u)" = "0"
|
|
test "$(field NoNewPrivs)" = "1"
|
|
setpriv --reuid=nanobot --regid=nanobot --init-groups sh -s <<'INNER'
|
|
set -eu
|
|
field() {
|
|
awk -v key="$1:" '$1 == key { print $2 }' /proc/self/status
|
|
}
|
|
test "$(id -u)" = "1000"
|
|
test "$(field NoNewPrivs)" = "1"
|
|
for capability_set in CapInh CapPrm CapEff CapAmb; do
|
|
test "$(field "$capability_set")" = "0000000000000000"
|
|
done
|
|
INNER
|
|
OUTER
|
|
docker compose -f docker-compose.yml -f docker-compose.bwrap.yml --profile cli \
|
|
config --format json > "${RUNNER_TEMP}/bwrap-compose.json"
|
|
python - <<'PY'
|
|
import json
|
|
import os
|
|
from pathlib import Path
|
|
|
|
config = json.loads(Path(os.environ["RUNNER_TEMP"], "bwrap-compose.json").read_text())
|
|
for service_name in ("nanobot-gateway", "nanobot-cli"):
|
|
service = config["services"][service_name]
|
|
assert {"CHOWN", "SETGID", "SETUID", "SYS_ADMIN"} <= set(service["cap_add"])
|
|
assert "no-new-privileges:true" in service["security_opt"]
|
|
PY
|
|
|
|
- name: Verify default WhatsApp dependencies
|
|
run: docker run --rm --entrypoint python nanobot:test -c "import neonize, segno"
|
|
|
|
- name: Verify runtime dependency permissions
|
|
run: >-
|
|
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_build, webui_unit, 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
|