Skip to content

ci: on a PR, build only the packages a push can affect - #25

Merged
th3r-dev merged 3 commits into
devfrom
ci/skip-unchanged-builds
Nov 12, 2026
Merged

th3r-dev merged 3 commits into
devfrom
ci/skip-unchanged-builds

Conversation

@th3r-dev

Copy link
Copy Markdown
Owner

On PR #24, a one-file fix ran all three package builds again, though Windows and Android had already passed. With this PR, a package that already passed on the PR is built again only when a file it builds from has changed since.

How it decides

A new changes job runs tools/ci/changed-jobs.sh. On a pull request, a package is skipped only when both hold:

  1. It passed on this PR before, at some commit S. Only an actual build counts, never a skip, so reuse doesn't chain.
  2. No file it builds from changed between S and the commit this run builds.
Package Builds from
all three Cargo.toml/Cargo.lock, crates/proto, crates/app/assets (the Mac host inlines the page), the workflow, tools/ci
macos + crates/host, tools/package-macos.sh, tools/macos
windows + crates/app's src, build.rs, Cargo.toml
android + all of crates/app (Kotlin, launcher icons, Dioxus.toml), crates/host, tools/build-android.sh

Safety rules:

  • Compared against the merge commit: changes dev gained since S count too, so a skip is never wrong. At worst it rebuilds more than needed.
  • Falls back to building everything if S is gone (a force push) or GitHub's API fails.
  • Releases always build all three: pushes to dev, tags and manual runs, because each release stamps a new version into every package.
  • Every run says what it did: the changes job's summary lists each package as built or reused, and links the run where a reused one passed. Its package can be downloaded there.

Changes only to docs/ or brand/ no longer start a run, the same as Markdown.

About #24's case: that fix was in crates/proto, which all three packages compile, so this PR would still rebuild all three for it. The saving is for changes that touch one platform's files.

Testing

Dry run of the script against PR #24's real runs, using throwaway one-file commits:

Change macos windows android
same content as the last pass reuse reuse reuse
Kotlin (Share.kt) reuse reuse build
app source (main.rs) reuse build build
tools/package-macos.sh build reuse reuse
crates/host build reuse build
page CSS or crates/proto build build build
docs reuse reuse reuse
a push to dev build build build

Still to show: on this PR, the first run builds all three. A second push that touches only a Mac file should build only macos.

On PR #24, a one-file fix ran all three package builds again, though two had
already passed. Now a new "changes" job (tools/ci/changed-jobs.sh) decides per
package. On a pull request a package is skipped when:
- it passed on this PR before, at some commit S (an actual build: a skip never
  counts, so reuse doesn't chain), and
- no file it builds from changed between S and this run's merge commit.

What each package builds from:
- all three: Cargo.toml/lock, crates/proto, crates/app/assets (the Mac host
  inlines the page), this workflow and tools/ci.
- macos: crates/host, tools/package-macos.sh, tools/macos.
- windows: crates/app's src, build.rs and Cargo.toml.
- android: crates/app (Kotlin, launcher icons and Dioxus.toml too),
  crates/host, tools/build-android.sh.

Diffing against the merge commit also counts what dev gained since S, so a
skip is never wrong; at worst it rebuilds more than needed. If S is gone (a
force push) or GitHub's API fails, everything builds. Pushes to dev, tags and
manual runs build everything: each release stamps a new version into all
three packages. The changes job's summary says, per package, built or reused,
and links the run where it passed.

Changes only to docs/ or brand/ no longer start a run, as with Markdown.

Dry run against PR #24's runs, with a one-file change each:
- Kotlin: android only.
- App source: windows and android.
- The page's CSS or proto: all three.
- docs: none.
- tools/package-macos.sh: macos only.
- A push to dev: all three.
@sonarqubecloud

Copy link
Copy Markdown

❌ The last analysis has failed.

See analysis details on SonarQube Cloud

@th3r-dev

Copy link
Copy Markdown
Owner Author

Evidence on this PR

Push Changed changes macos windows android
run 43100705171 first run on the PR (no earlier pass) ✅ built ✅ built ✅ built ✅
run 43101343613 only tools/package-macos.sh ✅ built ✅ skipped skipped

The second run's changes summary links run 43100705171 as the one where windows and android passed, at the same inputs.

The first run (43096030201) was never scheduled: GitHub left it queued with no jobs. That was the same Actions trouble that hung the dev release, and an empty commit started a fresh run.

@th3r-dev
th3r-dev merged commit 1fd45ae into dev Nov 12, 2026
6 of 7 checks passed
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