|
| 1 | +# Z-Image - CI Pipeline |
| 2 | +# |
| 3 | +# Runs on every push and pull request |
| 4 | +# - Lint and format check |
| 5 | +# - Type check |
| 6 | +# - Build all packages |
| 7 | +# - Run tests with coverage |
| 8 | + |
| 9 | +name: CI |
| 10 | + |
| 11 | +on: |
| 12 | + push: |
| 13 | + branches: [main, dev] |
| 14 | + pull_request: |
| 15 | + branches: [main, dev] |
| 16 | + |
| 17 | +concurrency: |
| 18 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 19 | + cancel-in-progress: true |
| 20 | + |
| 21 | +jobs: |
| 22 | + ci: |
| 23 | + name: Lint, Build & Test |
| 24 | + runs-on: ubuntu-latest |
| 25 | + |
| 26 | + steps: |
| 27 | + - name: Checkout |
| 28 | + uses: actions/checkout@v4 |
| 29 | + |
| 30 | + - name: Setup pnpm |
| 31 | + uses: pnpm/action-setup@v4 |
| 32 | + |
| 33 | + - name: Setup Node.js |
| 34 | + uses: actions/setup-node@v4 |
| 35 | + with: |
| 36 | + node-version: 20 |
| 37 | + cache: 'pnpm' |
| 38 | + |
| 39 | + - name: Install dependencies |
| 40 | + run: pnpm install --frozen-lockfile |
| 41 | + |
| 42 | + - name: Lint & Format check |
| 43 | + run: pnpm check |
| 44 | + |
| 45 | + - name: Build shared package |
| 46 | + run: pnpm build:shared |
| 47 | + |
| 48 | + - name: Build API |
| 49 | + run: pnpm build:api |
| 50 | + |
| 51 | + - name: Build Web |
| 52 | + run: pnpm build:web |
| 53 | + |
| 54 | + - name: Run tests with coverage |
| 55 | + run: pnpm test:coverage |
| 56 | + |
| 57 | + - name: Upload coverage to Codecov |
| 58 | + uses: codecov/codecov-action@v4 |
| 59 | + if: github.event_name == 'push' && github.ref == 'refs/heads/main' |
| 60 | + with: |
| 61 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 62 | + files: ./apps/api/coverage/coverage-final.json,./apps/web/coverage/coverage-final.json |
| 63 | + fail_ci_if_error: false |
| 64 | + |
| 65 | + typecheck: |
| 66 | + name: Type Check |
| 67 | + runs-on: ubuntu-latest |
| 68 | + |
| 69 | + steps: |
| 70 | + - name: Checkout |
| 71 | + uses: actions/checkout@v4 |
| 72 | + |
| 73 | + - name: Setup pnpm |
| 74 | + uses: pnpm/action-setup@v4 |
| 75 | + |
| 76 | + - name: Setup Node.js |
| 77 | + uses: actions/setup-node@v4 |
| 78 | + with: |
| 79 | + node-version: 20 |
| 80 | + cache: 'pnpm' |
| 81 | + |
| 82 | + - name: Install dependencies |
| 83 | + run: pnpm install --frozen-lockfile |
| 84 | + |
| 85 | + - name: Build shared (dependency) |
| 86 | + run: pnpm build:shared |
| 87 | + |
| 88 | + - name: Type check |
| 89 | + run: pnpm -r exec tsc --noEmit |
0 commit comments