TESTING / RELEASE CORE · 123
CI Quality Gates:什麼條件不成立,就不准進下一層
CI 不只是「自動跑 test」。它把 repository 必須維持的 invariants 變成可重複 gate,而且要按成本由便宜到昂貴排序,讓 failure 盡量早出現。
Learning outcomes
- 能設計 fail-fast gate 順序。
- 能區分 source checks 與 artifact checks。
- 能理解 CI PASS 的能力邊界。
- 能把 curriculum/data quality 也變成自動 gate。
1. Fail-fast ordering
install
↓
syntax
↓
learning-data / course-depth
↓
specialized lab checks
↓
site integrity
↓
build
↓
dist artifact verificationSyntax error 不應等 build 10 分鐘後才發現。
2. 本站目前真的在跑的 gates
npm run check:js
npm run check:learning
npm run check:course-depth
npm run check:tslab
npm run check:reactlab
npm run check
npm run build
npm run check:dist教材資料、TypeScript/React lab、link integrity、production artifact 都有不同 checker。
3. Source PASS ≠ Artifact PASS
Source lessons 存在不代表 build 後的 dist 一定有它們,也不代表 runtime scripts 有正確注入。因此 build 後還要 verify artifact。
4. CI 必須可重複
如果 check 依賴 developer 本機手工環境、未記錄檔案或 production state,CI 就無法真正重現。
5. CI PASS ≠ Production 正常
CI 只能證明在 runner 環境的一組條件成立。Production credential、routing、第三方 service、真實 deployment artifact 還要部署後 smoke/observability。
Project checkpoint:Software Learning Lab CI
Source
↓ quality gates
Build dist/
↓ artifact gate
Manual production gate
↓ Cloudflare deploy
Production smoke
↓ PASS / rollback decisionDebug evidence:哪個 step 第一個紅?
Actions 的 job/step 本身就是 failure boundary。不要看到整個 workflow 紅色就直接猜 Cloudflare;先找最後成功、第一失敗 step。
Knowledge check
- 為什麼 syntax check 應比 build 早?
- source check 和 dist check 差在哪?
- course-depth gate 在保護什麼?
- CI 全綠後還需要 production smoke 嗎?