@@ -2,44 +2,68 @@ name: CI
22
33on :
44 push :
5- branches : [main, master ]
5+ branches : [main]
66 pull_request :
7- branches : [main, master ]
7+ branches : [main]
88
99jobs :
10+ lint-and-test :
11+ name : Lint & Test
12+ runs-on : ubuntu-latest
13+
14+ steps :
15+ - name : Checkout
16+ uses : actions/checkout@v4
17+
18+ - name : Setup pnpm
19+ uses : pnpm/action-setup@v4
20+ with :
21+ version : latest
22+
23+ - name : Setup Node.js
24+ uses : actions/setup-node@v4
25+ with :
26+ node-version : 20
27+ cache : pnpm
28+
29+ - name : Install dependencies
30+ run : pnpm install --frozen-lockfile
31+
32+ - name : Lint
33+ run : pnpm lint
34+
35+ - name : Test
36+ run : pnpm test -- --watchAll=false --passWithNoTests
37+
1038 build :
39+ name : Build
1140 runs-on : ubuntu-latest
41+ needs : lint-and-test
1242
1343 steps :
14- - uses : actions/checkout@v4
44+ - name : Checkout
45+ uses : actions/checkout@v4
1546
16- - name : Set up Node.js
17- if : ${{ hashFiles('package.json') != '' }}
47+ - name : Setup pnpm
48+ uses : pnpm/action-setup@v4
49+ with :
50+ version : latest
51+
52+ - name : Setup Node.js
1853 uses : actions/setup-node@v4
1954 with :
20- node-version : ' 20 '
21- cache : ' npm '
55+ node-version : 20
56+ cache : pnpm
2257
2358 - name : Install dependencies
24- if : ${{ hashFiles('package.json') != '' }}
25- run : npm ci || npm install
26-
27- - name : Run lint
28- if : ${{ hashFiles('package.json') != '' }}
29- run : |
30- if npm run lint --if-present 2>/dev/null; then
31- echo "Lint passed"
32- else
33- echo "No lint script or lint skipped"
34- fi
35- continue-on-error : true
36-
37- - name : Run tests
38- if : ${{ hashFiles('package.json') != '' }}
39- run : |
40- if npm test --if-present 2>/dev/null; then
41- echo "Tests passed"
42- else
43- echo "No test script or tests skipped"
44- fi
45- continue-on-error : true
59+ run : pnpm install --frozen-lockfile
60+
61+ - name : Build
62+ run : pnpm build
63+
64+ - name : Upload dist artifact
65+ uses : actions/upload-artifact@v4
66+ with :
67+ name : dist
68+ path : dist/
69+ retention-days : 7
0 commit comments