1+ name : CI
2+
3+ on :
4+ push :
5+ branches : [ main ]
6+ pull_request :
7+ branches : [ main ]
8+
9+ jobs :
10+ build-and-test :
11+ runs-on : ubuntu-latest
12+
13+ strategy :
14+ matrix :
15+ node-version : [18.x]
16+ package :
17+ - assertion-monitor
18+ - batch-poster-monitor
19+ - retryable-monitor
20+ - utils
21+
22+ steps :
23+ - uses : actions/checkout@v4
24+
25+ - name : Use Node.js ${{ matrix.node-version }}
26+ uses : actions/setup-node@v4
27+ with :
28+ node-version : ${{ matrix.node-version }}
29+ cache : ' yarn'
30+
31+ - name : Install dependencies
32+ run : yarn install --frozen-lockfile
33+
34+ - name : Type check package
35+ run : |
36+ cd packages/${{ matrix.package }}
37+ if [ -f "tsconfig.json" ]; then
38+ echo "Type checking ${{ matrix.package }}..."
39+ npx tsc --noEmit
40+ else
41+ echo "No tsconfig.json found for ${{ matrix.package }}, skipping type check"
42+ fi
43+
44+ - name : Build package
45+ run : |
46+ cd packages/${{ matrix.package }}
47+ if [ -f "package.json" ] && grep -q '"build"' package.json; then
48+ echo "Building ${{ matrix.package }}..."
49+ yarn build
50+ else
51+ echo "No build script found for ${{ matrix.package }}, skipping build step"
52+ fi
53+
54+ - name : Run tests
55+ run : |
56+ cd packages/${{ matrix.package }}
57+ if [ -f "package.json" ] && grep -q '"test"' package.json; then
58+ echo "Testing ${{ matrix.package }}..."
59+ yarn test
60+ else
61+ echo "No test script found for ${{ matrix.package }}, skipping test step"
62+ fi
63+
64+ # Run root level tests as well
65+ root-tests :
66+ runs-on : ubuntu-latest
67+
68+ strategy :
69+ matrix :
70+ node-version : [18.x]
71+
72+ steps :
73+ - uses : actions/checkout@v4
74+
75+ - name : Use Node.js ${{ matrix.node-version }}
76+ uses : actions/setup-node@v4
77+ with :
78+ node-version : ${{ matrix.node-version }}
79+ cache : ' yarn'
80+
81+ - name : Install dependencies
82+ run : yarn install --frozen-lockfile
83+
84+ - name : Run all tests
85+ run : yarn test
86+
87+ # Lint check for code quality
88+ lint :
89+ runs-on : ubuntu-latest
90+
91+ strategy :
92+ matrix :
93+ node-version : [18.x]
94+
95+ steps :
96+ - uses : actions/checkout@v4
97+
98+ - name : Use Node.js ${{ matrix.node-version }}
99+ uses : actions/setup-node@v4
100+ with :
101+ node-version : ${{ matrix.node-version }}
102+ cache : ' yarn'
103+
104+ - name : Install dependencies
105+ run : yarn install --frozen-lockfile
106+
107+ - name : Run lint
108+ run : |
109+ if [ -f "package.json" ] && grep -q '"lint"' package.json; then
110+ yarn lint
111+ else
112+ echo "No lint script found at root level"
113+ fi
0 commit comments