|
67 | 67 | }} |
68 | 68 |
|
69 | 69 | jobs: |
70 | | - setup-and-upgrade: |
71 | | - name: Setup and Upgrade Plugins |
| 70 | + build-deploy-test: |
| 71 | + name: Build, Deploy, and Test All Examples |
72 | 72 | runs-on: ubuntu-latest |
73 | | - outputs: |
74 | | - cache-key: ${{ steps.cache-key.outputs.key }} |
75 | 73 | steps: |
76 | 74 | - name: Checkout |
77 | 75 | uses: actions/checkout@v4 |
@@ -119,208 +117,59 @@ jobs: |
119 | 117 | pnpm upgrade-plugins |
120 | 118 | fi |
121 | 119 |
|
122 | | - - name: Generate cache key |
123 | | - id: cache-key |
| 120 | + - name: Install vanilla dependencies |
124 | 121 | run: | |
125 | | - echo "key=pnpm-store-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}" >> $GITHUB_OUTPUT |
126 | | -
|
127 | | - - name: Upload workspace files |
128 | | - uses: actions/upload-artifact@v4 |
129 | | - with: |
130 | | - name: workspace-files |
131 | | - path: | |
132 | | - nx/ |
133 | | - vanilla/ |
134 | | - turborepo/ |
135 | | - scripts/ |
136 | | - .github/ |
137 | | - retention-days: 1 |
138 | | - |
139 | | - build-workspace: |
140 | | - name: Build ${{ matrix.workspace }} |
141 | | - needs: setup-and-upgrade |
142 | | - runs-on: ubuntu-latest |
143 | | - strategy: |
144 | | - fail-fast: false |
145 | | - matrix: |
146 | | - workspace: [nx, vanilla, turborepo] |
147 | | - steps: |
148 | | - - name: Checkout |
149 | | - uses: actions/checkout@v4 |
150 | | - |
151 | | - - name: Download workspace files |
152 | | - uses: actions/download-artifact@v4 |
153 | | - with: |
154 | | - name: workspace-files |
155 | | - |
156 | | - - uses: pnpm/action-setup@v4 |
157 | | - with: |
158 | | - version: 10.6.3 |
159 | | - run_install: false |
160 | | - |
161 | | - - uses: actions/setup-node@v4 |
162 | | - with: |
163 | | - node-version: ${{ env.NODE_VERSION }} |
164 | | - registry-url: "https://registry.npmjs.org" |
165 | | - |
166 | | - - name: Get pnpm store directory |
167 | | - shell: bash |
168 | | - run: | |
169 | | - echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV |
170 | | -
|
171 | | - - name: Setup pnpm cache |
172 | | - uses: actions/cache@v4 |
173 | | - with: |
174 | | - path: ${{ env.STORE_PATH }} |
175 | | - key: ${{ needs.setup-and-upgrade.outputs.cache-key }} |
176 | | - restore-keys: | |
177 | | - pnpm-store-${{ runner.os }}- |
178 | | -
|
179 | | - - name: Install ${{ matrix.workspace }} dependencies |
180 | | - if: matrix.workspace == 'vanilla' |
181 | | - run: | |
182 | | - cd ${{ matrix.workspace }} |
| 122 | + cd vanilla |
183 | 123 | pnpm install --prefer-offline |
184 | 124 |
|
185 | | - - name: Install example dependencies for nx and turborepo |
186 | | - if: matrix.workspace == 'nx' || matrix.workspace == 'turborepo' |
| 125 | + - name: Install nx example dependencies |
187 | 126 | run: | |
188 | | - cd ${{ matrix.workspace }}/examples |
| 127 | + cd nx/examples |
189 | 128 | for example in */; do |
190 | 129 | if [ -f "${example}package.json" ]; then |
191 | | - echo "Installing dependencies for ${example}" |
| 130 | + echo "Installing dependencies for nx/${example}" |
192 | 131 | cd "$example" |
193 | 132 | pnpm install --prefer-offline |
194 | 133 | cd .. |
195 | 134 | fi |
196 | 135 | done |
197 | 136 |
|
198 | | - - name: Install scripts dependencies |
| 137 | + - name: Install turborepo example dependencies |
199 | 138 | run: | |
200 | | - cd scripts |
201 | | - pnpm install --prefer-offline |
202 | | -
|
203 | | - - name: Get workspace examples |
204 | | - id: get-examples |
205 | | - run: | |
206 | | - cd ${{ matrix.workspace }}/examples |
207 | | - examples=$(ls -d */ 2>/dev/null | sed 's/\///g' | tr '\n' ',' | sed 's/,$//') |
208 | | - echo "examples=$examples" >> $GITHUB_OUTPUT |
209 | | - echo "Found examples: $examples" |
| 139 | + cd turborepo/examples |
| 140 | + for example in */; do |
| 141 | + if [ -f "${example}package.json" ]; then |
| 142 | + echo "Installing dependencies for turborepo/${example}" |
| 143 | + cd "$example" |
| 144 | + pnpm install --prefer-offline |
| 145 | + cd .. |
| 146 | + fi |
| 147 | + done |
210 | 148 |
|
211 | | - - name: Build ${{ matrix.workspace }} examples |
| 149 | + - name: Build all examples |
212 | 150 | run: | |
213 | 151 | cd scripts |
214 | 152 | if [ "${{ github.event.inputs.skip_cache }}" == "true" ] || [ "${{ github.event.client_payload.skip_cache }}" == "true" ]; then |
215 | | - echo "Building ${{ matrix.workspace }} with --skip-cache flag" |
216 | | - pnpm build-packages --skip-cache --packages=${{ steps.get-examples.outputs.examples }} |
| 153 | + echo "Building all examples with --skip-cache flag" |
| 154 | + pnpm build-packages --skip-cache |
217 | 155 | else |
218 | | - echo "Building ${{ matrix.workspace }} with cache enabled" |
219 | | - pnpm build-packages --packages=${{ steps.get-examples.outputs.examples }} |
| 156 | + echo "Building all examples with cache enabled" |
| 157 | + pnpm build-packages |
220 | 158 | fi |
221 | 159 | env: |
222 | 160 | NODE_ENV: production |
223 | 161 | ZE_SECRET_TOKEN: ${{ env.ZE_SECRET_TOKEN }} |
224 | 162 | ZE_API_GATE: ${{ env.ZE_API_GATE }} |
225 | 163 | ZE_API: ${{ env.ZE_API }} |
226 | 164 |
|
227 | | - - name: Upload ${{ matrix.workspace }} build logs |
| 165 | + - name: Upload build logs |
228 | 166 | uses: actions/upload-artifact@v4 |
229 | 167 | if: always() |
230 | 168 | with: |
231 | | - name: build-logs-${{ matrix.workspace }} |
| 169 | + name: build-logs |
232 | 170 | path: scripts/tmp/build/ |
233 | 171 | retention-days: 3 |
234 | 172 |
|
235 | | - - name: Check zephyr deployment cache |
236 | | - if: always() |
237 | | - run: | |
238 | | - echo "Checking zephyr cache directory..." |
239 | | - echo "HOME is: $HOME" |
240 | | - if [ -d $HOME/.zephyr ]; then |
241 | | - echo "$HOME/.zephyr exists" |
242 | | - echo "Files in cache: $(ls -1 $HOME/.zephyr | wc -l)" |
243 | | - ls -lah $HOME/.zephyr | head -20 |
244 | | - else |
245 | | - echo "$HOME/.zephyr does not exist!" |
246 | | - fi |
247 | | -
|
248 | | - - name: Upload zephyr deployment cache |
249 | | - uses: actions/upload-artifact@v4 |
250 | | - if: always() |
251 | | - with: |
252 | | - name: zephyr-cache-${{ matrix.workspace }} |
253 | | - path: /home/runner/.zephyr/ |
254 | | - retention-days: 1 |
255 | | - |
256 | | - test-deployments: |
257 | | - name: Test All Deployments |
258 | | - needs: [build-workspace] |
259 | | - runs-on: ubuntu-latest |
260 | | - steps: |
261 | | - - name: Download workspace files |
262 | | - uses: actions/download-artifact@v4 |
263 | | - with: |
264 | | - name: workspace-files |
265 | | - |
266 | | - - name: Download zephyr deployment caches |
267 | | - uses: actions/download-artifact@v4 |
268 | | - with: |
269 | | - pattern: zephyr-cache-* |
270 | | - path: zephyr-caches |
271 | | - merge-multiple: false |
272 | | - |
273 | | - - name: Restore zephyr cache |
274 | | - run: | |
275 | | - mkdir -p $HOME/.zephyr |
276 | | - echo "Downloaded cache directories:" |
277 | | - ls -lah zephyr-caches/ || echo "No zephyr-caches directory" |
278 | | -
|
279 | | - if [ -d "zephyr-caches" ]; then |
280 | | - for cache_dir in zephyr-caches/zephyr-cache-*/; do |
281 | | - if [ -d "$cache_dir" ]; then |
282 | | - echo "Merging cache from $cache_dir" |
283 | | - echo "Files in $cache_dir: $(ls -1 "$cache_dir" 2>/dev/null | wc -l)" |
284 | | - cp -r "$cache_dir"* $HOME/.zephyr/ 2>/dev/null || true |
285 | | - fi |
286 | | - done |
287 | | - fi |
288 | | -
|
289 | | - echo "Final $HOME/.zephyr contents:" |
290 | | - ls -lah $HOME/.zephyr/ || echo "$HOME/.zephyr is empty or doesn't exist" |
291 | | - echo "Total files in zephyr cache: $(ls -1 $HOME/.zephyr/ 2>/dev/null | wc -l)" |
292 | | -
|
293 | | - - uses: pnpm/action-setup@v4 |
294 | | - with: |
295 | | - version: 10.6.3 |
296 | | - run_install: false |
297 | | - |
298 | | - - uses: actions/setup-node@v4 |
299 | | - with: |
300 | | - node-version: ${{ env.NODE_VERSION }} |
301 | | - |
302 | | - - name: Install scripts dependencies |
303 | | - run: | |
304 | | - cd scripts |
305 | | - pnpm install --prefer-offline |
306 | | -
|
307 | | - - name: Debug deployment results |
308 | | - run: | |
309 | | - cd scripts |
310 | | - node -e " |
311 | | - const { getAllAppDeployResults } = require('zephyr-agent'); |
312 | | - getAllAppDeployResults().then(results => { |
313 | | - console.log('Deployment results:', JSON.stringify(results, null, 2)); |
314 | | - console.log('Number of apps:', Object.keys(results).length); |
315 | | - }).catch(err => { |
316 | | - console.error('Error getting deployment results:', err.message); |
317 | | - }); |
318 | | - " |
319 | | - env: |
320 | | - ZE_SECRET_TOKEN: ${{ env.ZE_SECRET_TOKEN }} |
321 | | - ZE_API_GATE: ${{ env.ZE_API_GATE }} |
322 | | - ZE_API: ${{ env.ZE_API }} |
323 | | - |
324 | 173 | - name: Wait for deployments to be ready |
325 | 174 | run: | |
326 | 175 | echo "Waiting 60 seconds for all deployments to propagate..." |
|
0 commit comments