You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- name: Check regl precompiled shaders are up to date
672
+
run: |
673
+
# git add -N so newly-generated (untracked) shader files show up in git diff
674
+
git add -N src/generated/regl-codegen/
675
+
if ! git diff --exit-code \
676
+
src/generated/regl-codegen/ \
677
+
src/traces/scattergl/regl_precompiled.js \
678
+
src/traces/scatterpolargl/regl_precompiled.js \
679
+
src/traces/splom/regl_precompiled.js \
680
+
src/traces/parcoords/regl_precompiled.js; then
681
+
echo "::error::Regl precompiled shaders are out of date. Download the 'regl-codegen' artifact from this workflow run, extract it into src/, and commit the updated files to this pull request."
If you are implementing a new feature that involves regl shaders, or if you are
166
-
making changes that affect the usage of regl shaders, you would need to run
166
+
making changes that affect the usage of regl shaders, you will need to regenerate the precompiled regl shader code. In practice, that means edits under:
-`stackgl_modules/` (where the `regl-*` shader libs live)
171
+
-`devtools/regl_codegen/`
171
172
172
-
to regenerate the regl code. This will prompt you to open a browser window. This will then run through all
173
-
traces with 'regl' in the tags, and store the captured code into
174
-
[src/generated/regl-codegen](https://github.com/plotly/plotly.js/blob/master/src/generated/regl-codegen). If no updates are necessary, it will be a no-op, but if there are changes, you will need to commit them.
173
+
CI's `check-regl-codegen` job uses this same list as its trigger — see [`.github/workflows/ci.yml`](.github/workflows/ci.yml) for the authoritative version.
175
174
176
175
This is needed because regl performs codegen in runtime which breaks CSP
177
176
compliance, and so for strict builds we pre-generate regl shader code here.
178
177
178
+
The CI pipeline will automatically detect when regl-related files have changed and
179
+
run the codegen process. If the precompiled shaders are out of date, the
180
+
`check-regl-codegen` job will fail and upload a `regl-codegen` artifact containing
181
+
the updated files. The artifact represents the full desired state of the codegen
182
+
output (CI wipes the output directory before regenerating, so any orphaned shader
183
+
files are pruned). To fix this:
184
+
185
+
1. Download the `regl-codegen` artifact from the failed workflow run
186
+
2. Delete `src/generated/regl-codegen/` in your working tree, then unzip the
187
+
artifact into `src/` so it replaces (rather than merges into) the existing
188
+
directory. Note that `actions/upload-artifact` strips the longest common
189
+
parent path from the uploaded paths, so the zip's root contains
190
+
`generated/regl-codegen/` and `traces/{scattergl,scatterpolargl,splom,parcoords}/regl_precompiled.js`
191
+
directly — extracting into `src/` restores the correct layout and
192
+
overwrites the four `regl_precompiled.js` files in one step.
193
+
3. Commit and push the changes to your pull request
194
+
195
+
Alternatively, you can regenerate the code locally:
196
+
197
+
```bash
198
+
rm -rf src/generated/regl-codegen/*
199
+
npm run regl-codegen
200
+
```
201
+
202
+
The `rm -rf` step is needed to clean up any orphaned shader files left over from
203
+
previous changes. `npm run regl-codegen` will prompt you to open
204
+
a browser window, run through the mocks for each regl-using trace
205
+
(`parcoords`, `scattergl`, `scatterpolargl`, `splom`), and store the captured
0 commit comments