2424 type : string
2525 repository_dispatch :
2626 types : [build-deploy-test]
27+ pull_request :
28+ branches :
29+ - main
30+ paths :
31+ - ' nx/**'
32+ - ' vanilla/**'
33+ - ' turborepo/**'
34+ - ' scripts/**'
35+ - ' .github/workflows/**'
36+ - ' .github/actions/**'
37+ push :
38+ branches :
39+ - main
40+ paths :
41+ - ' nx/**'
42+ - ' vanilla/**'
43+ - ' turborepo/**'
44+ - ' scripts/**'
45+ - ' .github/workflows/**'
46+ - ' .github/actions/**'
2747
2848env :
2949 NODE_VERSION : " 24"
4767 }}
4868
4969jobs :
50- build-deploy-test :
51- name : Build, Deploy, and Test All Examples
70+ setup-and-upgrade :
71+ name : Setup and Upgrade Plugins
5272 runs-on : ubuntu-latest
73+ outputs :
74+ cache-key : ${{ steps.cache-key.outputs.key }}
5375 steps :
5476 - name : Checkout
5577 uses : actions/checkout@v4
5678
57- - uses : ./.github/actions/setup
79+ - uses : pnpm/action-setup@v4
80+ with :
81+ version : 10.6.3
82+ run_install : false
83+
84+ - uses : actions/setup-node@v4
5885 with :
5986 node-version : ${{ env.NODE_VERSION }}
87+ registry-url : ' https://registry.npmjs.org'
88+
89+ - name : Get pnpm store directory
90+ shell : bash
91+ run : |
92+ echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
93+
94+ - name : Setup pnpm cache
95+ uses : actions/cache@v4
96+ with :
97+ path : ${{ env.STORE_PATH }}
98+ key : pnpm-store-${{ runner.os }}-${{ hashFiles('**/pnpm-lock.yaml') }}
99+ restore-keys : |
100+ pnpm-store-${{ runner.os }}-
101+
102+ - name : Install scripts dependencies
103+ run : |
104+ cd scripts
105+ pnpm install --prefer-offline
60106
61107 - name : Upgrade Zephyr plugins
108+ if : github.event_name != 'pull_request' && github.event_name != 'push'
62109 run : |
63110 cd scripts
64111 if [ -n "${{ github.event.inputs.plugin_version }}" ]; then
@@ -72,28 +119,123 @@ jobs:
72119 pnpm upgrade-plugins
73120 fi
74121
75- - name : Install dependencies after upgrade
122+ - name : Generate cache key
123+ id : cache-key
76124 run : |
77- echo "Installing in nx workspace..."
78- cd nx && pnpm install --prefer-offline
79- echo "Installing in vanilla workspace..."
80- cd ../vanilla && pnpm install --prefer-offline
81- echo "Installing in turborepo workspace..."
82- cd ../turborepo && pnpm install --prefer-offline
83-
84- - name : Build all examples
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 : Download workspace files
149+ uses : actions/download-artifact@v4
150+ with :
151+ name : workspace-files
152+
153+ - uses : pnpm/action-setup@v4
154+ with :
155+ version : 10.6.3
156+ run_install : false
157+
158+ - uses : actions/setup-node@v4
159+ with :
160+ node-version : ${{ env.NODE_VERSION }}
161+ registry-url : ' https://registry.npmjs.org'
162+
163+ - name : Get pnpm store directory
164+ shell : bash
165+ run : |
166+ echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
167+
168+ - name : Setup pnpm cache
169+ uses : actions/cache@v4
170+ with :
171+ path : ${{ env.STORE_PATH }}
172+ key : ${{ needs.setup-and-upgrade.outputs.cache-key }}
173+ restore-keys : |
174+ pnpm-store-${{ runner.os }}-
175+
176+ - name : Install ${{ matrix.workspace }} dependencies
177+ run : |
178+ cd ${{ matrix.workspace }}
179+ pnpm install --prefer-offline
180+
181+ - name : Install scripts dependencies
182+ run : |
183+ cd scripts
184+ pnpm install --prefer-offline
185+
186+ - name : Get workspace examples
187+ id : get-examples
188+ run : |
189+ cd ${{ matrix.workspace }}/examples
190+ examples=$(ls -d */ 2>/dev/null | sed 's/\///g' | tr '\n' ',' | sed 's/,$//')
191+ echo "examples=$examples" >> $GITHUB_OUTPUT
192+ echo "Found examples: $examples"
193+
194+ - name : Build ${{ matrix.workspace }} examples
85195 run : |
86196 cd scripts
87197 if [ "${{ github.event.inputs.skip_cache }}" == "true" ] || [ "${{ github.event.client_payload.skip_cache }}" == "true" ]; then
88- echo "Building with --skip-cache flag"
89- pnpm build-packages:force
198+ echo "Building ${{ matrix.workspace }} with --skip-cache flag"
199+ pnpm build-packages --skip-cache --packages=${{ steps.get-examples.outputs.examples }}
90200 else
91- echo "Building with cache enabled"
92- pnpm build-packages
201+ echo "Building ${{ matrix.workspace }} with cache enabled"
202+ pnpm build-packages --packages=${{ steps.get-examples.outputs.examples }}
93203 fi
94204 env :
95205 NODE_ENV : production
96206
207+ - name : Upload ${{ matrix.workspace }} build logs
208+ uses : actions/upload-artifact@v4
209+ if : always()
210+ with :
211+ name : build-logs-${{ matrix.workspace }}
212+ path : scripts/tmp/build/
213+ retention-days : 3
214+
215+ test-deployments :
216+ name : Test All Deployments
217+ needs : [build-workspace]
218+ runs-on : ubuntu-latest
219+ steps :
220+ - name : Download workspace files
221+ uses : actions/download-artifact@v4
222+ with :
223+ name : workspace-files
224+
225+ - uses : pnpm/action-setup@v4
226+ with :
227+ version : 10.6.3
228+ run_install : false
229+
230+ - uses : actions/setup-node@v4
231+ with :
232+ node-version : ${{ env.NODE_VERSION }}
233+
234+ - name : Install scripts dependencies
235+ run : |
236+ cd scripts
237+ pnpm install --prefer-offline
238+
97239 - name : Wait for deployments to be ready
98240 run : |
99241 echo "Waiting 60 seconds for all deployments to propagate..."
@@ -120,12 +262,3 @@ jobs:
120262 scripts/test-results/
121263 scripts/playwright-report/
122264 retention-days : 7
123-
124- - name : Upload build logs
125- uses : actions/upload-artifact@v4
126- if : always()
127- with :
128- name : build-logs
129- path : |
130- scripts/tmp/build/
131- retention-days : 3
0 commit comments