|
1 | | -name: Frontend Unit Tests |
| 1 | +name: Frontend CI |
| 2 | + |
2 | 3 | on: |
3 | 4 | push: |
4 | 5 | pull_request: |
| 6 | + |
| 7 | +concurrency: |
| 8 | + group: frontend-ci-${{ github.ref }} |
| 9 | + cancel-in-progress: true |
| 10 | + |
| 11 | +permissions: |
| 12 | + contents: read |
| 13 | + |
5 | 14 | jobs: |
6 | 15 | test: |
7 | | - name: Run Jest (React Native / Expo) |
| 16 | + name: Jest on Node ${{ matrix.node }} |
8 | 17 | runs-on: ubuntu-latest |
| 18 | + strategy: |
| 19 | + fail-fast: false |
| 20 | + matrix: |
| 21 | + node: [18, 20] # LTS + current used in repo |
| 22 | + |
9 | 23 | env: |
10 | 24 | CI: "1" |
11 | | - EXPO_PUBLIC_API_BASE: http://localhost:8000 |
12 | 25 | EXPO_TUNNEL: "false" |
13 | 26 | EXPO_DEVTOOLS_LISTEN_ADDRESS: 0.0.0.0 |
| 27 | + EXPO_PUBLIC_API_BASE: http://localhost:8000 |
| 28 | + |
14 | 29 | steps: |
15 | 30 | - name: Checkout |
16 | 31 | uses: actions/checkout@v4 |
17 | | - - name: Use Node.js 20 |
| 32 | + |
| 33 | + - name: Use Node ${{ matrix.node }} |
| 34 | + uses: actions/setup-node@v4 |
| 35 | + with: |
| 36 | + node-version: ${{ matrix.node }} |
| 37 | + cache: npm |
| 38 | + cache-dependency-path: frontend/app/package-lock.json |
| 39 | + |
| 40 | + - name: Install deps |
| 41 | + working-directory: frontend/app |
| 42 | + run: npm ci |
| 43 | + |
| 44 | + - name: Type check (skip if no TS) |
| 45 | + if: hashFiles('frontend/app/tsconfig.json') != '' |
| 46 | + working-directory: frontend/app |
| 47 | + run: | |
| 48 | + npx --yes typescript@latest -v >/dev/null 2>&1 || true |
| 49 | + npx tsc --noEmit || (echo "::warning::Type check failed"; exit 1) |
| 50 | +
|
| 51 | + - name: Run Jest with coverage (CI mode) |
| 52 | + working-directory: frontend/app |
| 53 | + run: npm test -- --ci --runInBand --coverage --verbose |
| 54 | + |
| 55 | + - name: Upload coverage |
| 56 | + if: always() |
| 57 | + uses: actions/upload-artifact@v4 |
| 58 | + with: |
| 59 | + name: coverage-node${{ matrix.node }} |
| 60 | + path: frontend/app/coverage |
| 61 | + if-no-files-found: warn |
| 62 | + |
| 63 | + web-export-smoke: |
| 64 | + name: Expo web export (smoke) |
| 65 | + needs: test |
| 66 | + runs-on: ubuntu-latest |
| 67 | + env: |
| 68 | + CI: "1" |
| 69 | + steps: |
| 70 | + - name: Checkout |
| 71 | + uses: actions/checkout@v4 |
| 72 | + |
| 73 | + - name: Use Node 20 |
18 | 74 | uses: actions/setup-node@v4 |
19 | 75 | with: |
20 | 76 | node-version: 20 |
21 | 77 | cache: npm |
22 | | - cache-dependency-path: | |
23 | | - frontend/app/package-lock.json |
24 | | - - name: Install dependencies |
| 78 | + cache-dependency-path: frontend/app/package-lock.json |
| 79 | + |
| 80 | + - name: Install deps |
25 | 81 | working-directory: frontend/app |
26 | 82 | run: npm ci |
27 | 83 |
|
| 84 | + - name: Build (expo export -p web) |
| 85 | + working-directory: frontend/app |
| 86 | + run: npx expo export -p web |
| 87 | + |
| 88 | + - name: Upload dist (preview artifact) |
| 89 | + if: always() |
| 90 | + uses: actions/upload-artifact@v4 |
| 91 | + with: |
| 92 | + name: expo-web-dist |
| 93 | + path: frontend/app/dist |
| 94 | + if-no-files-found: error |
0 commit comments