Merge pull request #72 from DorkSquadRR/ci/client-only-push-builds

ci: build on push only for client-facing changes
This commit is contained in:
Alexa
2026-10-25 14:32:39 +02:00
committed by GitHub
2 changed files with 35 additions and 13 deletions
Vendored
+21 -10
View File
@@ -9,8 +9,9 @@
// from the agent's environment (ARCHIVE_PC_REPO / ARCHIVE_QUEST_REPO), each // from the agent's environment (ARCHIVE_PC_REPO / ARCHIVE_QUEST_REPO), each
// overridable per run. A build is picked by snapshot tags. // overridable per run. A build is picked by snapshot tags.
// //
// On a push, only the platforms whose code changed are rebuilt. A manual run // A push builds only the platforms whose client code changed (never for
// picks the platforms with PLATFORMS. See ci/jenkins/README.md. // docs or CI-only changes). A manual run picks the platforms with PLATFORMS.
// See ci/jenkins/README.md.
// //
// Finished builds are renamed for players and published to the downloads bucket // Finished builds are renamed for players and published to the downloads bucket
// (ci/downloads) unless PUBLISH_DOWNLOADS is off. The build scripts keep their // (ci/downloads) unless PUBLISH_DOWNLOADS is off. The build scripts keep their
@@ -76,10 +77,15 @@ pipeline {
for (cs in currentBuild.changeSets) { for (cs in currentBuild.changeSets) {
for (entry in cs.items) changed.addAll(entry.affectedPaths) for (entry in cs.items) changed.addAll(entry.affectedPaths)
} }
def touches = { prefixes -> changed.any { p -> prefixes.any { p.startsWith(it) } } } // Only client-facing changes rebuild (and so republish) a
def common = ['Jenkinsfile', 'ci/jenkins/'] // platform; Markdown (.md, .markdown) doesn't count. The job's Git path filter
buildPc = touches(common + ['DorkNet.ClientMod/', 'tools/build_pc.py']) // uses the same paths, so other pushes don't start a run at all.
buildQuest = touches(common + ['DorkNet.Quest/']) // A CI-only change (Jenkinsfile, ci/) takes a manual run.
def touches = { prefixes ->
changed.any { p -> !(p.toLowerCase() ==~ /.*\.(md|markdown)/) && prefixes.any { p.startsWith(it) } }
}
buildPc = touches(['DorkNet.ClientMod/', 'tools/build_pc.py'])
buildQuest = touches(['DorkNet.Quest/'])
echo "Push build; ${changed.size()} changed file(s)" echo "Push build; ${changed.size()} changed file(s)"
} else { } else {
buildPc = params.PLATFORMS in ['both', 'pc'] buildPc = params.PLATFORMS in ['both', 'pc']
@@ -220,10 +226,15 @@ pipeline {
archiveArtifacts artifacts: 'out/downloads/**', allowEmptyArchive: true, fingerprint: true archiveArtifacts artifacts: 'out/downloads/**', allowEmptyArchive: true, fingerprint: true
} }
cleanup { cleanup {
// Runs after archiving. Keeps the restic cache and restored stock // Runs after archiving. Drops the build output and scratch (several
// builds ($DORKNET_CACHE on the agent, outside the workspace); drops // GB) but keeps the Git checkout: the job's path filter compares
// the workspace's build output and scratch. // pushes against it, and without a workspace Jenkins treats every
cleanWs(deleteDirs: true, notFailBuild: true) // push as a change and starts a run. The restic cache and restored
// stock builds live outside the workspace ($DORKNET_CACHE).
cleanWs(deleteDirs: true, notFailBuild: true, patterns: [
[pattern: 'out/**', type: 'INCLUDE'],
[pattern: 'quest-work/**', type: 'INCLUDE'],
])
} }
} }
} }
+14 -3
View File
@@ -60,10 +60,21 @@ Resolve a table for another build locally with `build.py build --dump-cs`.
## Triggers ## Triggers
- **Push** to the branch (GitHub webhook) rebuilds only what changed: - **Push** to the branch (GitHub webhook) builds only for client-facing
- `DorkNet.ClientMod/` and the PC scripts rebuild PC; changes, and only the platform they touch:
- `DorkNet.ClientMod/` and `tools/build_pc.py` rebuild PC;
- `DorkNet.Quest/` rebuilds Quest; - `DorkNet.Quest/` rebuilds Quest;
- `Jenkinsfile` and `ci/jenkins/` rebuild both. - Markdown files (`.md`, `.markdown`) never count; server, docs and CI-only pushes (including
the `Jenkinsfile` and `ci/`) build nothing. Run those manually.
Set the same filter on the job so other pushes don't start a run at all:
under the job's **Git** source, add **Additional Behaviours → Polling
ignores commits in certain paths** with included regions
`DorkNet[.]ClientMod/.*`, `DorkNet[.]Quest/.*`, `tools/build_pc[.]py` (one
per line) and excluded region `.*[.](md|markdown)`. The filter compares against the
last build's checkout, so the pipeline keeps it and deletes only `out/`
and its scratch folders after each run; without a checkout, Jenkins treats
every push as a change.
- **Build with Parameters** runs a manual build: - **Build with Parameters** runs a manual build:
- `PLATFORMS` (both / pc / quest), and `PC_FULL_CLIENT` for the full PC client; - `PLATFORMS` (both / pc / quest), and `PC_FULL_CLIENT` for the full PC client;
- snapshot tags, and per-run repository overrides; - snapshot tags, and per-run repository overrides;