Files
agent-radar 1a3a4ccde1
Creator App Tests / PR Spam Gate (push) Skipped
Frontend Tests / PR Spam Gate (push) Skipped
NPM Format (website & console) / PR Spam Gate (push) Skipped
Pre-commit Checks / PR Spam Gate (push) Skipped
QwenPaw Creator Plugin Release / check-version (push) Canceled after 0s
QwenPaw Creator Plugin Release / upload-oss (push) Canceled after 0s
Tests / PR Spam Gate (push) Skipped
CodeQL / CodeQL (python) (push) Canceled after 0s
CodeQL / CodeQL (typescript) (push) Canceled after 0s
Creator App Tests / Creator Backend Tests (push) Canceled after 0s
Creator App Tests / Creator UI Build & Tests (push) Canceled after 0s
E2E Smoke Tests / Playwright UI Smoke (push) Canceled after 0s
Frontend Tests / Detect console changes (push) Canceled after 0s
NPM Format (website & console) / website format check (push) Canceled after 0s
NPM Format (website & console) / console format check (push) Canceled after 0s
Pre-commit Checks / Pre-commit (push) Canceled after 0s
QwenPaw Data Plugin Release / check-version (push) Canceled after 0s
Tests / Detect code changes (push) Canceled after 0s
Frontend Tests / Vitest Unit Tests (push) Canceled after 0s
Frontend Tests / Frontend Summary (push) Canceled after 0s
QwenPaw Data Plugin Release / upload-oss (push) Canceled after 0s
Tests / Maintainer Approval (push) Canceled after 0s
Tests / Unit Tests - py3.11 - macos-latest (push) Canceled after 0s
Tests / Unit Tests - py3.11 - ubuntu-latest (push) Canceled after 0s
Tests / Unit Tests - py3.13 - ubuntu-latest (push) Canceled after 0s
Tests / Unit Tests - py3.11 - windows-latest (push) Canceled after 0s
Tests / Contract Tests - py3.11 - macos-latest (push) Canceled after 0s
Tests / Contract Tests - py3.11 - ubuntu-latest (push) Canceled after 0s
Tests / Contract Tests - py3.13 - ubuntu-latest (push) Canceled after 0s
Tests / Contract Tests - py3.11 - windows-latest (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - macos-latest - p0 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - macos-latest - p1 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - macos-latest - p2 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - ubuntu-latest - fallback (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - ubuntu-latest - p0 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - ubuntu-latest - p1 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - ubuntu-latest - p2 (push) Canceled after 0s
Tests / Integrated Tests - py3.13 - ubuntu-latest - p0 (push) Canceled after 0s
Tests / Integrated Tests - py3.13 - ubuntu-latest - p1 (push) Canceled after 0s
Tests / Integrated Tests - py3.13 - ubuntu-latest - p2 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - windows-latest - p0 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - windows-latest - p1 (push) Canceled after 0s
Tests / Integrated Tests - py3.11 - windows-latest - p2 (push) Canceled after 0s
Tests / Coverage Report (push) Canceled after 0s
Tests / Test Summary (push) Canceled after 0s
源码快照 @ 2026-09-01 (source-only, 剔除非源码素材)
2026-09-01 20:01:50 +08:00

142 lines
5.2 KiB
YAML

name: Frontend Tests
on:
push:
branches: [main, master, dev, develop]
paths:
- 'console/**'
- '.github/workflows/frontend-tests.yml'
pull_request:
# Default types plus ready_for_review: converting a draft PR to
# ready must re-trigger this workflow so vitest really runs right
# after the author leaves draft state.
types: [opened, synchronize, reopened, ready_for_review]
branches: [main, master, dev, develop]
jobs:
spam-gate:
name: PR Spam Gate
if: github.event_name == 'pull_request'
uses: ./.github/workflows/pr-spam-gate.yml
with:
author: ${{ github.event.pull_request.user.login }}
# Replaces the former `on.pull_request.paths` filter: the workflow now runs
# (and reports a status) on every PR so `Frontend Summary` can be a
# required check; PRs not touching the console skip the actual test run
# and the summary reports an explicit success instead of a skip.
changes:
name: Detect console changes
runs-on: ubuntu-latest
outputs:
code: ${{ github.event_name != 'pull_request' && 'true' || steps.filter.outputs.code }}
steps:
- uses: actions/checkout@v4
if: github.event_name == 'pull_request'
- uses: dorny/paths-filter@v3
if: github.event_name == 'pull_request'
id: filter
with:
filters: |
code:
- 'console/**'
- '.github/workflows/frontend-tests.yml'
vitest:
name: Vitest Unit Tests
needs: [spam-gate, changes]
# Also guard on the detection job's RESULT: if detection failed/was
# cancelled its `code` output is empty and this job would silently skip,
# which a ruleset cannot distinguish from a bypass. The frontend-summary
# job below turns that detection failure into a hard red.
# Draft PRs defer the real run: the summary reports an explicit green
# placeholder (GitHub forbids merging drafts), and the ready_for_review
# trigger re-runs everything when the PR is marked ready.
if: |
always() &&
needs.changes.result == 'success' &&
needs.changes.outputs.code == 'true' &&
(needs.spam-gate.result == 'skipped' || needs.spam-gate.outputs.blocked != 'true') &&
(github.event_name != 'pull_request' || github.event.pull_request.draft == false)
runs-on: ubuntu-latest
defaults:
run:
working-directory: console
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
cache-dependency-path: console/package-lock.json
- name: Install dependencies
run: npm ci
# A single vitest pass: runs the full suite AND enforces the coverage
# ratchet (fails on test failures or coverage regression). The previous
# separate `npm run test:run` pass executed the identical suite twice.
- name: Run unit tests with coverage (ratchet blocks PR on regression)
run: npm run test:coverage
- name: Upload coverage report
if: always()
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: console/coverage/
retention-days: 7
frontend-summary:
name: Frontend Summary
needs: [changes, spam-gate, vitest]
# Fail-closed gate. This job ALWAYS runs (no path condition) so the
# required-check context can never be satisfied by an accidental skip.
# Four-state decision, mirroring `Test Summary` in tests.yml:
# 1. change detection did not succeed -> red;
# 2. detection succeeded, no console changes -> explicit green;
# 3. draft PR with console changes -> explicit green placeholder
# (the real run resumes automatically once the PR is marked
# ready via the ready_for_review trigger);
# 4. console change -> vitest must be strictly `success`.
if: always()
runs-on: ubuntu-latest
steps:
- name: Check frontend results
shell: bash
run: |
echo "Changes detection: ${{ needs.changes.result }}"
echo "Spam gate: ${{ needs.spam-gate.result }}"
echo "Vitest: ${{ needs.vitest.result }}"
if [ "${{ needs.changes.result }}" != "success" ]; then
echo "❌ Change detection did not succeed (${{ needs.changes.result }}) — gate closed, refusing untested merge"
exit 1
fi
if [ "${{ needs.changes.outputs.code }}" != "true" ]; then
echo "✅ No console changes — vitest not required"
exit 0
fi
if [ "${{ github.event_name }}" = "pull_request" ] && \
[ "${{ github.event.pull_request.draft }}" = "true" ]; then
echo "✅ Draft PR — vitest deferred until the PR is marked ready for review"
exit 0
fi
if [ "${{ needs.spam-gate.result }}" = "success" ] && \
[ "${{ needs.spam-gate.outputs.blocked }}" = "true" ]; then
echo "❌ Spam gate blocked this PR"
exit 1
fi
if [ "${{ needs.vitest.result }}" != "success" ]; then
echo "❌ Vitest must be success (failure/cancelled/skipped are all rejected)"
exit 1
fi
echo "✅ Frontend tests passed"