-
Notifications
You must be signed in to change notification settings - Fork 69
134 lines (114 loc) · 3.71 KB
/
Copy pathtests.yaml
File metadata and controls
134 lines (114 loc) · 3.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
name: Tests
on:
push:
branches: [main]
pull_request:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
quality:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
# Make pnpm available before setup-node uses cache: 'pnpm'
- name: Enable Corepack (pnpm)
run: |
corepack enable
corepack prepare pnpm@9.12.2 --activate
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
cache: "pnpm"
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Run format check
run: pnpm format
test:
runs-on: ubuntu-latest
timeout-minutes: 30
needs: quality
strategy:
matrix:
node-version: [20, 22]
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 1
# Make pnpm available before setup-node uses cache: 'pnpm'
- name: Enable Corepack (pnpm)
run: |
corepack enable
corepack prepare pnpm@9.12.2 --activate
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "pnpm"
# Fast Java (no apt-get)
- name: Setup Java (JDK 17)
uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "17"
# Cache Firebase emulators (JARs) once
- name: Cache Firebase emulators
if: matrix.node-version == '20'
uses: actions/cache@v4
with:
path: |
~/.cache/firebase/emulators
~/.cache/firebase/runtime
key: ${{ runner.os }}-firebase-emulators-${{ hashFiles('firebase.json', '.firebaserc', 'package.json', 'pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-firebase-emulators-
# Ensure pnpm has a global bin dir on Linux runners (fixes ERR_PNPM_NO_GLOBAL_BIN_DIR)
- name: Configure PNPM global bin
if: matrix.node-version == '20'
run: |
echo "PNPM_HOME=$HOME/.local/share/pnpm" >> $GITHUB_ENV
mkdir -p "$HOME/.local/share/pnpm"
echo "$HOME/.local/share/pnpm" >> $GITHUB_PATH
# Install Firebase CLI globally so pnpm test:emulator works
- name: Install Firebase CLI (global, fast)
if: matrix.node-version == '20'
run: pnpm add -g firebase-tools@14
# Optional turbo cache
- name: Cache turbo build metadata
uses: actions/cache@v4
with:
path: .turbo
key: ${{ runner.os }}-turbo-${{ github.sha }}
restore-keys: |
${{ runner.os }}-turbo-
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Build packages
run: pnpm turbo build
- name: Verify build outputs
run: |
MISSING_BUILDS=""
for PKG_DIR in packages/*; do
if [ -d "$PKG_DIR" ] && [ -f "$PKG_DIR/package.json" ]; then
PKG_NAME=$(basename "$PKG_DIR")
if [ ! -d "$PKG_DIR/dist" ]; then
MISSING_BUILDS="$MISSING_BUILDS $PKG_NAME"
fi
fi
done
if [ -n "$MISSING_BUILDS" ]; then
echo "❌ Build outputs not found for: $MISSING_BUILDS"
exit 1
fi
echo "✅ All build outputs verified"
# Run emulator tests only once (Node 20)
- name: Run tests with emulator
if: matrix.node-version == '20'
run: pnpm test:emulator