mirror of
https://github.com/rennf93/roboco.git
synced 2026-08-03 07:23:24 +02:00
The workflow was gated by `branches: [master]` on both push and pull_request, but this repo's task-hierarchy PRs open against nested parent feature branches, not master, until root->master assembly - so the workflow never fired on a dev-level PR and produced zero evidence. Drop the branch filter (path scoping is sufficient) and post the size-delta table + smoke-check output as a PR comment via actions/github-script, since no agent role has gh CLI or GitHub API read access to pull check-run output directly.
112 lines
4.6 KiB
YAML
112 lines
4.6 KiB
YAML
name: Agent Image Smoke (Playwright)
|
|
|
|
# Builds the two images that carry Playwright + chromium-headless-shell
|
|
# (agent-qa-fe, agent-ux) with a real Docker daemon, verifies a headless
|
|
# chromium launch actually works inside each, and reports the real
|
|
# before/after image size delta against origin/master. This exists because
|
|
# dev/QA agent sandboxes have no Docker daemon of their own — this workflow
|
|
# is the only place that can produce non-estimated numbers for this change.
|
|
|
|
on:
|
|
push:
|
|
paths:
|
|
- 'docker/agent-base.Dockerfile'
|
|
- 'docker/agent-qa-fe.Dockerfile'
|
|
- 'docker/agent-ux.Dockerfile'
|
|
- '.github/workflows/agent-image-smoke.yml'
|
|
pull_request:
|
|
# No `branches:` filter — this repo's task hierarchy opens dev-level
|
|
# PRs against nested parent feature branches (e.g.
|
|
# feature/backend/<root>--<cell>--<subcell>), not directly against
|
|
# master, so a `branches: [master]` filter here would only ever fire
|
|
# once the assembled PR reaches root->master — too late to give QA/PM
|
|
# real evidence at the dev-PR review stage this task exists for.
|
|
paths:
|
|
- 'docker/agent-base.Dockerfile'
|
|
- 'docker/agent-qa-fe.Dockerfile'
|
|
- 'docker/agent-ux.Dockerfile'
|
|
- '.github/workflows/agent-image-smoke.yml'
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
playwright-smoke:
|
|
name: Build QA images, verify headless chromium launch + size delta
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
pull-requests: write
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v7
|
|
with:
|
|
# Need origin/master reachable to diff this branch's Dockerfiles
|
|
# against the pre-change baseline for the size-delta report below.
|
|
fetch-depth: 0
|
|
|
|
- name: Build agent-base (shared FROM target for both variants)
|
|
run: docker build -f docker/agent-base.Dockerfile -t roboco-agent-base .
|
|
|
|
- name: Build "after" images (this branch)
|
|
run: |
|
|
docker build -f docker/agent-qa-fe.Dockerfile -t agent-qa-fe:after .
|
|
docker build -f docker/agent-ux.Dockerfile -t agent-ux:after .
|
|
|
|
- name: Build "before" images (origin/master baseline)
|
|
run: |
|
|
mkdir -p /tmp/before
|
|
git show origin/master:docker/agent-qa-fe.Dockerfile > /tmp/before/agent-qa-fe.Dockerfile
|
|
git show origin/master:docker/agent-ux.Dockerfile > /tmp/before/agent-ux.Dockerfile
|
|
docker build -f /tmp/before/agent-qa-fe.Dockerfile -t agent-qa-fe:before .
|
|
docker build -f /tmp/before/agent-ux.Dockerfile -t agent-ux:before .
|
|
|
|
- name: Report real before/after image size delta
|
|
run: |
|
|
{
|
|
echo "### Playwright image size delta (real \`docker inspect\` sizes)"
|
|
echo
|
|
echo "| image | before | after | delta |"
|
|
echo "|---|---|---|---|"
|
|
for name in agent-qa-fe agent-ux; do
|
|
before_bytes=$(docker inspect -f '{{.Size}}' "${name}:before")
|
|
after_bytes=$(docker inspect -f '{{.Size}}' "${name}:after")
|
|
delta_mb=$(( (after_bytes - before_bytes) / 1024 / 1024 ))
|
|
echo "| ${name} | $(( before_bytes / 1024 / 1024 ))MB | $(( after_bytes / 1024 / 1024 ))MB | +${delta_mb}MB |"
|
|
done
|
|
} | tee -a "$GITHUB_STEP_SUMMARY" /tmp/smoke-report.md
|
|
|
|
- name: Headless chromium launch smoke check
|
|
run: |
|
|
{
|
|
echo
|
|
echo "### Headless chromium launch smoke check"
|
|
echo
|
|
} | tee -a /tmp/smoke-report.md
|
|
for name in agent-qa-fe agent-ux; do
|
|
echo "::group::${name} headless launch smoke"
|
|
docker run --rm --entrypoint /app/.venv/bin/python "${name}:after" -c '
|
|
from playwright.sync_api import sync_playwright
|
|
with sync_playwright() as p:
|
|
browser = p.chromium.launch()
|
|
page = browser.new_page()
|
|
page.goto("about:blank")
|
|
assert page.title() == ""
|
|
browser.close()
|
|
print("PLAYWRIGHT_SMOKE_OK")
|
|
' | tee -a /tmp/smoke-report.md
|
|
echo "::endgroup::"
|
|
done
|
|
|
|
- name: Post results as a PR comment
|
|
if: github.event_name == 'pull_request'
|
|
uses: actions/github-script@v7
|
|
with:
|
|
script: |
|
|
const fs = require('fs');
|
|
const body = fs.readFileSync('/tmp/smoke-report.md', 'utf8');
|
|
await github.rest.issues.createComment({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
issue_number: context.issue.number,
|
|
body: `## Agent Image Smoke (Playwright) results\n\n${body}`,
|
|
});
|