@@ -43,21 +43,47 @@ jobs:
43
43
- run : pnpm run lint
44
44
- run : cd packages/kit && pnpm prepublishOnly && { [ "`git status --porcelain=v1`" == "" ] || (echo "Generated types have changed — please run prepublishOnly locally and commit the changes after you have reviewed them"; git diff; exit 1); }
45
45
- run : pnpm run check
46
+ list-kit-test-packages :
47
+ runs-on : ubuntu-latest
48
+ outputs :
49
+ package_shards : ${{ steps.set-package-groups.outputs.package_shards }}
50
+ steps :
51
+ - uses : actions/checkout@v4
52
+ - uses : pnpm/action-setup@v2
53
+ - name : List and group test packages
54
+ id : set-package-groups
55
+ run : |
56
+ package_shards=$(
57
+ pnpm -r --filter="./packages/kit/test/**" exec sh -c '
58
+ if [ "$(pnpm pkg get scripts.test 2>/dev/null)" != "{}" ]; then
59
+ pnpm pkg get name | sed -e "s/^\"//; s/\"$//"
60
+ fi
61
+ ' | sort | uniq | jq -Rsc '
62
+ split("\n") | map(select(. != "")) | . as $list |
63
+ [range(0; length; 4) |
64
+ {
65
+ name: ("Shard " + (. / 4 | tostring)),
66
+ filters: ($list[.:(.+4)] | map("--filter=" + .) | join(" ")),
67
+ packages: $list[.:(.+4)]
68
+ }
69
+ ]
70
+ '
71
+ )
72
+ echo "package_shards=$package_shards" >> $GITHUB_OUTPUT
73
+ echo "Generated package shards:"
74
+ echo "$package_shards" | jq .
46
75
test-kit :
76
+ needs : list-kit-test-packages
77
+ name : test-kit (node ${{ matrix.node-version }}, ${{ matrix.e2e-browser }}, ${{ matrix.package_shards.name }})
47
78
runs-on : ${{ matrix.os }}
48
79
timeout-minutes : 30
49
80
strategy :
50
81
fail-fast : false
51
82
matrix :
83
+ package_shards : ${{ fromJson(needs.list-kit-test-packages.outputs.package_shards) }}
84
+ node-version : [18, 20, 22]
52
85
include :
53
- - node-version : 18
54
- os : ubuntu-latest
55
- e2e-browser : ' chromium'
56
- - node-version : 20
57
- os : ubuntu-latest
58
- e2e-browser : ' chromium'
59
- - node-version : 22
60
- os : ubuntu-latest
86
+ - os : ubuntu-latest
61
87
e2e-browser : ' chromium'
62
88
env :
63
89
KIT_E2E_BROWSER : ${{matrix.e2e-browser}}
@@ -69,10 +95,14 @@ jobs:
69
95
with :
70
96
node-version : ${{ matrix.node-version }}
71
97
cache : pnpm
72
- - run : pnpm install --frozen-lockfile
73
- - run : pnpm playwright install ${{ matrix.e2e-browser }}
74
- - run : pnpm run sync-all
75
- - run : pnpm test:kit
98
+ - name : Install dependencies
99
+ run : pnpm install --frozen-lockfile
100
+ - name : Install Playwright
101
+ run : pnpm playwright install ${{ matrix.e2e-browser }}
102
+ - name : Run tests
103
+ run : |
104
+ pnpm run sync-all
105
+ pnpm ${{ matrix.package_shards.filters }} test
76
106
- name : Print flaky test report
77
107
run : node scripts/print-flaky-test-report.js
78
108
- name : Archive test results
@@ -84,39 +114,69 @@ jobs:
84
114
uses : actions/upload-artifact@v4
85
115
with :
86
116
retention-days : 3
87
- name : test-failure-${{ github.run_id }}-${{ matrix.os }}-${{ matrix.node-version }}-${{ matrix.e2e-browser }}
117
+ name : test-failure-${{ github.run_id }}-${{ matrix.os }}-${{ matrix.node-version }}-${{ matrix.e2e-browser }}-${{ matrix.package_shards.name }}
88
118
path : test-results.tar.gz
119
+ test-kit-results :
120
+ if : always()
121
+ needs : test-kit
122
+ runs-on : ubuntu-latest
123
+ steps :
124
+ - name : Check test results
125
+ run : |
126
+ if [ "${{ needs.test-kit.result }}" = "success" ]; then
127
+ echo "All tests passed successfully!"
128
+ exit 0
129
+ else
130
+ echo "Some tests failed. Please check the individual job results."
131
+ exit 1
132
+ fi
133
+ list-kit-test-cross-browser-packages :
134
+ runs-on : ubuntu-latest
135
+ outputs :
136
+ packages : ${{ steps.set-packages.outputs.packages }}
137
+ steps :
138
+ - uses : actions/checkout@v4
139
+ - uses : pnpm/action-setup@v2
140
+ - name : List test packages
141
+ id : set-packages
142
+ run : |
143
+ packages=$(
144
+ pnpm -r --filter="./packages/kit/test/**" exec sh -c '
145
+ if [ "$(pnpm pkg get scripts.test:cross-platform:build 2>/dev/null)" != "{}" ]; then
146
+ echo "build:$(pnpm pkg get name | sed -e "s/^\"//; s/\"$//")"
147
+ fi
148
+ if [ "$(pnpm pkg get scripts.test:cross-platform:dev 2>/dev/null)" != "{}" ]; then
149
+ echo "dev:$(pnpm pkg get name | sed -e "s/^\"//; s/\"$//")"
150
+ fi
151
+ ' | sort | uniq | jq -Rsc '
152
+ . | split("\n") | map(select(. != "")) | map(split(":") | {mode: .[0], package: .[1]})
153
+ '
154
+ )
155
+ echo "packages=$packages" >> $GITHUB_OUTPUT
156
+ echo "Generated packages:"
157
+ echo "$packages" | jq .
89
158
test-kit-cross-browser :
159
+ needs : list-kit-test-cross-browser-packages
90
160
runs-on : ${{ matrix.os }}
91
161
timeout-minutes : 30
92
162
strategy :
93
163
fail-fast : false
94
164
matrix :
165
+ node-version : [20]
166
+ package-details : ${{fromJson(needs.list-kit-test-cross-browser-packages.outputs.packages)}}
95
167
include :
96
- - node-version : 18
97
- os : windows-2019 # slowness reported on newer versions https://github.com/actions/runner-images/issues/5166
168
+ - os : windows-2019 # slowness reported on newer versions https://github.com/actions/runner-images/issues/5166
98
169
e2e-browser : ' chromium'
99
- mode : ' dev'
100
- - node-version : 18
101
- os : ubuntu-latest
170
+ - os : ubuntu-latest
102
171
e2e-browser : ' firefox'
103
- mode : ' dev'
104
- - node-version : 18
105
- os : macOS-latest
172
+ - os : macOS-latest
106
173
e2e-browser : ' webkit'
107
- mode : ' dev'
108
- - node-version : 18
109
- os : windows-2019 # slowness reported on newer versions https://github.com/actions/runner-images/issues/5166
174
+ - os : windows-2019 # slowness reported on newer versions https://github.com/actions/runner-images/issues/5166
110
175
e2e-browser : ' chromium'
111
- mode : ' build'
112
- - node-version : 18
113
- os : ubuntu-latest
176
+ - os : ubuntu-latest
114
177
e2e-browser : ' firefox'
115
- mode : ' build'
116
- - node-version : 18
117
- os : macOS-latest
178
+ - os : macOS-latest
118
179
e2e-browser : ' webkit'
119
- mode : ' build'
120
180
env :
121
181
KIT_E2E_BROWSER : ${{matrix.e2e-browser}}
122
182
steps :
@@ -130,20 +190,34 @@ jobs:
130
190
- run : pnpm install --frozen-lockfile
131
191
- run : pnpm playwright install ${{ matrix.e2e-browser }}
132
192
- run : pnpm run sync-all
133
- - run : pnpm test:cross-platform:${{ matrix.mode }}
193
+ - run : pnpm --filter="${{ matrix.package-details.package }}" test:cross-platform:${{ matrix.package-details .mode }}
134
194
- name : Print flaky test report
135
195
run : node scripts/print-flaky-test-report.js
136
196
- name : Archive test results
137
197
if : failure()
138
198
shell : bash
139
- run : find packages -type d -name test-results -not -empty | tar -czf test-results-cross-platform-${{ matrix.mode }}.tar.gz --files-from=-
199
+ run : find packages -type d -name test-results -not -empty | tar -czf test-results-cross-platform-${{ matrix.package-details. mode }}.tar.gz --files-from=-
140
200
- name : Upload test results
141
201
if : failure()
142
202
uses : actions/upload-artifact@v4
143
203
with :
144
204
retention-days : 3
145
- name : test-failure-cross-platform-${{ matrix.mode }}-${{ github.run_id }}-${{ matrix.os }}-${{ matrix.node-version }}-${{ matrix.e2e-browser }}
146
- path : test-results-cross-platform-${{ matrix.mode }}.tar.gz
205
+ name : test-failure-cross-platform-${{ matrix.package-details.mode }}-${{ github.run_id }}-${{ matrix.os }}-${{ matrix.node-version }}-${{ matrix.e2e-browser }}
206
+ path : test-results-cross-platform-${{ matrix.package-details.mode }}.tar.gz
207
+ test-kit-cross-browser-results :
208
+ if : always()
209
+ needs : test-kit-cross-browser
210
+ runs-on : ubuntu-latest
211
+ steps :
212
+ - name : Check test results
213
+ run : |
214
+ if [ "${{ needs.test-kit-cross-browser.result }}" = "success" ]; then
215
+ echo "All tests passed successfully!"
216
+ exit 0
217
+ else
218
+ echo "Some tests failed. Please check the individual job results."
219
+ exit 1
220
+ fi
147
221
test-others :
148
222
runs-on : ubuntu-latest
149
223
steps :
0 commit comments