1+ # Blade Code CI/CD Pipeline
2+ name : CI/CD
3+
4+ on :
5+ push :
6+ branches : [main, develop]
7+ pull_request :
8+ branches : [main, develop]
9+
10+ jobs :
11+ test :
12+ name : Test Suite (${{ matrix.node-version }})
13+ runs-on : ubuntu-latest
14+ strategy :
15+ matrix :
16+ node-version : [18.x, 20.x]
17+
18+ steps :
19+ - name : Checkout code
20+ uses : actions/checkout@v4
21+
22+ - name : Setup Node.js ${{ matrix.node-version }}
23+ uses : actions/setup-node@v4
24+ with :
25+ node-version : ${{ matrix.node-version }}
26+ cache : ' pnpm'
27+
28+ - name : Setup pnpm
29+ uses : pnpm/action-setup@v4
30+ with :
31+ version : 8
32+
33+ - name : Install dependencies
34+ run : pnpm install
35+
36+ - name : Run tests
37+ run : pnpm test
38+
39+ - name : Run type check
40+ run : pnpm run type-check
41+
42+ - name : Build project
43+ run : pnpm run build
44+
45+ - name : Test build
46+ run : pnpm run start -- --help
47+
48+ code-quality :
49+ name : Code Quality
50+ runs-on : ubuntu-latest
51+
52+ steps :
53+ - name : Checkout code
54+ uses : actions/checkout@v4
55+
56+ - name : Setup Node.js
57+ uses : actions/setup-node@v4
58+ with :
59+ node-version : ' 20.x'
60+ cache : ' pnpm'
61+
62+ - name : Setup pnpm
63+ uses : pnpm/action-setup@v4
64+ with :
65+ version : 8
66+
67+ - name : Install dependencies
68+ run : pnpm install
69+
70+ - name : Run linter and formatter
71+ run : pnpm run check
72+ continue-on-error : true # 暂时允许失败,避免阻塞 MR
73+
74+ cross-platform :
75+ name : Cross Platform (${{ matrix.os }})
76+ runs-on : ${{ matrix.os }}
77+ strategy :
78+ matrix :
79+ os : [ubuntu-latest, windows-latest, macos-latest]
80+ node-version : [20.x]
81+
82+ steps :
83+ - name : Checkout code
84+ uses : actions/checkout@v4
85+
86+ - name : Setup Node.js
87+ uses : actions/setup-node@v4
88+ with :
89+ node-version : ${{ matrix.node-version }}
90+ cache : ' pnpm'
91+
92+ - name : Setup pnpm
93+ uses : pnpm/action-setup@v4
94+ with :
95+ version : 8
96+
97+ - name : Install dependencies
98+ run : pnpm install
99+
100+ - name : Build project
101+ run : pnpm run build
102+
103+ - name : Test CLI basics
104+ run : pnpm run start -- --help
105+
106+ env :
107+ CI : true
108+ NODE_ENV : test
0 commit comments