chore(repo): add ownership and coverage hygiene #40
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: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| ci: | |
| name: Lint, Type-Check, Test & Build | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| node-version: [20.x] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| - name: Cache node_modules | |
| uses: actions/cache@v4 | |
| id: cache-deps | |
| with: | |
| path: node_modules | |
| key: ${{ runner.os }}-node-${{ matrix.node-version }}-${{ hashFiles('package-lock.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-node-${{ matrix.node-version }}- | |
| - name: Install dependencies | |
| if: steps.cache-deps.outputs.cache-hit != 'true' | |
| run: npm ci | |
| - name: Lint | |
| run: npm run lint | |
| - name: Type-check | |
| run: npm run type-check | |
| - name: Run tests with coverage | |
| run: npm run test:coverage -- --ci --reporters=default | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| files: coverage/lcov.info | |
| flags: frontend | |
| name: frontend-coverage | |
| fail_ci_if_error: false | |
| disable_search: true | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| - name: Build | |
| run: npm run build | |
| - name: Upload coverage report | |
| if: matrix.node-version == '20.x' | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: coverage-report | |
| path: coverage/ | |
| retention-days: 14 | |
| - name: Coverage summary | |
| if: matrix.node-version == '20.x' | |
| run: | | |
| if [ -f coverage/coverage-summary.json ]; then | |
| echo "## Coverage Summary" >> $GITHUB_STEP_SUMMARY | |
| echo '```json' >> $GITHUB_STEP_SUMMARY | |
| cat coverage/coverage-summary.json | head -20 >> $GITHUB_STEP_SUMMARY | |
| echo '```' >> $GITHUB_STEP_SUMMARY | |
| fi |