Skip to content

Commit 2ba1c67

Browse files
authored
chore: fix build and add ci build/test (#67)
* chore: fix build and add ci build * chore: fix build and add ci build * remove test from build * move tsc
1 parent 3de37c6 commit 2ba1c67

File tree

4 files changed

+115
-31
lines changed

4 files changed

+115
-31
lines changed

.github/workflows/ci.yml

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
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

.github/workflows/test.yml

Lines changed: 0 additions & 30 deletions
This file was deleted.

packages/batch-poster-monitor/__test__/batch-poster.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ describe('Ignore System', () => {
127127

128128
// Mock decodeFunctionData for non-ignored transaction
129129
vi.mocked(await import('viem')).decodeFunctionData.mockReturnValue({
130+
functionName: 'addSequencerL2BatchFromOrigin',
130131
args: [
131132
0n,
132133
'0x00' + '0'.repeat(100), // data starting with 0x00 (should trigger alert)

packages/batch-poster-monitor/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
"outDir": "./dist"
55
},
66
"include": ["./**/*.ts", "./**/*.d.ts", "packages/*.ts"],
7-
"exclude": ["node_modules", "dist/"]
7+
"exclude": ["node_modules", "dist/", "__test__/**/*"]
88
}

0 commit comments

Comments
 (0)