@@ -11,56 +11,38 @@ permissions:
1111
1212env :
1313 FORCE_JAVASCRIPT_ACTIONS_TO_NODE24 : true
14- NX_SELF_HOSTED_REMOTE_CACHE_ACCESS_TOKEN : ${{ secrets.NX_SELF_HOSTED_REMOTE_CACHE_ACCESS_TOKEN }}
15- NX_SELF_HOSTED_REMOTE_CACHE_SERVER : ${{ secrets.NX_SELF_HOSTED_REMOTE_CACHE_SERVER }}
16- pnpm_config_store_dir : ./node_modules/.pnpm-store
1714
1815jobs :
1916 build :
2017 name : Build
2118 runs-on : ubuntu-latest
2219 timeout-minutes : 60
2320 steps :
24- - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
21+ - uses : actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
2522 with :
2623 fetch-depth : 100
2724 persist-credentials : false
2825
29- - name : Install pnpm
30- uses : pnpm/action-setup@0e279bb959325dab635dd2c09392533439d90093 # v6.0.8
31-
32- - uses : nrwl/nx-set-shas@afb73a62d26e41464e9254689e1fd6122ee683c1 # v5
33-
34- - uses : actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
35- with :
36- cache : " pnpm"
37- cache-dependency-path : " **/pnpm-lock.yaml"
38- node-version-file : " .nvmrc"
39-
40- - name : Cache NX
41- uses : actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
26+ - uses : voidzero-dev/setup-vp@2dec1e33f4ab2c6d5bce1b0c4607961bb1a3f7a1 # v1
4227 with :
43- path : .nx/cache
44- key : nx-${{ env.NX_BRANCH }}-${{ env.NX_RUN_GROUP }}-${{ github.sha }}
45- restore-keys : |
46- nx-${{ env.NX_BRANCH }}-${{ env.NX_RUN_GROUP }}-
47- nx-${{ env.NX_BRANCH }}-
48- nx-
28+ node-version-file : " .node-version"
29+ cache : true
4930
5031 - name : Install Dependencies
51- run : pnpm install
32+ run : vp install
5233
5334 - name : Lint packages
54- run : pnpm run lint
35+ run : vp lint
5536
5637 - name : Build packages
57- run : pnpm run build
38+ run : vp run -r build
5839
5940 - name : Run unit tests
60- run : pnpm run test
41+ run : vp run -r test
6142
6243 - name : Run Next.js integration test (production build)
63- run : NEXTJS_TEST_MODE=build npx vitest run tests/src/unit/nextjs/serverUtil.test.ts
44+ run : NEXTJS_TEST_MODE=build vp test run src/unit/nextjs/serverUtil.test.ts
45+ working-directory : tests
6446
6547 - name : Upload webpack stats artifact (editor)
6648 uses : relative-ci/agent-upload-artifact-action@a2b5741b4f7e6a989c84ec1a3059696b23c152e5 # v2
@@ -70,146 +52,150 @@ jobs:
7052
7153 - name : Soft release
7254 id : soft-release
73- run : pnpx pkg-pr-new publish './packages/*' # TODO disabled only for AI branch--compact
74-
75- playwright-build :
76- name : " Playwright Build"
77- runs-on : ubuntu-latest
78- timeout-minutes : 30
79- steps :
80- - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
81- with :
82- fetch-depth : 100
83- persist-credentials : false
84-
85- - name : Install pnpm
86- uses : pnpm/action-setup@0e279bb959325dab635dd2c09392533439d90093 # v6.0.8
87-
88- - uses : nrwl/nx-set-shas@afb73a62d26e41464e9254689e1fd6122ee683c1 # v5
89-
90- - uses : actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
91- with :
92- cache : " pnpm"
93- cache-dependency-path : " **/pnpm-lock.yaml"
94- node-version-file : " .nvmrc"
95-
96- - name : Cache NX
97- uses : actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5
98- with :
99- path : .nx/cache
100- key : nx-playwright-${{ env.NX_BRANCH }}-${{ env.NX_RUN_GROUP }}-${{ github.sha }}
101- restore-keys : |
102- nx-playwright-${{ env.NX_BRANCH }}-${{ env.NX_RUN_GROUP }}-
103- nx-playwright-${{ env.NX_BRANCH }}-
104- nx-
105-
106- - name : Install dependencies
107- run : pnpm install
108-
109- - name : Build packages
110- run : pnpm run build
111-
112- - name : Upload build artifacts
113- uses : actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
114- with :
115- name : playwright-build
116- path : |
117- packages/*/dist
118- playground/dist
119- retention-days : 1
120-
121- playwright :
122- name : " Playwright Tests - ${{ matrix.browser }} (${{ matrix.shardIndex }}/${{ matrix.shardTotal }})"
55+ run : vp dlx pkg-pr-new publish './packages/*' # TODO disabled only for AI branch--compact
56+
57+ e2e :
58+ # Vitest Browser Mode runs in the Playwright Linux container — the same
59+ # environment as the local Docker run — so behaviour matches local dev.
60+ # The suite resolves every `@blocknote/*` import to its `src/` via the
61+ # aliases in `tests/vite.config.browser.ts` (vite transpiles the package
62+ # sources on the fly), so the packages do NOT need to be built to `dist`
63+ # first — `vp install` + the checked-out sources are enough.
64+ name : " E2E - ${{ matrix.browser }} (${{ matrix.shardIndex }}/${{ matrix.shardTotal }})"
12365 runs-on : ubuntu-latest
124- needs : playwright-build
12566 timeout-minutes : 30
12667 container :
127- image : mcr.microsoft.com/playwright:v1.51.1 -noble
68+ image : mcr.microsoft.com/playwright:v1.60.0 -noble
12869 strategy :
12970 fail-fast : false
13071 matrix :
13172 browser : [chromium, firefox, webkit]
13273 shardIndex : [1, 2]
13374 shardTotal : [2]
13475 steps :
135- - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
76+ - uses : actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
13677 with :
13778 fetch-depth : 100
13879 persist-credentials : false
13980
140- - name : Install pnpm
141- uses : pnpm/action-setup@0e279bb959325dab635dd2c09392533439d90093 # v6.0.8
142-
143- - uses : actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
81+ - uses : voidzero-dev/setup-vp@2dec1e33f4ab2c6d5bce1b0c4607961bb1a3f7a1 # v1
14482 with :
145- cache : " pnpm"
146- cache-dependency-path : " **/pnpm-lock.yaml"
147- node-version-file : " .nvmrc"
148-
149- - name : Download build artifacts
150- uses : actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
151- with :
152- name : playwright-build
83+ node-version-file : " .node-version"
84+ cache : true
15385
15486 - name : Install dependencies
155- run : pnpm install
156-
157- - name : Run server and Playwright tests
158- run : |
159- HOME=/root PLAYWRIGHT_CONFIG="--project ${{ matrix.browser }} --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }}" pnpm run e2e
87+ run : vp install
88+
89+ # No preview server: Vitest Browser Mode serves the tests + mounted example
90+ # apps itself. `--browser` selects this matrix job's browser and
91+ # `--shard=<index>/<total>` splits that browser's test files across two
92+ # parallel machines. Each shard records a machine-readable `blob` report
93+ # (named per browser+shard so they don't collide); the `merge-reports` job
94+ # stitches every browser's shards into one HTML report afterwards.
95+ - name : Run e2e tests (${{ matrix.browser }} ${{ matrix.shardIndex }}/${{ matrix.shardTotal }})
96+ run : HOME=/root vp test -c vite.config.browser.ts --run --browser ${{ matrix.browser }} --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} --reporter=default --reporter=blob --outputFile.blob=blob-report/blob-${{ matrix.browser }}-${{ matrix.shardIndex }}.json
97+ working-directory : tests
16098
161- - name : Upload blob report
99+ - name : Upload blob report (${{ matrix.browser }} ${{ matrix.shardIndex }}/${{ matrix.shardTotal }})
162100 uses : actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
163101 if : ${{ !cancelled() }}
164102 with :
165103 name : blob-report-${{ matrix.browser }}-${{ matrix.shardIndex }}
166104 path : tests/blob-report/
167105 retention-days : 1
168106
169- - name : Upload HTML report
107+ - name : Upload failure artifacts
170108 uses : actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
171- if : ${{ !cancelled () }}
109+ if : ${{ failure () }}
172110 with :
173- name : playwright-report -${{ matrix.browser }}-${{ matrix.shardIndex }}
174- path : tests/playwright-report /
175- retention-days : 30
111+ name : e2e-attachments -${{ matrix.browser }}-${{ matrix.shardIndex }}
112+ path : tests/.vitest-attachments /
113+ retention-days : 7
176114
177115 merge-reports :
178- name : " Merge Playwright Reports"
179- if : ${{ !cancelled() }}
180- needs : playwright
116+ # Stitch every browser+shard blob report into a single navigable HTML
117+ # report (the Vitest equivalent of `playwright merge-reports`). Runs even
118+ # when a shard failed, so the report always covers every browser.
119+ name : " E2E Report"
181120 runs-on : ubuntu-latest
121+ needs : e2e
122+ if : ${{ !cancelled() }}
123+ timeout-minutes : 15
124+ # Same container as the e2e shards: `--mergeReports` doesn't run tests or
125+ # launch browsers, but the HTML reporter still resolves the test files'
126+ # browser environment, so the browser config must stay enabled (and present).
127+ container :
128+ image : mcr.microsoft.com/playwright:v1.60.0-noble
182129 steps :
183- - uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
130+ - uses : actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
184131 with :
132+ fetch-depth : 100
185133 persist-credentials : false
186134
187- - name : Install pnpm
188- uses : pnpm/action-setup@0e279bb959325dab635dd2c09392533439d90093 # v6.0.8
189-
190- - uses : actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6
135+ - uses : voidzero-dev/setup-vp@2dec1e33f4ab2c6d5bce1b0c4607961bb1a3f7a1 # v1
191136 with :
192- cache : " pnpm"
193- cache-dependency-path : " **/pnpm-lock.yaml"
194- node-version-file : " .nvmrc"
137+ node-version-file : " .node-version"
138+ cache : true
195139
196140 - name : Install dependencies
197- run : pnpm install
141+ run : vp install
198142
143+ # Gather every shard's blob into one directory (blob-report-chromium-1, …).
199144 - name : Download blob reports
200145 uses : actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
201146 with :
202- path : tests/all- blob-reports
147+ path : tests/blob-report
203148 pattern : blob-report-*
204149 merge-multiple : true
205150
206- - name : Merge reports
207- run : npx playwright merge-reports --reporter html ./all-blob-reports
151+ # Re-emit a single HTML report from the merged blobs (no tests are run).
152+ - name : Merge into HTML report
153+ run : HOME=/root vp test -c vite.config.browser.ts --mergeReports=blob-report --reporter=html
208154 working-directory : tests
209155
210156 - name : Upload merged HTML report
211157 uses : actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
158+ if : ${{ !cancelled() }}
212159 with :
213- name : playwright -report-merged
160+ name : e2e -report
214161 path : tests/playwright-report/
215- retention-days : 30
162+ retention-days : 7
163+
164+ deploy-report :
165+ # Publish the merged report to a GitHub Pages PR preview and comment the
166+ # link on the PR (Vercel-style). Pages serves it over HTTP, so the report's
167+ # data loads correctly — unlike opening the downloaded artifact over file://
168+ # (the @vitest/ui report fetches its data and is blocked by CORS there).
169+ #
170+ # Default `needs` semantics: this runs only when `merge-reports` succeeded
171+ # (i.e. a report exists) — but regardless of whether the tests passed, so a
172+ # red run still gets a navigable preview. Skipped for fork PRs, whose
173+ # read-only token can't push to gh-pages or comment (they keep the artifact).
174+ name : " E2E Report Preview"
175+ runs-on : ubuntu-latest
176+ needs : merge-reports
177+ if : ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository }}
178+ permissions :
179+ contents : write
180+ pull-requests : write
181+ steps :
182+ - uses : actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6
183+ with :
184+ persist-credentials : false
185+
186+ - name : Download merged report
187+ uses : actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
188+ with :
189+ name : e2e-report
190+ path : e2e-report
191+
192+ # Deploys to the `gh-pages` branch under `pr-preview/pr-<N>/` and posts a
193+ # sticky comment with the URL. The companion `pr-preview-cleanup` workflow
194+ # removes it when the PR closes.
195+ - name : Deploy report to PR preview
196+ uses : rossjrw/pr-preview-action@ffa7509e91a3ec8dfc2e5536c4d5c1acdf7a6de9 # v1
197+ with :
198+ source-dir : e2e-report
199+ preview-branch : gh-pages
200+ umbrella-dir : pr-preview
201+ action : deploy
0 commit comments