feat: add CI workflow with quality gates #6
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| pull_request: | |
| branches: [main] | |
| push: | |
| branches: [main] | |
| jobs: | |
| check: | |
| name: Check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: pnpm | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Check formatting (Prettier) | |
| run: pnpm format:check | |
| - name: Lint (ESLint) | |
| run: pnpm lint | |
| - name: Type check (TypeScript) | |
| run: pnpm typecheck | |
| - name: Run tests with coverage | |
| run: pnpm vitest run --coverage --coverage.reporter=text --coverage.reporter=json-summary | |
| - name: Check coverage threshold | |
| run: | | |
| COVERAGE=$(cat coverage/coverage-summary.json | jq '.total.lines.pct') | |
| echo "Line coverage: $COVERAGE%" | |
| if (( $(echo "$COVERAGE < 80" | bc -l) )); then | |
| echo "Coverage $COVERAGE% is below 80% threshold" | |
| exit 1 | |
| fi | |
| echo "Coverage check passed" | |
| - name: Check for changeset | |
| if: github.event_name == 'pull_request' | |
| run: pnpm changeset status --since=origin/main |