整合 Lighthouse CI
作為前端應用的效能守門員
Kyle Mo@MOPCON 2022
關於我
SWE @LINE TAIWAN
Writer@星巴哥技術週刊
莫力全 Kyle Mo
議程大綱
The Introduction of Lighthouse CI
導入經驗談
Conclusion
01
02
03
The Introduction of Lighthouse CI
Lighthouse
Try Lighthouse CI !
Lighthouse CI
Architecture
Collect
Assertion
Upload
Autorun
.lighthouseci/ on local filesystem
How to use ?
CI Config
Status check
Lighthouse CI
導入經驗談
WHY?
40 + FE Devs
10 + Services
Unified Tech Stack
LINE
Unified Tech Stack
制定各專案間統一開發準則
開發共用 Packages
提升前端應用可觀測性
Web FE Infra Team
JSTF Team
Service 1
Service 2
Service 4
Service 4
JSTF
JSTF Team
seed
seed
seed
seed
lead
Performance – Lighthouse CI
Renovate
SonarQube
SonarQube
ESLint Config
SonarQube �Config
NextJS�Config
React & TS Config
Custom Config
Generator (For New Projects)
Monitoring
Next Steps For JSTF
Performance – Lighthouse CI
Mock API Server
MSW
CI Environment
Backend
Frontend
MSW
lhci-compare
@lhci-server Config
@lhci-server API
Build Data
@lhci-server API
Ancestor API
da1dad1
sq1da21
pa6uyd1
23ffa98
PR A
PR B
PR A
PR A
Master ← Branch A
RC Branch ← Branch B
( GET /projects/:id/builds/:id/ancestor )
Process
取得 Build List,取出 index 0 為 current build
透過 Github API 取得 base branch 最新的前 10 個 commit hash
遍歷最新的 10 個 commit,看看 Build List 中有沒有 match 的 build,有的話就立即 break 迴圈
分別透過 lhci-server statistic API 取得 current build 與 base commit 的統計資料
進行 compare ,建立 template 並留言至 Pull Request
Result
Shortcoming
Value
Thank you
We Are Hiring !
Slide