|
4 | 4 | pull_request: |
5 | 5 | branches: [main] |
6 | 6 | types: [opened, synchronize, reopened] |
7 | | - # Also run on pushes to main for consistency |
8 | | - push: |
9 | | - branches: [main] |
10 | 7 |
|
11 | 8 | # Cancel in-progress runs for the same PR |
12 | 9 | concurrency: |
13 | 10 | group: ${{ github.workflow }}-${{ github.ref }} |
14 | 11 | cancel-in-progress: true |
15 | 12 |
|
| 13 | +env: |
| 14 | + NODE_VERSION: ${{ vars.NODE_VERSION }} |
| 15 | + PNPM_VERSION: ${{ vars.PNPM_VERSION }} |
| 16 | + |
16 | 17 | jobs: |
17 | | - test: |
18 | | - name: Test Suite |
| 18 | + # Code quality checks (fast, no build required) |
| 19 | + quality: |
| 20 | + name: Code Quality |
19 | 21 | runs-on: ubuntu-latest |
20 | | - timeout-minutes: 15 |
21 | | - |
| 22 | + timeout-minutes: 10 |
22 | 23 | steps: |
23 | 24 | - name: Checkout code |
24 | 25 | uses: actions/checkout@v4 |
25 | 26 | with: |
26 | | - # Fetch full history for Nx affected commands (optional optimization) |
27 | 27 | fetch-depth: 0 |
28 | 28 |
|
29 | 29 | - name: Setup Node.js |
30 | 30 | uses: actions/setup-node@v4 |
31 | 31 | with: |
32 | | - node-version: ${{ vars.NODE_VERSION }} |
33 | | - registry-url: "https://registry.npmjs.org" |
| 32 | + node-version: ${{ env.NODE_VERSION }} |
34 | 33 |
|
35 | 34 | - name: Setup pnpm |
36 | 35 | uses: pnpm/action-setup@v4 |
37 | 36 | with: |
38 | | - version: "10.6.3" |
| 37 | + version: ${{ env.PNPM_VERSION }} |
39 | 38 | run_install: false |
40 | 39 |
|
41 | 40 | - name: Get pnpm store directory |
|
63 | 62 | - name: Check formatting |
64 | 63 | run: pnpm format:check |
65 | 64 |
|
| 65 | + # Build and test (slower, runs in parallel with quality) |
| 66 | + test: |
| 67 | + name: Build & Test |
| 68 | + runs-on: ubuntu-latest |
| 69 | + timeout-minutes: 15 |
| 70 | + steps: |
| 71 | + - name: Checkout code |
| 72 | + uses: actions/checkout@v4 |
| 73 | + with: |
| 74 | + fetch-depth: 0 |
| 75 | + |
| 76 | + - name: Setup Node.js |
| 77 | + uses: actions/setup-node@v4 |
| 78 | + with: |
| 79 | + node-version: ${{ env.NODE_VERSION }} |
| 80 | + |
| 81 | + - name: Setup pnpm |
| 82 | + uses: pnpm/action-setup@v4 |
| 83 | + with: |
| 84 | + version: ${{ env.PNPM_VERSION }} |
| 85 | + run_install: false |
| 86 | + |
| 87 | + - name: Get pnpm store directory |
| 88 | + shell: bash |
| 89 | + run: | |
| 90 | + echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV |
| 91 | +
|
| 92 | + - name: Setup pnpm cache |
| 93 | + uses: actions/cache@v4 |
| 94 | + with: |
| 95 | + path: ${{ env.STORE_PATH }} |
| 96 | + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} |
| 97 | + restore-keys: | |
| 98 | + ${{ runner.os }}-pnpm-store- |
| 99 | +
|
| 100 | + - name: Install dependencies |
| 101 | + run: pnpm install --frozen-lockfile |
| 102 | + |
66 | 103 | - name: Build packages |
67 | 104 | run: pnpm build |
68 | 105 |
|
|
0 commit comments