Skip to content

Merge pull request #2 from goobits/claude/audit-test-coverage-011CV1T… #2

Merge pull request #2 from goobits/claude/audit-test-coverage-011CV1T…

Merge pull request #2 from goobits/claude/audit-test-coverage-011CV1T… #2

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
test:
name: Test & Coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
with:
version: 10
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run tests with coverage
run: pnpm run test:coverage
- name: Check coverage threshold
run: |
# Extract coverage percentages from coverage summary
LINES=$(jq '.total.lines.pct' coverage/coverage-summary.json | cut -d. -f1)
FUNCTIONS=$(jq '.total.functions.pct' coverage/coverage-summary.json | cut -d. -f1)
BRANCHES=$(jq '.total.branches.pct' coverage/coverage-summary.json | cut -d. -f1)
STATEMENTS=$(jq '.total.statements.pct' coverage/coverage-summary.json | cut -d. -f1)
echo "Coverage: Lines=$LINES% Functions=$FUNCTIONS% Branches=$BRANCHES% Statements=$STATEMENTS%"
if [ "$LINES" -lt 40 ]; then
echo "❌ Lines coverage ($LINES%) is below 40% threshold"
exit 1
fi
if [ "$FUNCTIONS" -lt 40 ]; then
echo "❌ Functions coverage ($FUNCTIONS%) is below 40% threshold"
exit 1
fi
if [ "$BRANCHES" -lt 40 ]; then
echo "❌ Branches coverage ($BRANCHES%) is below 40% threshold"
exit 1
fi
if [ "$STATEMENTS" -lt 40 ]; then
echo "❌ Statements coverage ($STATEMENTS%) is below 40% threshold"
exit 1
fi
echo "✅ All coverage thresholds met!"
- name: Upload coverage reports
uses: codecov/codecov-action@v4
if: always()
with:
file: ./coverage/lcov.info
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
with:
version: 10
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run linter
run: pnpm run lint
typecheck:
name: Type Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v2
with:
version: 10
- uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'pnpm'
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run type check
run: pnpm exec tsc --noEmit