Skip to content

Commit c3c4687

Browse files
committed
chore: single pipeline
1 parent efe88f2 commit c3c4687

File tree

2 files changed

+37
-180
lines changed

2 files changed

+37
-180
lines changed

.github/workflows/build-deploy-test.yml

Lines changed: 24 additions & 175 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,9 @@ env:
6767
}}
6868
6969
jobs:
70-
setup-and-upgrade:
71-
name: Setup and Upgrade Plugins
70+
build-deploy-test:
71+
name: Build, Deploy, and Test All Examples
7272
runs-on: ubuntu-latest
73-
outputs:
74-
cache-key: ${{ steps.cache-key.outputs.key }}
7573
steps:
7674
- name: Checkout
7775
uses: actions/checkout@v4
@@ -119,208 +117,59 @@ jobs:
119117
pnpm upgrade-plugins
120118
fi
121119
122-
- name: Generate cache key
123-
id: cache-key
120+
- name: Install vanilla dependencies
124121
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
183123
pnpm install --prefer-offline
184124
185-
- name: Install example dependencies for nx and turborepo
186-
if: matrix.workspace == 'nx' || matrix.workspace == 'turborepo'
125+
- name: Install nx example dependencies
187126
run: |
188-
cd ${{ matrix.workspace }}/examples
127+
cd nx/examples
189128
for example in */; do
190129
if [ -f "${example}package.json" ]; then
191-
echo "Installing dependencies for ${example}"
130+
echo "Installing dependencies for nx/${example}"
192131
cd "$example"
193132
pnpm install --prefer-offline
194133
cd ..
195134
fi
196135
done
197136
198-
- name: Install scripts dependencies
137+
- name: Install turborepo example dependencies
199138
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
210148
211-
- name: Build ${{ matrix.workspace }} examples
149+
- name: Build all examples
212150
run: |
213151
cd scripts
214152
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
217155
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
220158
fi
221159
env:
222160
NODE_ENV: production
223161
ZE_SECRET_TOKEN: ${{ env.ZE_SECRET_TOKEN }}
224162
ZE_API_GATE: ${{ env.ZE_API_GATE }}
225163
ZE_API: ${{ env.ZE_API }}
226164

227-
- name: Upload ${{ matrix.workspace }} build logs
165+
- name: Upload build logs
228166
uses: actions/upload-artifact@v4
229167
if: always()
230168
with:
231-
name: build-logs-${{ matrix.workspace }}
169+
name: build-logs
232170
path: scripts/tmp/build/
233171
retention-days: 3
234172

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-
324173
- name: Wait for deployments to be ready
325174
run: |
326175
echo "Waiting 60 seconds for all deployments to propagate..."

scripts/src/build-packages.ts

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -229,11 +229,19 @@ const buildPackages = async (): Promise<void> => {
229229
);
230230

231231
if (buildType === "all examples") {
232-
const deployed = await getDeployed();
233-
console.log(`\n${green("-- Applications deployed:")}`);
234-
deployed.forEach(({ app, url }) => {
235-
console.log(`[${blue(app)}]: ${url}`);
236-
});
232+
try {
233+
const deployed = await getDeployed();
234+
if (deployed.length > 0) {
235+
console.log(`\n${green("-- Applications deployed:")}`);
236+
deployed.forEach(({ app, url }) => {
237+
console.log(`[${blue(app)}]: ${url}`);
238+
});
239+
} else {
240+
console.log(`\n${orange("-- No deployment results found")}`);
241+
}
242+
} catch (error: any) {
243+
console.log(`\n${orange("-- Could not fetch deployment results:")} ${error.message}`);
244+
}
237245
}
238246
}
239247

0 commit comments

Comments
 (0)