name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build-and-test:
name: Build and Test
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [22.x]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
- name: Pre-fetch node-gyp headers (avoid ETIMEDOUT during npm ci)
run: |
for i in 1 2 3; do
npx node-gyp install && break
echo "Retry $i: node-gyp install failed, retrying..."
sleep 5
done
- name: Install dependencies
run: npm ci
- name: Type check
run: npm run type-check
- name: Build project
run: npm run build
- name: Run tests with coverage (quality gate)
run: npm run test:coverage
# Note: This step enforces 90% coverage thresholds via vitest.config.ts
# If thresholds are not met, this step will fail with exit code 1
- name: Run provider verification tests
run: npm run test:providers
- name: Quality Gate - Verify coverage reports
run: |
if [ ! -f coverage/coverage-final.json ]; then
echo "❌ ERROR: Coverage report not generated"
exit 1
fi
echo "✅ Coverage report generated successfully"
echo ""
echo "📊 Quality Gate Status:"
echo " Required: statements ≥ 90%, lines ≥ 90%, functions ≥ 90%, branches ≥ 80%"
echo " Note: Vitest enforces thresholds automatically"
echo " If you see this message, coverage thresholds were met ✅"
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
directory: ./coverage
flags: unittests
fail_ci_if_error: false