mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-11-07 06:19:43 -10:00
* ci(pnpm): install dependencies with pnpm in CI and release CI tests the graph release ships only if both install it the same way, so this moves both, keeping every `npm run` script and `npm publish` as they are. - ci.yml (7), release.yml (3) and release-vscode-companion.yml (2) install with `corepack pnpm install --frozen-lockfile`; release keeps --ignore-scripts plus its explicit postinstall and generate steps. - setup-node drops the npm cache and sets package-manager-cache: false, which setup-node v5+ needs once package.json declares a pnpm packageManager. - A composite action caches the pnpm store on the three always-hosted jobs; the ECS pool keeps its store on local disk. - version.js no longer lets npm reify node_modules: --no-workspaces-update on both `npm version` calls, and a package-lock-only refresh in step 9. - The notices generator, prepare-package's sharp pin and the standalone release's native package specs read the installed tree or pnpm-lock.yaml instead of package-lock.json keys. - New size baselines for the three workflows, which were already over them. * chore(vscode): regenerate NOTICES from the pnpm-installed tree Generated in CI (pnpm Worktree Smoke on ubuntu-latest) by the ported generator. Same entry set as before except the five packages npm and pnpm resolve differently: fdir 6.5.0, picomatch 4.0.5, mdurl 2.1.0, @types/node 22.20.1 and mime-db 1.52.0 (form-data's pinned copy). No entry lacks a license text or repository. * fix(pnpm): resolve undeclared zod peers to the repo's zod, as npm does The first CI run on this branch failed the export renderer's size budget: 1,930,015 bytes against 1,930,000, where the same commit built on npm's tree comes to 1,858,186. Comparing both trees' esbuild metafiles and prebuilt bundles put the whole difference in web-shell's transcript.js (+100,903 bytes pre-minify), and the added code is zod 4 plus the @modelcontextprotocol/ext-apps schemas; the sdk daemon bundle is identical. web-shell bundles ext-apps, whose zod and MCP SDK are peers, and declares no zod itself, so pnpm filled the peer with the highest locked zod (4.4.3) while npm serves the hoisted 3.25.76. Declaring zod 3.25.76 as a root devDependency makes pnpm resolve every such peer to it (resolve-peers-from-workspace-root is on by default), which is npm's hoisting behaviour. mobile-mcp keeps its own zod 4.4.3, as under npm; the npm tree does not change. * fix(pnpm): keep npm's root @types/node so root-level typechecks match The no-AK integration gate typechecks integration-tests/, which takes Node's types from the root node_modules. npm hoists @types/node 20.19.1 there, because acp-bridge and core pin it; pnpm, with no root declaration, hoisted 22.20.1, whose spawnSync overloads type process-registry.ts's stdout as string | NonSharedBuffer and fail TS2322. The same code passes on every npm-installed PR. Declaring 20.19.1 as a root devDependency puts npm's copy back where a root-level tsconfig looks. The npm tree does not change. * ci(pnpm): install with pnpm in the remaining workflows The follow-up to switching CI and release: every other workflow that installs the root workspace now uses the pinned pnpm with --frozen-lockfile, so no job tests a graph that release does not ship. - e2e, tui-parity, repo-hygiene, web-shell-visuals, serve-ab, sdk-java, windows-runner-smoke, qwen-autofix, the SDK releases, finalize-release, sync-release-to-oss, the root install in desktop-release and cd-cua-driver, and the sandbox Dockerfile. - setup-node drops the root npm cache (package-manager-cache: false); hosted jobs restore the pnpm store through the shared composite action, and qwen-autofix keeps af-012's rule that the persistent pool restores no remote cache. - serve-ab and web-shell-visuals install a separate base checkout that can predate pnpm-lock.yaml, so those installs fall back to npm ci there. - Out of scope, unchanged: packages with their own lockfile (cua-driver's TypeScript SDK, desktop-shell, live-host, mobile-mcp), and the triage lanes with npm-cache.yml and the npm audit gate, which move with the package-lock.json retirement. - New size baselines for the touched workflows; qwen-autofix stays under the 470000-byte gate. * fix(pnpm): link the workspace packages that root-level code imports npm links every workspace package into the root node_modules, so integration-tests/ and scripts/, which are not workspace packages themselves, can import @qwen-code/* by name. pnpm links a workspace package only where it is a declared dependency, and the root declared none, so the no-AK integration gate could not find @qwen-code/qwen-code-core. The root now declares the seven packages that root-level code imports at runtime as file: devDependencies: acp-bridge, channel-base, the CLI, core, sdk, web-shell and web-templates. npm already links them, so its tree does not change (letting npm re-resolve the lock reproduces the same root entry); .pnpmfile.mjs rewrites them to workspace:*, which pnpm links at the root. * ci(pnpm): move triage, the store producer and the root audit to pnpm - qwen-triage's verify and tmux-testing lanes install the PR with `corepack pnpm install --frozen-lockfile` from a restored pnpm store. The one retry clears node_modules first, because pnpm install, unlike npm ci, keeps it. - npm-cache.yml becomes pnpm-store.yml, keyed on pnpm-lock.yaml. - security-checks audits the root workspace with `pnpm audit`, which reads the lockfile, so the root install step goes. The vendored lockfiles keep npm, and the retry recognises pnpm's endpoint error too. - qwen-autofix drops the hosted-only store cache: its heavy jobs forbid local `uses: './...'` actions, and the file sits at the size gate. - cd-cua-driver: setup-node@v4 has no package-manager-cache input. - package-assets fixtures install sharp rather than listing it in package-lock.json, matching how prepare-package now resolves it. - AGENTS.md, CONTRIBUTING.md and the npm workspace guide install with pnpm. * feat(review): install pnpm repos in qwen review's build/test qwen review installed dependencies only for a repo with package-lock.json and reported a pnpm repo as unsupported, so reviews of qwen-code would lose their build and test once its npm lockfile goes. - lockfileInstaller() picks npm or pnpm from the committed lockfile. With both, `packageManager: pnpm@...` chooses pnpm; anything else keeps npm. - A pnpm repo installs with `corepack pnpm install --frozen-lockfile` through the same disk, budget and sandbox path as `npm ci`, and counts as installed once node_modules/.modules.yaml exists. - Scripts still run through `npm run`, and the npm path is unchanged. * ci(pnpm): retire the root package-lock.json pnpm-lock.yaml is now the only root lockfile. - check-lockfile keeps the pnpm integrity check and Playwright parity, which now reads pnpm importers and snapshots. The npm-vs-pnpm agreement and build-approval checks go: pnpm 11's strictDepBuilds and every CI install's --frozen-lockfile enforce what they covered. - pnpm-lock-freshness.yml goes; it regenerated pnpm-lock.yaml from package-lock.json. - Release: version.js drops its package-lock refresh, the release commit stages pnpm-lock.yaml and the SDK release stages no lockfile, so neither `git add` fails on the missing file. `npm version` in the SDK and mobile-mcp releases passes --no-workspaces-update so it cannot reinstall the root with npm. - cd-mobile-mcp installs from the root pnpm lockfile. setup-node in cd-mobile-mcp, qwen-code-pr-review and desktop-release no longer keys an npm cache on the root lockfile. - check-desktop-isolation reads pnpm importers; build.js, build_sandbox.js and preflight install with pnpm. - pnpm-lock.yaml, pnpm-workspace.yaml and .pnpmfile.mjs join the autofix supply-chain class and repo-hygiene's deny list; pnpm-lock.yaml joins autofix's generated-diff exclusions, sdk-java's path filter and the platform-sensitivity manifests. - .gitignore lists /package-lock.json so an npm install cannot commit it back. Tests and docs follow. * fix(standalone): read the node-pty versions from the pnpm lockfile * chore(vscode-ide-companion): regenerate NOTICES.txt after the lockfile swap * chore(vscode-ide-companion): regenerate NOTICES.txt from the pnpm dependency tree The committed NOTICES.txt was generated from an npm install and does not match the tree produced by the pnpm install the release pipeline now uses (659 resolved dependencies, differing @types/node and mime-db versions). Regenerating with the pinned pnpm install makes the freshness check reproducible. * fix(ci): drop the npm cache from the daily dependency audit actions/setup-node's npm cache keys off the root package-lock.json, which this branch retires, so the scheduled job would fail at Set up Node before the audit ran. No pull_request run reaches this workflow to catch it. The root tree is never installed here either: pnpm audit reads pnpm-lock.yaml directly. Matches the sibling workflows that already set package-manager-cache: false; scripts/tests/security-workflows.test.js now pins it. * chore(ci): stop banking main-side drift in the workflow size ratchet The ratchet exists to turn a workflow's growth into one reviewed line. This branch re-recorded entries for 17 workflows it never touches, several upward by 0.4-2.8 KB - drift that happened on main, banked into the manifest without review. Restore those to their merge-base values, so .size-baseline changes only for the 22 workflows this branch actually edits. The entries were not needed to go green: ci.yml passes the PR's base commit, so a file that drifted on main and is otherwise untouched earns a warning, not a failure. * fix(release): initialize standalone state before main * test(browser-use): read Playwright pin from pnpm lock * fix(ci): address pnpm migration review blockers * fix(desktop): stop reading the retired root lockfile --------- Co-authored-by: Qwen-Coder <[email protected]>
327 lines
17 KiB
YAML
327 lines
17 KiB
YAML
name: 'Web-shell Visuals'
|
|
|
|
# For PRs that touch the web-shell UI, render its screenshots (light + dark)
|
|
# against BOTH the PR base (`main`) and the PR head, diff them, and stitch a
|
|
# "main | this PR" composite for the views that CHANGED (plus short flow
|
|
# recordings). The images are handed to the companion
|
|
# `web-shell-visuals-publish.yml` (workflow_run), which posts them inline on the
|
|
# PR. A PR with no visual impact composites nothing → "no visual change".
|
|
#
|
|
# Security model: this workflow BUILDS AND RENDERS untrusted PR code, so it runs
|
|
# on the `pull_request` trigger (fork PRs get a read-only token and NO secrets),
|
|
# on an ephemeral hosted runner, with `contents: read` and no secrets of its
|
|
# own. It produces only image/video bytes as an artifact. The privileged step
|
|
# that needs a write token — pushing the images and commenting on the PR — lives
|
|
# in the separate workflow_run workflow that never checks out PR code.
|
|
on:
|
|
pull_request:
|
|
branches:
|
|
- 'main'
|
|
- 'release/**'
|
|
# Matches the /tmux flow's web-shell surface: only the client UI, so
|
|
# doc/config-only PRs don't trigger a full build + render.
|
|
paths:
|
|
- 'packages/web-shell/client/**'
|
|
- 'packages/web-shell/package.json'
|
|
- 'packages/web-shell/vite.config.ts'
|
|
- 'packages/web-shell/playwright.visuals.config.ts'
|
|
# NOTE: packages/sdk-typescript/src/** is deliberately NOT a trigger.
|
|
# It is aliased in too, but the visuals render against a *mock* daemon, so
|
|
# the SDK's transport/client layer is stubbed at the network boundary and
|
|
# its changes don't alter the canned scenarios — e.g. #6911 only added a
|
|
# DaemonClient data-layer method yet still re-posted identical screenshots
|
|
# on a pure-backend PR. The web-shell client imports no runtime code from
|
|
# the SDK root and only type-imports DaemonClient, so leaving the SDK out
|
|
# avoids spamming backend PRs. If an SDK-only, render-shaping change ever
|
|
# needs a preview, add the specific file (e.g. daemon/events.ts) here
|
|
# rather than the whole tree.
|
|
# The capture pipeline itself, so a workflow-only change is exercised.
|
|
- '.github/workflows/web-shell-visuals.yml'
|
|
# The before/after compositor, so a compose-only change is exercised.
|
|
- '.github/scripts/web-shell-visuals-compose.mjs'
|
|
|
|
permissions:
|
|
contents: 'read'
|
|
|
|
concurrency:
|
|
group: '${{ github.workflow }}-${{ github.event.pull_request.number }}'
|
|
cancel-in-progress: true
|
|
|
|
defaults:
|
|
run:
|
|
shell: 'bash'
|
|
|
|
jobs:
|
|
capture:
|
|
name: 'Capture web-shell visuals (ubuntu-latest, Node 22.x)'
|
|
if: "${{ github.repository == 'QwenLM/qwen-code' }}"
|
|
runs-on: 'ubuntu-latest'
|
|
# ~2x the original: the job now also builds + renders the merge-base arm.
|
|
timeout-minutes: 30
|
|
steps:
|
|
- name: 'Checkout PR head'
|
|
uses: 'actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10' # v6.0.3
|
|
with:
|
|
ref: '${{ github.event.pull_request.head.sha }}'
|
|
fetch-depth: 1
|
|
persist-credentials: false
|
|
|
|
- name: 'Set up Node.js 22.x'
|
|
uses: 'actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e' # v6.4.0
|
|
with:
|
|
node-version: '22.x'
|
|
package-manager-cache: false
|
|
registry-url: 'https://registry.npmjs.org/'
|
|
|
|
- name: 'Cache pnpm store (hosted)'
|
|
if: "${{ runner.environment == 'github-hosted' }}"
|
|
uses: './.github/actions/pnpm-store-cache'
|
|
|
|
- name: 'Configure npm for rate limiting'
|
|
run: |-
|
|
npm config set fetch-retry-mintimeout 20000
|
|
npm config set fetch-retry-maxtimeout 120000
|
|
npm config set fetch-retries 5
|
|
npm config set fetch-timeout 300000
|
|
|
|
- name: 'Install dependencies'
|
|
run: 'corepack pnpm install --frozen-lockfile --prefer-offline --reporter=append-only'
|
|
|
|
- name: 'Install Playwright Chromium'
|
|
run: 'npx playwright install --with-deps chromium'
|
|
|
|
- name: 'Choose web-shell Playwright port'
|
|
run: |-
|
|
port="$(node -e "const net=require('node:net');const server=net.createServer();server.listen(0,'127.0.0.1',()=>{console.log(server.address().port);server.close();});")"
|
|
echo "PLAYWRIGHT_PORT=${port}" >> "${GITHUB_ENV}"
|
|
echo "Using web-shell Playwright port ${port}"
|
|
|
|
# continue-on-error: a single failing/timing-out scenario must NOT discard
|
|
# the whole preview. Playwright writes each PNG/webm as its test passes, so
|
|
# the captures from the scenarios that DID pass are already on disk; the
|
|
# steps below (compose/upload) then publish those instead of the job dying
|
|
# here and the passing shots never being uploaded. The real result is read
|
|
# from `steps.after_capture.outcome` (which continue-on-error does NOT mask,
|
|
# unlike `.conclusion`) and shipped to the publisher as render-status.txt,
|
|
# so the comment says "render incomplete" rather than a misleading
|
|
# "no changes" when a scenario broke. The job stays green because the
|
|
# publish workflow only runs on a `success` conclusion; the broken scenario
|
|
# is surfaced in the comment, not by sinking every other PR author's preview.
|
|
- name: 'Capture screenshots and flow recordings (after / PR head)'
|
|
id: 'after_capture'
|
|
continue-on-error: true
|
|
env:
|
|
WEB_SHELL_VISUALS_OUTPUT_DIR: '${{ runner.temp }}/web-shell-visuals'
|
|
run: 'npm run test:e2e:visuals --workspace=packages/web-shell'
|
|
|
|
# --- Before/after: render the PR's MERGE-BASE too, then keep only CHANGED
|
|
# views. The merge-base — NOT the base-branch tip — is the correct "before"
|
|
# for a `head.sha` render: a PR branch behind `main` would otherwise show
|
|
# other people's already-landed web-shell changes, reversed, as this PR's
|
|
# diff. The merge-base is trusted history, so this adds no secret exposure
|
|
# to the untrusted-PR job — it only produces more image bytes. Every base
|
|
# step is best-effort (continue-on-error): a flaky base build/render
|
|
# degrades to after-only (each view tagged NEW), never sinking the preview.
|
|
- name: 'Resolve the merge-base'
|
|
id: 'mergebase'
|
|
env:
|
|
GH_TOKEN: '${{ secrets.GITHUB_TOKEN }}'
|
|
BASE_SHA: '${{ github.event.pull_request.base.sha }}'
|
|
HEAD_SHA: '${{ github.event.pull_request.head.sha }}'
|
|
run: |-
|
|
set -euo pipefail
|
|
# Read token suffices and works for fork PRs. Retry a few times; if it
|
|
# STILL fails, emit an EMPTY sha so the before render is skipped
|
|
# entirely (after-only). Falling back to the base-branch tip would
|
|
# reintroduce the exact reversed-diff bug the merge-base prevents.
|
|
MB=''
|
|
for attempt in 1 2 3; do
|
|
MB="$(gh api "repos/${GITHUB_REPOSITORY}/compare/${BASE_SHA}...${HEAD_SHA}" --jq '.merge_base_commit.sha' 2>/dev/null || true)"
|
|
[ -n "${MB}" ] && break
|
|
sleep 2
|
|
done
|
|
echo "sha=${MB}" >> "${GITHUB_OUTPUT}"
|
|
if [ -n "${MB}" ]; then
|
|
echo "before (merge-base) = ${MB}"
|
|
else
|
|
echo "::warning::could not resolve the merge-base; skipping the before render (after-only)."
|
|
fi
|
|
|
|
- name: 'Check out the merge-base (before render)'
|
|
id: 'base_checkout'
|
|
if: "${{ steps.mergebase.outputs.sha != '' }}"
|
|
continue-on-error: true
|
|
uses: 'actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10' # v6.0.3
|
|
with:
|
|
ref: '${{ steps.mergebase.outputs.sha }}'
|
|
path: 'base'
|
|
fetch-depth: 1
|
|
persist-credentials: false
|
|
|
|
- name: 'Install base dependencies'
|
|
id: 'base_install'
|
|
if: "${{ steps.base_checkout.outcome == 'success' }}"
|
|
continue-on-error: true
|
|
working-directory: 'base'
|
|
# The base checkout can predate pnpm-lock.yaml; install it the way
|
|
# that commit was built.
|
|
run: |-
|
|
if [ -f pnpm-lock.yaml ]; then
|
|
corepack pnpm install --frozen-lockfile --prefer-offline --reporter=append-only
|
|
else
|
|
npm ci --prefer-offline --no-audit --progress=false
|
|
fi
|
|
|
|
# Run ONLY when the checkout AND install both succeeded. `base/` is nested
|
|
# under the head checkout, so if the base's own node_modules is absent (a
|
|
# failed npm ci) the render would resolve Playwright/Vite UP to the head's
|
|
# node_modules and produce a HYBRID before. A skip here → absent baseline →
|
|
# after-only. Screenshots only (base flow videos are discarded); `--`
|
|
# passes the spec through to `playwright test`; browsers are shared.
|
|
#
|
|
# The positional filters are an explicit allowlist of every
|
|
# screenshot-producing spec: a view rendered only by a spec missing here
|
|
# never gets a merge-base baseline, so the composer keeps stamping it
|
|
# "new scenario" on every PR instead of diffing it. When adding a new
|
|
# screenshot spec, append it here too. The video-flow specs
|
|
# (flows.spec.ts) and the animation-harness test (harness.spec.ts) stay
|
|
# out — the base arm discards recordings, so rendering them is waste.
|
|
- name: 'Capture before (base) screenshots'
|
|
if: "${{ steps.base_checkout.outcome == 'success' && steps.base_install.outcome == 'success' }}"
|
|
working-directory: 'base'
|
|
continue-on-error: true
|
|
env:
|
|
WEB_SHELL_VISUALS_OUTPUT_DIR: '${{ runner.temp }}/web-shell-before'
|
|
run: 'npm run test:e2e:visuals --workspace=packages/web-shell -- screenshots.spec.ts workflow-page.spec.ts git-branch-picker.spec.ts session-workflow.spec.ts'
|
|
|
|
- name: 'Compose before/after and keep only changed views'
|
|
env:
|
|
BEFORE_DIR: '${{ runner.temp }}/web-shell-before/screenshots'
|
|
AFTER_DIR: '${{ runner.temp }}/web-shell-visuals/screenshots'
|
|
OUT_DIR: '${{ runner.temp }}/web-shell-visuals'
|
|
run: |-
|
|
set -euo pipefail
|
|
# Diff each <view>-<theme>.png against the base render and stitch a
|
|
# labelled "main | this PR" composite for the views that changed. The
|
|
# composites REPLACE the raw after-shots as the published screenshots,
|
|
# reusing the <view>-<theme>.png name the publish step already expects.
|
|
if node .github/scripts/web-shell-visuals-compose.mjs \
|
|
"${BEFORE_DIR}" "${AFTER_DIR}" "${OUT_DIR}/composite"; then
|
|
rm -f "${OUT_DIR}/composite/manifest.json"
|
|
rm -rf "${OUT_DIR}/screenshots"
|
|
mv "${OUT_DIR}/composite" "${OUT_DIR}/screenshots"
|
|
echo "Changed views composited: $(find "${OUT_DIR}/screenshots" -name '*.png' | wc -l | tr -d ' ')"
|
|
else
|
|
# Degrade rather than sink: leave the raw after-shots in
|
|
# ${OUT_DIR}/screenshots so the PR still gets a (head-only) preview.
|
|
echo "::warning::compose failed; publishing raw after-shots without a before/after."
|
|
fi
|
|
|
|
- name: 'Convert flow recordings to inline GIFs'
|
|
env:
|
|
OUT_DIR: '${{ runner.temp }}/web-shell-visuals'
|
|
run: |-
|
|
set -euo pipefail
|
|
if ! command -v ffmpeg >/dev/null 2>&1; then
|
|
echo "::warning::ffmpeg not found on the runner; skipping GIF conversion (raw .webm is still uploaded)."
|
|
exit 0
|
|
fi
|
|
mkdir -p "${OUT_DIR}/gifs"
|
|
shopt -s nullglob
|
|
converted=0
|
|
for webm in "${OUT_DIR}"/video/*.webm; do
|
|
name="$(basename "${webm%.webm}")"
|
|
gif="${OUT_DIR}/gifs/${name}.gif"
|
|
# -ss 1 trims the ~1s blank while the page loads. Two-pass palette
|
|
# (generate + apply) keeps the GIF sharp at a fraction of naive size.
|
|
if err="$(ffmpeg -y -ss 1 -i "${webm}" \
|
|
-vf "fps=12,scale=960:-1:flags=lanczos,split[s0][s1];[s0]palettegen=stats_mode=diff[p];[s1][p]paletteuse=dither=bayer:bayer_scale=3" \
|
|
"${gif}" 2>&1)"; then
|
|
echo "converted ${name}.webm -> gifs/${name}.gif ($(du -h "${gif}" | cut -f1))"
|
|
converted=$((converted + 1))
|
|
else
|
|
# Surface ffmpeg's own diagnostic (codec/container/filter error)
|
|
# instead of a bare "failed", so a future breakage is actionable.
|
|
detail="$(printf '%s' "${err}" | tr '\n' ' ' | tail -c 400)"
|
|
echo "::warning::ffmpeg failed to convert ${name}.webm; skipping its GIF. ${detail}"
|
|
rm -f "${gif}"
|
|
fi
|
|
done
|
|
echo "GIFs produced: ${converted}"
|
|
|
|
- name: 'Record PR metadata for the publish workflow'
|
|
env:
|
|
OUT_DIR: '${{ runner.temp }}/web-shell-visuals'
|
|
PR_NUMBER: '${{ github.event.pull_request.number }}'
|
|
# The TRUE after-render result. `.outcome` is the pre-continue-on-error
|
|
# value ('failure' when >=1 scenario failed), unlike `.conclusion` which
|
|
# the continue-on-error masks to 'success'. The publisher reads this to
|
|
# decide whether an empty/partial preview means "no visual change" or
|
|
# "a scenario failed to render" — the two must not look alike.
|
|
AFTER_OUTCOME: '${{ steps.after_capture.outcome }}'
|
|
run: |-
|
|
set -euo pipefail
|
|
# Ensure both dirs exist so the counts below are robust even when an
|
|
# upstream step produced none (e.g. no ffmpeg -> no gifs/). (The finds
|
|
# sit inside `echo "$(...)"`, so a missing dir wouldn't actually trip
|
|
# set -e — echo masks it — but create them for clarity all the same.)
|
|
mkdir -p "${OUT_DIR}/screenshots" "${OUT_DIR}/gifs"
|
|
# Bound artifact contents BEFORE upload: this job ran untrusted PR
|
|
# code, so drop oversized files and cap the count per directory —
|
|
# otherwise a hostile spec could bloat the published artifact (which
|
|
# the privileged publisher downloads) or the retained video artifact.
|
|
MAX_FILE_BYTES=$((6 * 1024 * 1024))
|
|
MAX_FILES=40
|
|
for d in screenshots gifs video; do
|
|
dir="${OUT_DIR}/${d}"
|
|
[ -d "${dir}" ] || continue
|
|
find "${dir}" -maxdepth 1 -type f -size "+${MAX_FILE_BYTES}c" \
|
|
-printf '::warning::dropping oversized artifact file %p\n' -delete || true
|
|
find "${dir}" -maxdepth 1 -type f -printf '%f\n' | LC_ALL=C sort \
|
|
| tail -n "+$((MAX_FILES + 1))" \
|
|
| while IFS= read -r extra; do
|
|
echo "::warning::dropping excess artifact file ${d}/${extra}"
|
|
rm -f "${dir}/${extra}"
|
|
done
|
|
done
|
|
# PR number for the workflow_run publish job (which validates it).
|
|
# The head SHA is intentionally NOT shipped in the artifact: the
|
|
# publish job binds to the authenticated github.event.workflow_run
|
|
# .head_sha, and an artifact-sourced SHA would be untrusted.
|
|
printf '%s\n' "${PR_NUMBER}" > "${OUT_DIR}/pr.txt"
|
|
# Render status for the publisher: 'failure' when >=1 scenario failed
|
|
# (default to 'failure' if the step somehow reported nothing, so an
|
|
# unknown state fails safe toward "incomplete" rather than a false
|
|
# all-clear). Anything other than the literal 'success' is treated as
|
|
# incomplete on the publish side.
|
|
printf '%s\n' "${AFTER_OUTCOME:-failure}" > "${OUT_DIR}/render-status.txt"
|
|
echo "Screenshots: $(find "${OUT_DIR}/screenshots" -name '*.png' | wc -l | tr -d ' ')"
|
|
echo "GIFs: $(find "${OUT_DIR}/gifs" -name '*.gif' | wc -l | tr -d ' ')"
|
|
echo "After-render outcome: ${AFTER_OUTCOME:-unknown}"
|
|
|
|
# The privileged publish workflow downloads THIS artifact, so keep the raw
|
|
# videos out of it: an untrusted PR could drop a multi-GB file under
|
|
# video/ and exhaust the publisher's bandwidth/disk/timeout. Screenshots
|
|
# and GIFs (which the publisher hosts) are size-capped again on that side.
|
|
- name: 'Upload web-shell visuals artifact (published)'
|
|
uses: 'actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a' # v7.0.1
|
|
with:
|
|
name: 'web-shell-visuals'
|
|
path: |-
|
|
${{ runner.temp }}/web-shell-visuals/screenshots
|
|
${{ runner.temp }}/web-shell-visuals/gifs
|
|
${{ runner.temp }}/web-shell-visuals/pr.txt
|
|
${{ runner.temp }}/web-shell-visuals/render-status.txt
|
|
if-no-files-found: 'warn'
|
|
retention-days: 7
|
|
|
|
# Raw recordings live in a SEPARATE artifact the publish workflow never
|
|
# downloads — they're only the "full-resolution recordings" link target.
|
|
- name: 'Upload raw flow recordings'
|
|
uses: 'actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a' # v7.0.1
|
|
with:
|
|
name: 'web-shell-visuals-video'
|
|
path: '${{ runner.temp }}/web-shell-visuals/video'
|
|
if-no-files-found: 'ignore'
|
|
retention-days: 7
|