-
Notifications
You must be signed in to change notification settings - Fork 1.3k
923 lines (787 loc) · 28.6 KB
/
ci.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
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
# Build and test everything
#
# First it builds the packages and stores them in artifacts/cache.
# Meanwhile it lints the code.
# Then it runs the unit tests with the artifacts, as well as builds the docs and insights
# Once it all works, it does a release
#
# NOTE: only use pnpm run scripts for build commands
# This way we're sure that dev and CI environments are consistent
name: Qwik CI
# TODO fix e2e tests hanging and not cancelling
# # We only need one instance of the workflow running at a time, per branch
# concurrency:
# group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
# cancel-in-progress: true
on:
pull_request:
push:
branches:
- main
- upcoming
- next
- vercelserverless
- 'build/**'
workflow_dispatch:
inputs:
disttag:
description: 'Publish "@qwik.dev/core" to NPM using this dist-tag, push the git-tag to the repo and create a GitHub release. The "latest" and "next" dist-tags will use the version number already committed in package.json.'
required: true
type: choice
default: 'dev'
options:
- dev
- next
- latest
env:
# Disable incremental build, speeds up CI
CARGO_INCREMENTAL: 0
jobs:
changes:
name: Setup
runs-on: ubuntu-latest
outputs:
hash-qwik: ${{ steps.cache-qwik.outputs.cache-primary-key }}
hash-rust: ${{ steps.cache-rust.outputs.cache-primary-key }}
hash-others: ${{ steps.cache-others.outputs.cache-primary-key }}
hash-docs: ${{ steps.cache-docs.outputs.cache-primary-key }}
hash-insights: ${{ steps.cache-insights.outputs.cache-primary-key }}
hash-unit: ${{ steps.cache-unit.outputs.cache-primary-key }}
hash-e2e: ${{ steps.cache-e2e.outputs.cache-primary-key }}
build-qwik: ${{ steps.cache-qwik.outputs.cache-hit != 'true' }}
build-rust: ${{ steps.cache-rust.outputs.cache-hit != 'true' }}
build-others: ${{ steps.cache-others.outputs.cache-hit != 'true' }}
build-docs: ${{ steps.cache-docs.outputs.cache-hit != 'true' }}
build-insights: ${{ steps.cache-insights.outputs.cache-hit != 'true' }}
build-unit: ${{ steps.cache-unit.outputs.cache-hit != 'true' }}
build-e2e: ${{ steps.cache-e2e.outputs.cache-hit != 'true' }}
disttag: ${{ steps.set_dist_tag.outputs.disttag }}
steps:
- name: Branch
run: echo "${{ github.ref }}"
- name: NPM Dist Tag from input
run: echo "${{ github.event.inputs.disttag }}"
- name: Github event
run: echo event_name=${{ github.event_name }}
- name: Checkout
uses: actions/checkout@v4
- name: Set Dist Tag
id: set_dist_tag
if: |
github.ref == 'refs/heads/build/v2' && (
github.event_name == 'push' ||
github.event_name == 'workflow_dispatch'
)
run: |
if [ ${{ github.event_name }} == 'workflow_dispatch' ]; then
disttag="${{ github.event.inputs.disttag }}"
echo "Overriding disttag with input: $disttag"
echo "disttag=${disttag}" >> $GITHUB_OUTPUT
exit 0
fi
is_release=false
commit_id=${{ github.sha }}
owner=${{ github.repository_owner }}
repo=${{ github.event.repository.name }}
removed_files=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/$owner/$repo/commits/$commit_id" | jq -r '.files[] | select(.status == "removed") | .filename')
echo "Removed files: $removed_files"
md_file_removed=false
for file in $removed_files; do
if [[ $file == .changeset/*.md ]]; then
md_file_removed=true
break
fi
done
if [ $md_file_removed = true ]; then
if ! ls .changeset/*.md > /dev/null 2>&1; then
is_release=true
fi
fi
echo "is_release: $is_release"
if [ "$is_release" = true ]; then
disttag='latest'
else
disttag="${{github.event.inputs.disttag}}"
fi
echo "disttag: $disttag"
echo "disttag=${disttag}" >> $GITHUB_OUTPUT
- run: jq .scripts package.json > scripts.json
- name: 'check cache: qwik'
id: cache-qwik
uses: actions/cache/restore@v4
with:
lookup-only: true
path: packages/qwik/dist
# Note that this includes the package.json of qwik
key: ${{ hashfiles('.github/workflows/ci.yml', 'pnpm-lock.yaml', 'scripts.json', 'scripts/**/*', 'packages/qwik/**/*', '!**/*.unit.*', '!**/*.rs') }}
- run: 'echo ${{ steps.cache-qwik.outputs.cache-primary-key }} > qwik-key.txt'
- name: 'check cache: rust'
id: cache-rust
uses: actions/cache/restore@v4
with:
lookup-only: true
path: packages/qwik/bindings
key: ${{ hashfiles('Makefile', 'rust-toolchain', '**/Cargo.toml', '**/Cargo.lock', '**/*.rs') }}
- run: 'echo ${{ steps.cache-rust.outputs.cache-primary-key }} > rust-key.txt'
- name: 'check cache: others'
id: cache-others
uses: actions/cache/restore@v4
with:
lookup-only: true
path: |
packages/qwik-router/lib
packages/qwik-react/lib
packages/eslint-plugin-qwik/dist
packages/create-qwik/dist
# note that all inputs need to be listed here, including qwik, for correct cache invalidation
key: ${{ hashfiles('qwik-key.txt', 'rust-key.txt', 'packages/qwik-router/**/*', 'packages/qwik-react/**/*', 'packages/eslint-plugin-qwik/**/*', 'packages/create-qwik/**/*', '!**/*.unit.*') }}
- run: 'echo ${{ steps.cache-others.outputs.cache-primary-key }} > others-key.txt'
- name: 'check cache: docs'
id: cache-docs
uses: actions/cache/restore@v4
with:
lookup-only: true
path: docs-build-completed.txt
key: ${{ hashfiles('others-key.txt', 'packages/docs/**/*') }}
- name: 'check cache: insights'
id: cache-insights
uses: actions/cache/restore@v4
with:
lookup-only: true
path: |
packages/insights/dist
packages/insights/.netlify
key: ${{ hashfiles('others-key.txt', 'packages/qwik-insights/**/*') }}
- name: 'check cache: unit tests'
id: cache-unit
uses: actions/cache/restore@v4
with:
lookup-only: true
path: unit-tests-completed.txt
key: ${{ hashfiles('others-key.txt', 'packages/**/*.unit.*') }}
- name: 'check cache: e2e tests'
id: cache-e2e
uses: actions/cache/restore@v4
with:
lookup-only: true
path: e2e-tests-completed.txt
key: ${{ hashfiles('others-key.txt', 'starters/**/*') }}
############ BUILD Qwik ############
build-qwik:
if: needs.changes.outputs.build-qwik == 'true'
name: Build Qwik
needs: changes
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: 'pnpm'
registry-url: https://registry.npmjs.org/
- name: Install NPM Dependencies
run: |
corepack enable
# Ensure that the qwik binary gets made
mkdir -p packages/qwik/bindings/
pnpm install --frozen-lockfile
- name: 'build: qwik'
run: pnpm build --qwik --set-dist-tag="${{ needs.changes.outputs.disttag }}"
- name: Print Qwik Dist Build
continue-on-error: true
run: tree -a packages/qwik/dist/
- name: Save qwik cache
uses: actions/cache/save@v4
with:
key: ${{ needs.changes.outputs.hash-qwik }}
path: packages/qwik/dist
- name: Save artifacts
uses: actions/upload-artifact@v4
with:
name: artifact-qwik-no-optimizer
include-hidden-files: true
path: packages/qwik/dist/
if-no-files-found: error
############ BUILD PLATFORM BINDINGS ############
build-bindings:
if: needs.changes.outputs.build-rust == 'true'
strategy:
matrix:
settings:
- host: ubuntu-latest
target: x86_64-unknown-linux-gnu
wasm: true
# the last x86 macos available as a standard runner
- host: macos-13
target: x86_64-apple-darwin
- host: macos-latest
target: aarch64-apple-darwin
- host: windows-latest
target: x86_64-pc-windows-msvc
name: Build optimizer ${{ matrix.settings.target }}
runs-on: ${{ matrix.settings.host }}
needs: changes
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
- uses: pnpm/action-setup@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: 'pnpm'
registry-url: https://registry.npmjs.org/
- run: pnpm install
- if: matrix.settings.wasm
run: pnpm install wasm-pack
- name: Lint check
if: matrix.settings.wasm
run: pnpm lint.rust
- name: Unit tests
if: matrix.settings.wasm
run: pnpm test.rust
- name: Build Platform Binding
run: pnpm build --platform-binding
- name: Build Wasm Binding
if: matrix.settings.wasm
run: pnpm build --wasm
- name: Print Packages Dist Build
continue-on-error: true
run: ls -lR packages/qwik/bindings/
- name: Upload Platform Binding Artifact
uses: actions/upload-artifact@v4
with:
name: artifact-bindings-${{ matrix.settings.target }}
include-hidden-files: true
path: packages/qwik/bindings/
if-no-files-found: error
############ BUILD PACKAGE ############
combined-qwik:
name: Bundle Qwik
if: always()
runs-on: ubuntu-latest
needs:
- build-qwik
- build-bindings
- changes
steps:
- name: Verify builds
if: |
!(
(needs.build-qwik.result == 'success' || needs.build-qwik.result == 'skipped') &&
(needs.build-bindings.result == 'success' || needs.build-bindings.result == 'skipped')
)
run: exit 1
- name: Restore artifacts
if: needs.changes.outputs.build-rust == 'true'
uses: actions/download-artifact@v4
- name: Restore Qwik from cache
uses: actions/cache/restore@v4
with:
path: packages/qwik/dist
key: ${{ needs.changes.outputs.hash-qwik }}
- name: Restore Rust from cache
if: needs.changes.outputs.build-rust != 'true'
uses: actions/cache/restore@v4
with:
path: packages/qwik/bindings
key: ${{ needs.changes.outputs.hash-rust }}
- name: Move Rust Artifacts
if: needs.changes.outputs.build-rust == 'true'
run: |
mkdir -p packages/qwik/bindings
mv artifact-bindings-*/* packages/qwik/bindings
- name: Save rust cache
if: needs.changes.outputs.build-rust == 'true'
uses: actions/cache/save@v4
with:
key: ${{ needs.changes.outputs.hash-rust }}
path: packages/qwik/bindings
- name: Upload Qwik artifact
uses: actions/upload-artifact@v4
with:
name: artifact-qwik
include-hidden-files: true
path: |
packages/qwik/bindings
packages/qwik/dist
if-no-files-found: error
build-other-packages:
name: Build Other Packages
needs:
- changes
- combined-qwik
if: always()
runs-on: ubuntu-latest
steps:
- name: Verify combined-qwik
if: needs.combined-qwik.result != 'success'
run: exit 1
- name: Checkout
if: needs.changes.outputs.build-others == 'true'
uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
if: needs.changes.outputs.build-others == 'true'
- name: Setup Node
if: needs.changes.outputs.build-others == 'true'
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: 'pnpm'
registry-url: https://registry.npmjs.org/
- name: Restore Qwik artifact
uses: actions/download-artifact@v4
with:
name: artifact-qwik
path: packages/qwik/
- name: Install NPM Dependencies
if: needs.changes.outputs.build-others == 'true'
run: corepack pnpm install
- name: 'build: qwik-router & others'
if: needs.changes.outputs.build-others == 'true'
run: pnpm build --tsc --api --qwikrouter --cli --qwikreact --eslint --set-dist-tag="${{ needs.changes.outputs.disttag }}"
- name: Save others cache
if: needs.changes.outputs.build-others == 'true'
uses: actions/cache/save@v4
with:
key: ${{ needs.changes.outputs.hash-others }}
path: |
packages/qwik-router/lib
packages/qwik-react/lib
packages/eslint-plugin-qwik/dist
packages/create-qwik/dist
- name: 'restore: qwik-router & others'
if: needs.changes.outputs.build-others != 'true'
uses: actions/cache/restore@v4
with:
path: |
packages/qwik-router/lib
packages/qwik-react/lib
packages/eslint-plugin-qwik/dist
packages/create-qwik/dist
key: ${{ needs.changes.outputs.hash-others }}
- name: Print QwikRouter Lib Build
run: tree -a packages/qwik-router/lib/
- name: Upload QwikRouter Build Artifacts
uses: actions/upload-artifact@v4
with:
name: artifact-qwikrouter
include-hidden-files: true
path: packages/qwik-router/lib/
if-no-files-found: error
- name: Print qwik-react Lib Build
run: tree -a packages/qwik-react/lib/
- name: Upload qwik-react Build Artifacts
uses: actions/upload-artifact@v4
with:
name: artifact-qwikreact
include-hidden-files: true
path: |
packages/qwik-react/lib/
packages/qwik-react/package.json
if-no-files-found: error
- name: Print Create Qwik CLI Dist Build
run: tree -a packages/create-qwik/dist/
- name: Upload Create Qwik CLI Build Artifacts
uses: actions/upload-artifact@v4
with:
name: artifact-create-qwik
include-hidden-files: true
path: packages/create-qwik/dist/
if-no-files-found: error
- name: Print Eslint rules Dist Build
run: tree -a packages/eslint-plugin-qwik/dist/
- name: Upload Eslint rules Build Artifacts
uses: actions/upload-artifact@v4
with:
name: artifact-eslint-plugin-qwik
include-hidden-files: true
path: packages/eslint-plugin-qwik/dist/
if-no-files-found: error
############ BUILD INSIGHTS ############
build-insights:
if: always() && needs.changes.outputs.build-insights == 'true'
name: Build Insights
needs:
- changes
- build-other-packages
runs-on: ubuntu-latest
steps:
- name: Verify build-other-packages
if: needs.build-other-packages.result != 'success'
run: exit 1
- name: Checkout
uses: actions/checkout@v4
- name: Download Build Artifacts
uses: actions/download-artifact@v4
- name: Move Distribution Artifacts
run: |
mv artifact-qwik/* packages/qwik/
mkdir -p packages/qwik-router/lib/
mv artifact-qwikrouter/* packages/qwik-router/lib/
mkdir -p packages/create-qwik/dist/
mv artifact-create-qwik/* packages/create-qwik/dist/
mkdir -p packages/eslint-plugin-qwik/dist/
mv artifact-eslint-plugin-qwik/* packages/eslint-plugin-qwik/dist/
- uses: pnpm/action-setup@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: 'pnpm'
registry-url: https://registry.npmjs.org/
- run: corepack pnpm install --frozen-lockfile
- name: Build Qwik Insights
run: pnpm run build.packages.insights
- name: Save Insights Cache
uses: actions/cache/save@v4
with:
key: ${{ needs.changes.outputs.hash-insights }}
path: |
packages/insights/dist
packages/insights/.netlify
############ BUILD DOCS ############
build-docs:
if: always() && needs.changes.outputs.build-docs == 'true'
name: Build Docs
needs:
- changes
- build-other-packages
runs-on: ubuntu-latest
steps:
- name: Verify build-other-packages
if: needs.build-other-packages.result != 'success'
run: exit 1
- name: Checkout
uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: 'pnpm'
registry-url: https://registry.npmjs.org/
- name: Download Build Artifacts
uses: actions/download-artifact@v4
- name: Move Distribution Artifacts
run: |
mv artifact-qwik/* packages/qwik/
mkdir -p packages/qwik-router/lib/
mv artifact-qwikrouter/* packages/qwik-router/lib/
mkdir -p packages/create-qwik/dist/
mv artifact-create-qwik/* packages/create-qwik/dist/
mkdir -p packages/eslint-plugin-qwik/dist/
mv artifact-eslint-plugin-qwik/* packages/eslint-plugin-qwik/dist/
mv artifact-qwikreact/lib packages/qwik-react/lib
- run: corepack pnpm install --frozen-lockfile
- name: Build Qwik Docs
run: pnpm run build.packages.docs && echo ok > docs-build-completed.txt
- name: Save Docs Artifacts
uses: actions/upload-artifact@v4
with:
name: artifact-docs
include-hidden-files: true
path: |
packages/docs/dist
packages/docs/server
- name: Save Docs Cache
uses: actions/cache/save@v4
with:
key: ${{ needs.changes.outputs.hash-docs }}
path: docs-build-completed.txt
############ UNIT TEST ############
test-unit:
name: Unit Tests
if: always() && needs.changes.outputs.build-unit == 'true'
runs-on: ubuntu-latest
needs:
- changes
- build-other-packages
steps:
- name: Verify build-other-packages
if: needs.build-other-packages.result != 'success'
run: exit 1
- name: Checkout
uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: 'pnpm'
registry-url: https://registry.npmjs.org/
- run: corepack enable
- name: Download Build Artifacts
uses: actions/download-artifact@v4
- name: Move Distribution Artifacts
run: |
mv artifact-qwik/* packages/qwik/
mkdir -p packages/qwik-router/lib/
mv artifact-qwikrouter/* packages/qwik-router/lib/
mkdir -p packages/create-qwik/dist/
mv artifact-create-qwik/* packages/create-qwik/dist/
mkdir -p packages/eslint-plugin-qwik/dist/
mv artifact-eslint-plugin-qwik/* packages/eslint-plugin-qwik/dist/
- run: pnpm install --frozen-lockfile
- name: Unit Tests
run: pnpm run test.unit && echo ok > unit-tests-completed.txt
- name: Save unit tests cache
uses: actions/cache/save@v4
with:
key: ${{ needs.changes.outputs.hash-unit }}
path: unit-tests-completed.txt
############ E2E TEST ############
test-e2e:
# Sometimes the tests just hang
timeout-minutes: 20
name: E2E Tests
if: always() && needs.changes.outputs.build-e2e == 'true'
needs:
- build-other-packages
- changes
- test-unit
strategy:
matrix:
settings:
- host: ubuntu-latest
browser: chromium
# too slow and flaky. Perhaps better in v2?
# - host: ubuntu-latest
# browser: firefox
- host: macos-latest
browser: webkit
- host: windows-latest
browser: chromium
runs-on: ${{ matrix.settings.host }}
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: 'pnpm'
registry-url: https://registry.npmjs.org/
- run: corepack enable
- name: Download Build Artifacts
uses: actions/download-artifact@v4
- name: Move Distribution Artifacts
run: |
mv artifact-qwik/* packages/qwik/
mkdir -p packages/qwik-router/lib/
mv artifact-qwikrouter/* packages/qwik-router/lib/
mkdir -p packages/create-qwik/dist/
mv artifact-create-qwik/* packages/create-qwik/dist/
mkdir -p packages/eslint-plugin-qwik/dist/
mv artifact-eslint-plugin-qwik/* packages/eslint-plugin-qwik/dist/
- run: pnpm install --frozen-lockfile
- name: Install Playwright
run: npx playwright install ${{ matrix.settings.browser }} --with-deps
- name: Playwright E2E Tests
run: pnpm run test.e2e.${{ matrix.settings.browser }} --timeout 60000 --retries 7 --workers 1
# RE-ENABBLE THIS AFTER qwik.dev/ packages are published
# - name: Validate Create Qwik Cli
# if: matrix.settings.host != 'windows-latest'
# run: pnpm cli.validate
############ E2E CLI TEST ############
test-cli-e2e:
name: E2E CLI Tests
if: always() && needs.changes.outputs.build-e2e == 'true'
needs:
- build-other-packages
- changes
- test-unit
strategy:
matrix:
settings:
- host: ubuntu-latest
- host: macos-latest
- host: windows-latest
runs-on: ${{ matrix.settings.host }}
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: 'pnpm'
registry-url: https://registry.npmjs.org/
- run: corepack enable
- name: Download Build Artifacts
uses: actions/download-artifact@v4
- name: Move Distribution Artifacts
run: |
mv artifact-qwik/* packages/qwik/
mkdir -p packages/qwik-router/lib/
mv artifact-qwikrouter/* packages/qwik-router/lib/
mkdir -p packages/create-qwik/dist/
mv artifact-create-qwik/* packages/create-qwik/dist/
mkdir -p packages/eslint-plugin-qwik/dist/
mv artifact-eslint-plugin-qwik/* packages/eslint-plugin-qwik/dist/
- run: pnpm install --frozen-lockfile
- name: CLI E2E Tests
run: pnpm run test.e2e.cli
########### LINT PACKAGES ############
lint-package:
name: Lint Package
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: 'pnpm'
registry-url: https://registry.npmjs.org/
- run: corepack enable
- run: pnpm install --frozen-lockfile
- name: SyncPack Check
if: always()
run: pnpm run lint.syncpack
- name: Prettier Check
if: always()
run: pnpm run lint.prettier
- name: Build ESLint
if: always()
run: pnpm build --eslint
- name: ESLint Check
if: always()
run: pnpm run lint.eslint
############ RELEASE ############
release:
name: Release
runs-on: ubuntu-latest
needs:
- changes
- test-unit
- test-e2e
# test-unit runs when any packages changes, so we have to release
# on "upcoming", we always check if we have something to release
# don't run on forks
if: |
always() &&
github.repository == 'QwikDev/qwik' && (
github.ref == 'refs/heads/build/v2' ||
needs.test-unit.result == 'success'
)
steps:
- name: Verify test-e2e
if: needs.test-e2e.result != 'skipped'
run: |
if [ "${{ needs.test-e2e.result }}" != success ] ; then
exit 1
else
echo ok > e2e-tests-completed.txt
fi
- name: Save e2e tests cache
if: needs.test-e2e.result != 'skipped'
uses: actions/cache/save@v4
with:
key: ${{ needs.changes.outputs.hash-e2e }}
path: e2e-tests-completed.txt
- name: Checkout
uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: 'pnpm'
registry-url: https://registry.npmjs.org/
- run: corepack enable
- name: Download Build Artifacts
uses: actions/download-artifact@v4
- name: Move Distribution Artifacts
run: |
mv artifact-qwik/* packages/qwik/
mkdir -p packages/qwik-router/lib/
mv artifact-qwikrouter/* packages/qwik-router/lib/
mkdir -p packages/create-qwik/dist/
mv artifact-create-qwik/* packages/create-qwik/dist/
mkdir -p packages/eslint-plugin-qwik/dist/
mv artifact-eslint-plugin-qwik/* packages/eslint-plugin-qwik/dist/
mv artifact-qwikreact/lib packages/qwik-react/lib
rm -rf artifact-*
- run: pnpm install --frozen-lockfile
# Do this before other release steps to avoid
# publishing temporary files
- name: Create Release Pull Request or Publish to npm
if: github.ref == 'refs/heads/build/v2'
id: changesets
uses: changesets/action@v1
with:
publish: pnpm release
title: V2 Version Packages
branch: build/v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# Delete this after V2 is released
- name: Tag with latest
if: steps.changesets.outcome == 'success'
run: |
npm dist-tag add @qwik.dev/core@${{ fromJson(steps.changesets.outputs.publishedPackages)[0].version }} latest
npm dist-tag add @qwik.dev/router@${{ fromJson(steps.changesets.outputs.publishedPackages)[0].version }} latest
npm dist-tag add @qwik.dev/react@${{ fromJson(steps.changesets.outputs.publishedPackages)[0].version }} latest
- name: Fixup package.json files
run: pnpm run release.fixup-package-json
- name: Commit Build Artifacts
if: github.event_name == 'push'
env:
QWIK_API_TOKEN_GITHUB: ${{ secrets.QWIK_API_TOKEN_GITHUB }}
run: pnpm run qwik-push-build-repos
- name: Publish packages for testing
if: github.event_name != 'workflow_dispatch'
# TODO: bring back --compact in the package.json release.pkg-pr-new script after first npm public of V2 alpha
run: pnpm release.pkg-pr-new
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
############ TRIGGER QWIKCITY E2E TEST ############
trigger-qwikrouter-e2e:
name: Trigger Qwik City E2E
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/upcoming'
needs:
- changes
- release
steps:
- name: Repository Dispatch
uses: peter-evans/repository-dispatch@v2
with:
token: ${{ secrets.QWIK_API_TOKEN_GITHUB }}
repository: QwikDev/qwik-city-e2e
event-type: main-updated
############ Everything is fine ############
requirements-passed:
name: All requirements are met
runs-on: ubuntu-latest
needs:
- test-unit
- test-e2e
- lint-package
- build-docs
- build-insights
if: always()
steps:
- name: check status
if: |
!(
(needs.test-unit.result == 'success' || needs.test-unit.result == 'skipped') &&
(needs.test-e2e.result == 'success' || needs.test-e2e.result == 'skipped') &&
(needs.lint-package.result == 'success' || needs.lint-package.result == 'skipped') &&
(needs.build-docs.result == 'success' || needs.build-docs.result == 'skipped') &&
(needs.build-insights.result == 'success' || needs.build-insights.result == 'skipped')
)
run: exit 1