@@ -2,36 +2,119 @@ name: CI
22
33on :
44 push :
5- branches : [" main" ]
5+ branches : [main, develop ]
66 pull_request :
7- types : [opened, synchronize]
7+ branches : [main, develop]
8+
9+ concurrency :
10+ group : ${{ github.workflow }}-${{ github.ref }}
11+ cancel-in-progress : true
12+
13+ env :
14+ NODE_VERSION : ' 20'
815
916jobs :
10- build :
11- name : Build and Test
12- timeout-minutes : 15
17+ lint :
18+ name : Lint
1319 runs-on : ubuntu-latest
14-
20+ timeout-minutes : 5
1521 steps :
16- - name : Check out code
17- uses : actions/checkout@v4
22+ - uses : actions/checkout@v6
23+ - name : Setup Node.js
24+ uses : actions/setup-node@v6
1825 with :
19- fetch-depth : 2
26+ node-version : ${{ env.NODE_VERSION }}
27+ cache : ' npm'
28+ - name : Install dependencies
29+ run : npm ci
30+ - name : Run ESLint
31+ run : npm run lint -- -- --max-warnings=0
2032
21- - name : Setup Node.js environment
22- uses : actions/setup-node@v4
33+ typecheck :
34+ name : Type Check
35+ runs-on : ubuntu-latest
36+ timeout-minutes : 5
37+ steps :
38+ - uses : actions/checkout@v6
39+ - name : Setup Node.js
40+ uses : actions/setup-node@v6
2341 with :
24- node-version : 20
42+ node-version : ${{ env.NODE_VERSION }}
2543 cache : ' npm'
26-
2744 - name : Install dependencies
2845 run : npm ci
46+ - name : Type check
47+ run : npm run type-check
2948
30- - name : Build
31- run : npx turbo build
49+ format :
50+ name : Format Check
51+ runs-on : ubuntu-latest
52+ timeout-minutes : 5
53+ steps :
54+ - uses : actions/checkout@v6
55+ - name : Setup Node.js
56+ uses : actions/setup-node@v6
57+ with :
58+ node-version : ${{ env.NODE_VERSION }}
59+ cache : ' npm'
60+ - name : Install dependencies
61+ run : npm ci
62+ - name : Format check
63+ run : npm run format:check
3264
33- - name : Lint
34- run : npx turbo lint
65+ build-and-test :
66+ name : Build & Test (Node ${{ matrix.node-version }})
67+ runs-on : ubuntu-latest
68+ needs : [lint, typecheck, format]
69+ timeout-minutes : 20
70+ strategy :
71+ matrix :
72+ node-version : [18, 20, 22]
73+ steps :
74+ - uses : actions/checkout@v6
75+ with :
76+ fetch-depth : 0
77+ - name : Setup Node.js
78+ uses : actions/setup-node@v6
79+ with :
80+ node-version : ${{ matrix.node-version }}
81+ cache : ' npm'
82+ - name : Install dependencies
83+ run : npm ci
84+ - name : Build packages
85+ run : npm run build
86+ - name : Run tests with coverage
87+ run : npm run test -- -- --coverage --maxWorkers=2
88+ - name : Build docs site
89+ run : npm run docs:build
90+ - name : Upload coverage to Codecov
91+ if : matrix.node-version == 20
92+ uses : codecov/codecov-action@v5
93+ with :
94+ token : ${{ secrets.CODECOV_TOKEN }}
95+ files : ./coverage/coverage-final.json
96+ flags : unittests
97+ fail_ci_if_error : false
98+ - name : Upload docs artifact
99+ if : matrix.node-version == 20
100+ uses : actions/upload-artifact@v6
101+ with :
102+ name : docs-dist
103+ path : docs-dist
104+ retention-days : 7
35105
36- - name : Test
37- run : npx turbo test
106+ ci-success :
107+ name : CI Success
108+ runs-on : ubuntu-latest
109+ needs : [lint, typecheck, format, build-and-test]
110+ if : always()
111+ steps :
112+ - name : Check all jobs
113+ run : |
114+ if [[ "${{ needs.lint.result }}" != "success" ]] || \
115+ [[ "${{ needs.typecheck.result }}" != "success" ]] || \
116+ [[ "${{ needs.format.result }}" != "success" ]] || \
117+ [[ "${{ needs.build-and-test.result }}" != "success" ]]; then
118+ echo "One or more jobs failed"
119+ exit 1
120+ fi
0 commit comments