Skip to content

CI: keep finished native builds in a release, so they're never built again for the same inputs - #34

Merged
lithiumtoast merged 1 commit into
mainfrom
native-builds-store
Dec 1, 2026
Merged

lithiumtoast merged 1 commit into
mainfrom
native-builds-store

Conversation

@lithiumtoast

Copy link
Copy Markdown
Member

Actions caches are deleted after 7 days unused, and a branch can only read its own and the default branch's. So a quiet week, or any change to a cache's key, means building SDL_shadercross again: about 40 minutes on a scarce macOS runner. This keeps every finished native build where it doesn't expire.

The store

  • ext/native-store.sh keeps each platform's finished build of SDL or SDL_shadercross as a .tar.gz asset of one pre-release, native-builds, named after a hash of its inputs: for example shadercross-native-osx-<hash>.tar.gz.
  • Release assets don't expire, and every branch can read them. A .tar.gz also keeps the tool's executable permission.
  • The script creates the release the first time it uploads. It's marked as a pre-release and says it isn't a release of this repository.

The workflows

  • sdl-native.yml and shadercross-native.yml look for each platform in the store first, then in an Actions cache, and only then build it.
  • Writing: runs on the default branch put builds into the store, including ones they found only in a cache, so existing caches move into the store without building again. Pull requests only read the store, so code that wasn't reviewed never puts binaries there.
  • SDL now builds and caches each platform on its own, like SDL_shadercross. It reads its old combined cache (sdl-native-all-...) once more, so the store gets SDL without building it again. That part can go once the store has this SDL commit.
  • Permissions: main.yml gives both native workflows contents: write, for the store, and actions: read, to list caches.

Checked

  • ext/native-store.sh: asset-name, has against the real repository (no release yet) and an unknown command. upload and download first run on main, since pull requests don't write.
  • Both lookup steps, run locally against the real repository: SDL finds all six platforms in the combined cache, so no SDL builds, macOS included. SDL_shadercross finds main's new caches, saved by main's run after bottlenoselabs.SDL.ShaderCross.Native: the SDL_shadercross library for apps #32, which finished before this PR was opened.
  • actionlint.

After merging: main's next run uploads all eleven builds (6 SDL, 5 SDL_shadercross) from the caches into the store. After that, a build only happens when its inputs change.

To watch at the next release: whether GitHub's automatic release notes compare against the native-builds pre-release instead of the previous version.

…again for the same inputs

ext/native-store.sh keeps each platform's finished SDL and SDL_shadercross build as a .tar.gz asset of one release, native-builds, named after a hash of its inputs. Release assets don't expire after 7 days unused like Actions caches, and every branch can read them, so macOS runners are only needed when an input changes.

sdl-native.yml and shadercross-native.yml look in the store first, then the Actions cache, then build. Runs on the default branch put builds into the store, including ones found only in a cache; pull requests only read it. SDL now builds and caches each platform on its own, like SDL_shadercross, and reads its old combined cache once to fill the store without building again.
@lithiumtoast
lithiumtoast merged commit f4dfba4 into main Dec 1, 2026
29 checks passed
@lithiumtoast
lithiumtoast deleted the native-builds-store branch December 1, 2026 01:53
lithiumtoast added a commit that referenced this pull request Dec 1, 2026
CI's `main` runs took about 8 minutes, set by the Windows build at about
7. Most of that repeated tests whose result doesn't depend on the
operating system.

**What runs where**

| | Linux | Windows, macOS |
| --- | --- | --- |
| Console, web API and game consumers (NativeAOT, platform packaging,
SDL loading) | yes | yes |
| WebAssembly web app publish | yes | no, same output everywhere |
| Templates: create, build, publish and run the template's game | yes |
no, same output everywhere; the game consumers cover packaging |
| Assetyard's test, with the OS's own SDL_shadercross | yes | yes, new:
the packaged tool used to run only on Linux |
| `cs-game-publish.yml` on the game consumer | yes | no; `test.sh`
already publishes it on each OS |

- **`test.sh`** gets `TEST_SCOPE`: `all`, the default and what local
runs get, or `platform`, which Windows and macOS use in CI.
- **Assetyard's test** now works on Windows: its `nuget.config` gets
native paths (`pwd -W`), and its error check doesn't depend on the
path's slashes.
- **`main.yml`'s build script** is now a multi-line block, one command
per line, with comments.

**No CI for docs-only pull requests:** `paths-ignore` for `**/*.md` and
`docs/**`, on pull requests only. Pushes to `main` always run CI,
because a release needs `main`'s run to have passed for its commit.

**Also**
- SDL's combined-cache code is gone. The store (#34) has all six SDL
builds for the current SDL commit.
- The shorter native job names from #34 are back. That commit was left
out when #34 was squash-merged, because GitHub never synced the PR with
its last push.
- A shellcheck warning in `test.sh` (a glob used as a command name) is
fixed.

**Not done:** one job per library for stored builds instead of one per
platform. A workflow can't loop over `upload-artifact` or
`cache/restore`, so it would take about a dozen repeated steps per
workflow, to save jobs that already run in parallel in 10–20 seconds
each.

**Expected:** Windows build about 7 → 4 minutes, macOS about 4.5 → 2.5,
a `main` run about 8 → 5. `main` runs also have one macOS job fewer.

**Checked locally on macOS:** `TEST_SCOPE=platform` runs the three
consumers and skips the rest, `TEST_SCOPE=all` behaves as before, and
Assetyard's test passes. All workflows pass `actionlint`.

---------

Co-authored-by: Lucas Girouard-Stranks <lithiumtoast@users.noreply.github.com>
lithiumtoast added a commit that referenced this pull request Dec 1, 2026
`v2026.12.1-rc`'s notes compared `native-builds...v2026.12.1-rc` and
listed only #35. GitHub's generated notes start from the newest release
of any tag, and the `native-builds` pre-release (#34) is a release too.
(I've already edited that release's notes to compare against
`v2026.11.30-rc.3`; they now list #27 through #35.)

**The fix, in the `cs-release` action:** a new "Release notes" step
finds the newest non-draft release whose tag starts with `v`, asks
GitHub's `generate-notes` API for the notes since then, and passes them
to the release with `body_path` instead of `generate_release_notes`.
Other repositories using the action get the same behaviour, so releases
with other tags never break their notes. With no earlier `v` release,
GitHub's default is used.

**Checked:** the step's query, run against this repository, picks
`v2026.12.1-rc` as the previous release. `generate-notes` only returns
text; it creates nothing. `actionlint` passes, and `docs/workflows.md`
says where the notes start.

The step only runs when the action pushes, so this PR's CI release dry
run skips it. The next release is its first real run.

Co-authored-by: Lucas Girouard-Stranks <lithiumtoast@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant