@@ -34,10 +34,66 @@ jobs:
3434 - name : Type check
3535 run : pnpm run type-check
3636
37+ test :
38+ name : Test Suite
39+ runs-on : ubuntu-latest
40+ steps :
41+ - name : Checkout
42+ uses : actions/checkout@v4
43+
44+ - name : Setup pnpm
45+ uses : pnpm/action-setup@v4
46+ with :
47+ version : 10
48+
49+ - name : Setup Node.js
50+ uses : actions/setup-node@v4
51+ with :
52+ node-version : 22
53+ cache : pnpm
54+
55+ - name : Install dependencies
56+ run : pnpm install
57+
58+ - name : Run tests
59+ run : pnpm run test:run
60+
61+ - name : Run tests with coverage
62+ run : pnpm run test:coverage
63+
64+ - name : Coverage Summary
65+ run : |
66+ # Run tests with coverage and capture output
67+ TEST_OUTPUT=$(pnpm run test:coverage 2>&1)
68+
69+ echo "## 📊 Test Coverage Report" >> $GITHUB_STEP_SUMMARY
70+ echo "" >> $GITHUB_STEP_SUMMARY
71+
72+ # Extract test results
73+ TEST_COUNT=$(echo "$TEST_OUTPUT" | grep -o '[0-9]\+ passed' | head -1 | grep -o '[0-9]\+')
74+ OVERALL_COVERAGE=$(echo "$TEST_OUTPUT" | grep "All files" | awk '{print $3}')
75+
76+ # Add coverage table
77+ echo "| File | Statements | Branches | Functions | Lines |" >> $GITHUB_STEP_SUMMARY
78+ echo "|------|------------|----------|-----------|-------|" >> $GITHUB_STEP_SUMMARY
79+
80+ # Parse coverage and add to summary
81+ echo "$TEST_OUTPUT" | grep -E "^\s*(All files|[a-z-]+\.ts)" | while read line; do
82+ if [[ $line == *"All files"* ]]; then
83+ echo "| **Overall** | $(echo $line | awk '{print $3}') | $(echo $line | awk '{print $4}') | $(echo $line | awk '{print $5}') | $(echo $line | awk '{print $6}') |" >> $GITHUB_STEP_SUMMARY
84+ elif [[ $line == *.ts* ]]; then
85+ filename=$(echo $line | awk '{print $1}')
86+ echo "| $filename | $(echo $line | awk '{print $3}') | $(echo $line | awk '{print $4}') | $(echo $line | awk '{print $5}') | $(echo $line | awk '{print $6}') |" >> $GITHUB_STEP_SUMMARY
87+ fi
88+ done
89+
90+ echo "" >> $GITHUB_STEP_SUMMARY
91+ echo "✅ **${TEST_COUNT} tests passed** with **${OVERALL_COVERAGE} overall coverage**" >> $GITHUB_STEP_SUMMARY
92+
3793 build :
3894 name : Build
3995 runs-on : ubuntu-latest
40- needs : lint
96+ needs : [ lint, test]
4197 steps :
4298 - name : Checkout
4399 uses : actions/checkout@v4
0 commit comments