-
Notifications
You must be signed in to change notification settings - Fork 3
371 lines (339 loc) · 11 KB
/
generate-examples.yml
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
name: Generate Examples
on:
push:
branches-ignore:
- main
- changeset-release/main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
generate-examples:
name: Create latest examples
runs-on: ubuntu-latest
outputs:
commit_sha: ${{ steps.commit_changes.outputs.commit_long_sha }}
steps:
- name: Prepare Check Runs
uses: dflydev/check-runs-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
checks: |
[
{ "id": "packages-unit-int-tests", "name": "Packages unit and Integration tests" },
{ "id": "generate-examples", "name": "Generate latest examples" },
{ "id": "examples-unit-int-tests", "name": "Examples unit and Integration tests" },
{ "id": "examples-e2e-tests", "name": "Examples e2e tests" }
]
status: "queued"
- name: Checkout Repo
uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 8
- name: Setup Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 18.x
cache: pnpm
- name: Make .env.examples file (used in examples configuration.ts)
run: |
echo "${{ secrets.EXAMPLES_ENV_FILE }}" > .env.examples
- name: Make .env file for composable-cli package
run: |
touch ./packages/composable-cli/.env
echo POSTHOG_PUBLIC_API_KEY=${{ secrets.POSTHOG_PUBLIC_API_KEY }} >> ./packages/composable-cli/.env
cat ./packages/composable-cli/.env
- name: Install Dependencies
run: pnpm install
- name: Build schematic schema types
run: pnpm generate
- name: Build packages/*
run: pnpm build:packages
- name: Report "Run packages unit and Integration tests" starting
uses: dflydev/check-runs-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
id: packages-unit-int-tests
status: in_progress
- name: Run packages unit and Integration tests
run: pnpm test:packages
id: packages-unit-int-tests
continue-on-error: true
- name: Report "Run packages unit and Integration tests" conclusion
if: always()
uses: dflydev/check-runs-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
id: packages-unit-int-tests
conclusion: ${{ steps.packages-unit-int-tests.outcome }}
fail-on-error: true
- name: Report "Generate latest examples using script" starting
uses: dflydev/check-runs-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
id: generate-examples
status: in_progress
- name: Generate latest examples using script
id: generate-examples
run: pnpm scaffold:local
continue-on-error: true
- name: Report "Generate latest examples using script" conclusion
if: always()
uses: dflydev/check-runs-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
id: generate-examples
conclusion: ${{ steps.generate-examples.outcome }}
fail-on-error: true
- name: Commit changes
id: commit_changes
uses: EndBug/add-and-commit@v9
with:
message: 'chore: generated latest examples'
committer_name: GitHub Actions
committer_email: 41898282+github-actions[bot]@users.noreply.github.com
default_author: github_actions
add: '*'
- name: Install additional dependencies
run: pnpm install
- name: Report "Run examples unit/integration tests" starting
uses: dflydev/check-runs-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
id: examples-unit-int-tests
status: in_progress
- name: Run examples unit/integration tests
id: examples-unit-int-tests
run: pnpm test
continue-on-error: true
- name: Report "Run examples unit/integration tests" conclusion
if: always()
uses: dflydev/check-runs-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
id: examples-unit-int-tests
conclusion: ${{ steps.examples-unit-int-tests.outcome }}
fail-on-error: true
- name: Make .env.test file
run: |
echo "${{ secrets.TEST_ENV_FILE }}" > .env.test
echo NEXT_PUBLIC_CI=true >> .env.test
echo NEXT_PUBLIC_CI=true >> ./examples/basic/.env.test
- name: Build everything
run: pnpm build:e2e
- name: Install playwright browsers
run: npx playwright install --with-deps
- name: Report "Run examples e2e tests" starting
uses: dflydev/check-runs-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
id: examples-e2e-tests
status: in_progress
- name: Run e2e tests for latest examples
run: pnpm test:e2e
id: examples-e2e-tests
continue-on-error: true
- name: Upload test results
if: always()
uses: actions/upload-artifact@v3
with:
name: test-results
path: examples/basic/test-results
continue-on-error: true
- name: Report "Run examples e2e tests" conclusion
if: always()
uses: dflydev/check-runs-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
id: examples-e2e-tests
conclusion: ${{ steps.examples-e2e-tests.outcome }}
fail-on-error: true
# commit-latest-examples:
# name: Commit latest examples
# needs: generate-examples
# runs-on: ubuntu-latest
# outputs:
# commit_sha: ${{ steps.commit_changes.outputs.commit_long_sha }}
# steps:
# - name: Checkout Repo
# uses: actions/checkout@v3
#
# - name: Install rimraf
# run: npm i -g [email protected]
#
# - name: Clear all previous examples versions
# run: mkdir -p examples && rimraf ./examples/*
#
# - uses: actions/download-artifact@v3
# with:
# path: temp-artifact-workspace
#
#
#
# - name: Display structure of downloaded files
# run: ls -R
# - name: Commit changes
# id: commit_changes
# uses: EndBug/add-and-commit@v9
# with:
# message: 'chore: generated latest ${{ matrix.example }} example'
# committer_name: GitHub Actions
# committer_email: 41898282+github-actions[bot]@users.noreply.github.com
# default_author: github_actions
# add: '*'
# build:
# name: Create latest examples
# runs-on: ubuntu-latest
# outputs:
# commit_sha: ${{ steps.commit_changes.outputs.commit_long_sha }}
# steps:
# - name: Checkout Repo
# uses: actions/checkout@v3
#
# - name: Setup Node.js 16.x
# uses: actions/setup-node@v3
# with:
# node-version: 16.x
#
# - name: Install Dependencies
# run: yarn
#
# - name: Make .env.examples file
# run: |
# echo "${{ secrets.EXAMPLES_ENV_FILE }}" > .env.examples
#
# - name: Build Latest CLI and generate examples
# run: yarn examples
#
# - name: Commit changes
# id: commit_changes
# uses: EndBug/add-and-commit@v9
# with:
# message: 'chore: generate latest examples'
# committer_name: GitHub Actions
# committer_email: 41898282+github-actions[bot]@users.noreply.github.com
# default_author: github_actions
# add: '*'
#
# - name: Display structure of directory pre zip
# run: ls -Ra
#
# - name: Zip build artifact
# run: zip app-build.zip ./.next -r
#
# - name: Display structure of directory post zip
# run: ls -Ra
#
# - name: Upload test results
# if: always()
# uses: actions/upload-artifact@v3
# with:
# name: app-build
# path: ./app-build.zip
#
# run-unit-basic:
# name: Run unit tests for examples
# needs: build
# defaults:
# run:
# working-directory: examples/basic
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
#
# - uses: actions/download-artifact@v3
# with:
# name: app-build
#
# - name: Display structure of downloaded files pre unzip
# run: ls -R
#
# - name: unzip build artifact
# run: unzip app-build.zip
#
# - name: Display structure of downloaded files post unzip
# run: ls -R
#
# - name: Run unit tests for latest examples
# run: yarn test:coverage
# - name: Upload test results
# if: always()
# uses: actions/upload-artifact@v3
# with:
# name: coverage
# path: examples/basic/coverage
#
# - name: "Create a check run"
# if: ${{ needs.build.outputs.commit_sha }}
# uses: actions/github-script@v6
# env:
# parameter_url: '${{ github.event.workflow_run.html_url }}'
# with:
# debug: ${{ secrets.ACTIONS_STEP_DEBUG || false }}
# script: |
# await github.rest.checks.create({
# owner: context.repo.owner,
# repo: context.repo.repo,
# head_sha: "${{ needs.build.outputs.commit_sha }}",
# name: "Unit Tests",
# status: "completed",
# conclusion: "success",
# output: {
# title: "Unit Tests",
# summary: "my *check* summary",
# text: "my text",
# },
# });
#
# run-e2e-basic:
# name: Run e2e tests for examples
# needs: build
# defaults:
# run:
# working-directory: examples/basic
# runs-on: ubuntu-latest
# steps:
# - name: Checkout files
# uses: Bhacaz/checkout-files@v2
# with:
# files: examples/basic
# branch: ${{ needs.build.outputs.commit_sha || github.sha }}
#
# - name: Make .env.test file
# run: |
# echo "${{ secrets.TEST_ENV_FILE }}" > .env.test
#
# - name: Install Dependencies
# run: yarn --ignore-scripts
#
# - name: Run e2e tests for latest examples
# run: yarn test:ci:e2e
# - name: Upload test results
# if: always()
# uses: actions/upload-artifact@v3
# with:
# name: test-results
# path: examples/basic/test-results
#
# - name: "Create a check run"
# if: ${{ needs.build.outputs.commit_sha }}
# uses: actions/github-script@v6
# env:
# parameter_url: '${{ github.event.workflow_run.html_url }}'
# with:
# debug: ${{ secrets.ACTIONS_STEP_DEBUG || false }}
# script: |
# await github.rest.checks.create({
# owner: context.repo.owner,
# repo: context.repo.repo,
# head_sha: "${{ needs.build.outputs.commit_sha }}",
# name: "Generate Examples",
# status: "completed",
# conclusion: "success",
# output: {
# title: "Generate Examples",
# summary: "my *check* summary",
# text: "my text",
# },
# });