Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
114 changes: 114 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
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
Loading
Loading