-
Notifications
You must be signed in to change notification settings - Fork 21
157 lines (130 loc) · 6.31 KB
/
Copy pathdesign-check.yml
File metadata and controls
157 lines (130 loc) · 6.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
name: Design System Check
on:
pull_request:
branches: [main]
push:
branches: [main]
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- run: npm ci
- name: Design Check (Schema + Rules + Contracts)
run: npm run design:check
- name: Lint Generated UI (変更された .html/.tsx/.jsx/.vue を禁止パターン検査)
run: |
if [ "${{ github.event_name }}" = "pull_request" ]; then
BASE=$(git merge-base "origin/${{ github.base_ref }}" HEAD)
else
BASE="${{ github.event.before }}"
fi
# 初回 push / force-push で before が zero SHA や未取得の場合は HEAD~1 に fallback
if ! git cat-file -e "${BASE}^{commit}" 2>/dev/null; then
BASE=$(git rev-parse HEAD~1 2>/dev/null || git hash-object -t tree /dev/null)
fi
# NUL 区切りで空白入りパスにも安全に対応。
# tests/fixtures/external-ds/*/samples/ は **別の DS の検体**(melta のルールで
# 検査すると、意図的に仕込んだ違反が melta の違反として報告される)。その bundle
# 自身のルールでの検査は tests/external-ds.spec.ts が担当するので除外する。
# 除外は samples/ だけに絞る(fixture 配下を丸ごと外すと、将来置いた実ファイルが
# 黙って無検査になる)。
#
# grep は 0 件で exit 1 を返す。パイプの途中に置いたまま終了コードを見ると
# pipefail 下で「対象なし = CI 失敗」に化けるため、
# 一度ファイルに落として件数で明示的に分岐する(GHA 既定の bash -e では
# 現状発火しないが、shell: bash を足した瞬間に壊れる潜伏罠)。
#
# ただし `|| true` で握り潰すと **git diff の失敗まで「対象なし」= 成功**に
# なるため、no-match の exit 1 だけを許容する(grep は 2 以上が本物のエラー)。
# 一時ファイルは mktemp で実行ごとに一意化する(固定パスは残骸の再利用と競合を招く)。
WORKDIR=$(mktemp -d)
trap 'rm -rf "$WORKDIR"' EXIT
CHANGED="$WORKDIR/changed.z"
FILTERED="$WORKDIR/filtered.z"
TARGETS="$WORKDIR/targets.z"
# git diff の失敗は set -e でそのまま step を落とす
git diff -z --name-only --diff-filter=d "$BASE" HEAD > "$CHANGED"
grep -zE '\.(html|tsx|jsx|vue)$' "$CHANGED" > "$FILTERED" || [ $? -eq 1 ]
grep -zv '^tests/fixtures/external-ds/[^/]*/samples/' "$FILTERED" > "$TARGETS" || [ $? -eq 1 ]
if [ ! -s "$TARGETS" ]; then
echo "✅ 生成物 lint PASSED(対象なし)"
elif xargs -0 -r npm run design:lint-generated -- < "$TARGETS"; then
echo "✅ 生成物 lint PASSED"
else
echo "❌ 生成物 lint FAILED"
exit 1
fi
- name: Full Scan (examples/ + docs/ の error 検査 + warn ラチェット)
run: npm run design:lint-generated -- --baseline .design-baseline.json examples/*.html docs/*.html
- name: Drift Check (Docs ↔ Contracts 整合性)
run: npm run design:drift
- name: DESIGN.md Lint (Google 公式 linter — spec 準拠 / token 参照 / WCAG contrast)
run: npm run design:designmd-lint
- name: Contract Compat Gate (npm latest vs HEAD の破壊的変更 × semver 検査)
run: npm run design:compat -- --require-network
- name: llms.txt Freshness (生成物がコミット内容と一致するか)
run: |
npm run design:llms
git diff --exit-code llms.txt llms-full.txt
- name: design-review rules-index Freshness (skill の生成層が rules.json と一致するか)
run: |
npm run design:skill-index
git diff --exit-code skills/design-review/references/rules-index.md
# contract を更新したのに design:build を回し忘れると、MCP が配る
# metadata/components.json だけ古い契約を返し続ける(実際に card 2.1.0 の
# a11y 追加が 1 コミット分 stale なまま出荷されていた)
- name: components.json Freshness (contract → metadata の生成物が最新か)
run: |
npm run design:build
git diff --exit-code metadata/components.json
- name: Token Validation (tokens.json ↔ ds-config.js / ds-theme.css)
run: npm run validate
- name: TypeScript Build
run: npm run build
- name: Pack Smoke (npm pack → 展開 → 同梱 contracts version + deep import の consumer 検証)
run: npm run check:pack -- --require-network
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- run: npm ci
- name: Install Playwright Browsers
run: npx playwright install --with-deps chromium
- name: Playwright + axe Tests
run: npm test
reset-vrt:
# リセットCSS差し替え VRT(DADS 取り込み V1)。
# 2026-07-19 の新設から CI Linux でのみ kiso.css の scrollbar-gutter: stable により
# fail し続けていた(#14。continue-on-error で non-blocking だったため 2 か月気づかれず)。
# Host-Reset Defense で塞いだ 2026-09-07(#17)から required
# (docs/lint-and-reset-vrt-adoption-plan.md V1 の昇格条件をクローズ)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- run: npm ci
- name: Install Playwright Browsers
run: npx playwright install --with-deps chromium
- name: Reset-swap VRT (5 リセットCSS × pixelmatch diff 0)
run: npm run test:reset-vrt
- name: Upload diff artifacts on failure
if: failure()
uses: actions/upload-artifact@v4
with:
name: reset-vrt-diffs
path: test-results/
retention-days: 7