Initial Commit #7
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: | |
| types: [opened, synchronize, reopened] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| actions: read | |
| checks: write | |
| pull-requests: write | |
| env: | |
| CI: 'true' | |
| PNPM_VERSION: '10.10.0' | |
| NODE_VERSION: '22' | |
| jobs: | |
| setup: | |
| name: Setup Dependencies | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: ${{ env.PNPM_VERSION }} | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| cache: 'pnpm' | |
| - name: Get pnpm store directory | |
| id: pnpm-store | |
| run: echo "store=$(pnpm store path)" >> $GITHUB_OUTPUT | |
| - name: Cache pnpm store | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ steps.pnpm-store.outputs.store }} | |
| key: pnpm-store-${{ runner.os }}-${{ hashFiles('pnpm-lock.yaml') }} | |
| restore-keys: | | |
| pnpm-store-${{ runner.os }}- | |
| - name: Install dependencies | |
| run: | | |
| pnpm fetch | |
| pnpm install --offline --frozen-lockfile | |
| - name: Upload node_modules | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: node-modules-${{ github.sha }} | |
| path: | | |
| node_modules | |
| apps/*/node_modules | |
| packages/*/node_modules | |
| retention-days: 1 | |
| quality: | |
| name: Lint / Format / Knip | |
| runs-on: ubuntu-24.04 | |
| needs: setup | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: ${{ env.PNPM_VERSION }} | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - name: Download node_modules | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: node-modules-${{ github.sha }} | |
| - name: Lint & Format check | |
| run: pnpm run format-and-lint | |
| - name: Check unused dependencies | |
| run: pnpm run check-deps | |
| typecheck: | |
| name: Type Check | |
| runs-on: ubuntu-24.04 | |
| needs: setup | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: ${{ env.PNPM_VERSION }} | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - name: Download node_modules | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: node-modules-${{ github.sha }} | |
| - name: Type check | |
| run: pnpm run typecheck | |
| test: | |
| name: Test | |
| runs-on: ubuntu-24.04 | |
| needs: setup | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: ${{ env.PNPM_VERSION }} | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - name: Download node_modules | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: node-modules-${{ github.sha }} | |
| - name: Prepare test environment | |
| run: pnpm run reset | |
| - name: Run tests with coverage | |
| run: pnpm test --coverage | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: ./coverage/lcov.info | |
| flags: unittests | |
| fail_ci_if_error: false | |
| build: | |
| name: Build | |
| runs-on: ubuntu-24.04 | |
| needs: [quality, typecheck] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: ${{ env.PNPM_VERSION }} | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ env.NODE_VERSION }} | |
| - name: Download node_modules | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: node-modules-${{ github.sha }} | |
| - name: Restore turbo cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: .turbo | |
| key: turbo-${{ runner.os }}-${{ github.sha }} | |
| restore-keys: | | |
| turbo-${{ runner.os }}- | |
| - name: Build all packages | |
| run: pnpm run build | |
| env: | |
| NODE_ENV: production | |
| - name: Save turbo cache | |
| uses: actions/cache/save@v4 | |
| if: always() | |
| with: | |
| path: .turbo | |
| key: turbo-${{ runner.os }}-${{ github.sha }} | |
| ci-success: | |
| name: CI Success | |
| runs-on: ubuntu-24.04 | |
| needs: [quality, typecheck, test, build] | |
| if: always() | |
| steps: | |
| - name: Check all job statuses | |
| run: | | |
| if [[ "${{ contains(needs.*.result, 'failure') }}" == "true" ]]; then | |
| echo "::error::One or more CI jobs failed" | |
| exit 1 | |
| fi | |
| echo "✅ All CI checks passed!" |