Repository navigation
Commit 616d734
ci: split into two jobs and embed the render preview (#16)
* ci: fold the preview into the main workflow
Two workflow files, two builds, two browsers, and two places to look when
something breaks. The preview was not decoration either — the tests prove the
geometry is computed right and cannot show whether the result looks like
anything a person would want to read. That needs an image, so it belongs in the
same pipeline as the assertions and fails the same way.
One file now, one job:
format → types → coverage → build → UI tests → render → post
Branches to master skip the last three: a push to master has no pull request to
comment into.
The job keeps a single checkout, install and build instead of two, and the
timeout goes from 10 to 15 minutes to leave room for the browser the preview now
needs after the UI suite has already started one.
Permissions are declared at job level, which means the earlier steps inherit
them. That is a real trade-off — narrowest scope would be a separate job — but
it costs a second checkout/install/build and this repository's steps are all its
own code.
render-preview.yml is deleted; its history stays queryable in the Actions tab.
* ci: upload the preview unzipped, and drop the browser probe
The artifact link in the comment is the only way to look at the render when
inline embedding is unavailable, and until now clicking it downloaded a zip
containing one PNG.
GitHub added unzipped artifacts in February: `actions/upload-artifact` v7 with
`archive: false` stores the file as-is, so a browser that can display the type
opens it directly. That turns the link from "download, unzip, look" into "look".
scripts/probe-browser.ts is deleted. It existed to prove a browser was available,
that text could be measured, and that screenshots were deterministic — all three
are now exercised on every run by the UI suite and the preview script. What it
left behind was a fourth copy of the Chromium launch flags, and a stale copy at
that: the missing `--user-data-dir` was fixed in the preview script while this
one sat unchanged, which is exactly the failure mode that copying causes.
* ci: the accidental /zip endpoint returns the PNG now
`gh run download` fails on non-zipped artifacts with 'zip: not a valid zip
file' — the CLI still assumes every artifact is an archive (cli/cli#13012).
`gh api .../artifacts/<id>/zip` returns the raw body, which for an unzipped
artifact is the PNG. Verified by downloading this run's artifact and checking
the file type.
* ci: embed the preview, don't link it
The comment has been linking to a file the reader had to fetch. Now it shows the
picture.
The URL had to be one GitHub serves as an image, and that ruled out everything
tried so far:
- artifacts need auth, and their URLs redirect to HTML
- release assets come back as `application/octet-stream` with
`Content-Disposition: attachment`, so they are treated as a download
- `gh --attach` needs the web upload endpoint, which an API token cannot call
A file on a branch is served by raw.githubusercontent.com as `image/png`. That is
the only form that renders, and it is what reg-actions and awesome-copilot both
document. The image is committed to a dedicated `render-preview` branch — force
pushed, one file, no history — from a scratch directory so the checked-out tree
is never touched.
`?v=<short sha>` busts the CDN cache, otherwise a re-render would show the
previous image for a few minutes.
This also removes the attach-and-fall-back dance entirely: there is no longer any
path where the comment posts without an image. The artifact upload stays, as a
30-day copy that does not depend on the branch.
* chore: trigger a render to measure branch growth
* ci: split into two jobs, tests and browser work
One job was wrong. The browser-only work forced `contents: write` onto every
step, including the ones that only read code and run assertions.
Two jobs now, each asking for what it uses:
checks format -> types -> test:coverage -> build (contents: read)
ui build -> test:ui -> render -> publish -> comment (contents: write)
The second builds its own dist/ rather than uploading and downloading it between
jobs — a round trip through an artifact is slower than the three seconds the
build takes.
Publishing also skips itself when the render is byte-identical to what the branch
already holds. Rendering is deterministic, so documentation-only pushes now leave
no dangling blob behind.
* ci(preview): say what the reader should actually do with the image
The comment explained what the pipeline was rather than what to look at. It now
says the image comes from the latest code on the branch, names the specific
failures worth scanning for, and links to the run that produced it.
* ci(preview): name the image after its commit
One shared `preview.png` meant every run overwrote the file that every earlier
comment pointed at. Open an old pull request and its screenshot had silently
become a picture of newer code.
The filename carries the full sha now, so a comment and the commit it describes
stay together. That also removes the `?v=` cache-buster — a new name is a new
URL.
The branch grows by one file per commit instead of staying at one, which is the
cost of not rewriting history. Worth watching; if it becomes noise, the old
approach of pruning to the last N is a small change.
* ci(preview): force-push the preview branch again
Keeping every preview meant keeping a commit per push, and a preview is useful
while the pull request is open and not much after. The old force-push behaviour
is right; the per-commit filename is what was actually needed.
The branch now holds one commit with one file, named after the commit it
renders. An old pull request whose commit has been garbage-collected shows a
broken image — clearly gone, rather than silently swapped for a newer picture,
which is what a shared filename did.
Also drops the clone-and-compare step: force-pushing a fresh repo is both
simpler and correct, since nothing is being appended to.
* ci(preview): warn that the image is not kept forever
The branch is force-pushed, so a preview survives until its commit is
garbage-collected. Say so where the image is, rather than leaving somebody to
discover it as a broken link months later.
* ci: collapse the duplicated sha variable and note the double build
COMMIT_SHA and FULL_SHA were both `github.event.pull_request.head.sha`. One
variable now, used whole for the filename and sliced for the prose.
The build in `checks` is intentional — the `ui` job rebuilds rather than
depending on this one and downloading dist/ through an artifact. The note was
only in the other job, where a reader looking at `checks` would not see it, so
it reads like duplication worth "fixing".
---------
Co-authored-by: hizzgdev(bot) <[email protected]>1 parent 6ec3197 commit 616d734
3 files changed
Lines changed: 178 additions & 424 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
18 | 21 | | |
19 | 22 | | |
20 | 23 | | |
21 | 24 | | |
22 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
23 | 31 | | |
24 | 32 | | |
25 | 33 | | |
| |||
42 | 50 | | |
43 | 51 | | |
44 | 52 | | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
| 53 | + | |
| 54 | + | |
49 | 55 | | |
50 | | - | |
51 | | - | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
52 | 60 | | |
53 | 61 | | |
54 | 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 | + | |
55 | 103 | | |
56 | 104 | | |
57 | 105 | | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
63 | 110 | | |
64 | 111 | | |
65 | 112 | | |
66 | 113 | | |
67 | | - | |
| 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 | + | |
This file was deleted.
0 commit comments