ci: build core SDK once and share Maven Local across kit matrix - #747
ci: build core SDK once and share Maven Local across kit matrix#747jamesnrokt wants to merge 2 commits into
Conversation
All 22 build-kits matrix jobs ran ./gradlew publishMavenPublicationToMavenLocal, rebuilding the same core SDK 22 times per run. Add a single publish-core job that runs the publish once, archives ~/.m2/repository (1.2 MB), and uploads it as an artifact. The matrix jobs now download and untar it into $HOME/.m2 instead of rebuilding. The root publish emits exactly four coordinates - android-core, android-kit-base, android-kit-plugin and android-plugin - plus their maven-metadata-local.xml. Nothing else writes to ~/.m2/repository (Gradle's dependency cache lives in ~/.gradle), so archiving the whole repository dir cannot miss anything. KitPlugin restricts mavenLocal() to includeGroup 'com.mparticle' and excludes that group from Maven Central, so those four are precisely what the kit builds need. Also quote $GITHUB_ENV to satisfy shellcheck SC2086, which the pre-existing step tripped. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
PR SummaryLow Risk Overview A new Matrix jobs start only after Reviewed by Cursor Bugbot for commit 83df1ba. Bugbot is set up for automated code reviews on this repo. Configure here. |
The semgrep security check blocks unpinned action refs. Pin the two new uses to commit SHAs: actions/upload-artifact 043fb46 (v7.0.1) actions/download-artifact 37930b1 (v7.0.0) Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Summary
All 22
build-kitsmatrix jobs each ran./gradlew publishMavenPublicationToMavenLocal, rebuilding the identical core SDK 22 times per workflow run.This adds a single
publish-corejob that does the publish once, archives~/.m2/repository, and uploads it as an artifact. The matrix jobs download and untar it into$HOME/.m2instead of rebuilding.Changes
publish-corejob: publishes core SDK →tar -czf maven-local.tar.gz→ uploads asmaven-local-core(1-day retention,compression-level: 0since the tar is already gzipped).build-kitsnowneeds: [load-matrix, publish-core]; its Gradle publish step is replaced by download + untar.$GITHUB_ENVto satisfy shellcheck SC2086, which the pre-existing step tripped.Why the artifact is complete
The root publish emits exactly four coordinates —
android-core,android-kit-base,android-kit-plugin,android-plugin— plus theirmaven-metadata-local.xml. Nothing else writes to~/.m2/repository(Gradle's dependency cache lives in~/.gradle), so archiving the wholerepositorydir can't miss anything.KitPluginrestrictsmavenLocal()toincludeGroup 'com.mparticle'and excludes that group from Maven Central, so those four are precisely what kit builds need from there.Testing
Published to an isolated repo at throwaway version
6.0.0-citest, tarred (1.2 MB), restored, and confirmeddiff -ridentical. Then built both consumer paths against only the restored copy via-Dmaven.repo.local::kits:android-adjust:adjust-5:testRelease(settings-kits.gradle) — BUILD SUCCESSFUL:kits:android-adjust:adjust-5:example-kotlin:assembleDebug(settings-kit-examples.gradle) — BUILD SUCCESSFULSince
6.0.0-citestexists nowhere else, resolution demonstrably came from the tarball.trunk checkclean on the changed file.Only
adjust-5was exercised locally; the other 21 kits resolvecom.mparticle:*through the sameKitPluginmechanism, so this PR's own workflow run is the real proof.Trade-off
Matrix jobs now wait on
publish-corebefore starting, but this drops 21 core SDK builds. The publish is ~22s warm locally and several minutes cold on a runner with no Gradle cache.Not included
Deliberately out of scope, happy to follow up:
pull-request.yml(lint, kotlin-lint, kit-compatibility) anddaily.yml— 6 more redundant core builds, two onmacos-latestat 10× billing.build-kits.ymlhas no Gradle caching at all, so every matrix job still cold-downloads third-party dependencies. Likely a bigger win than this change, but needs a decision on cache-write scoping.🤖 Generated with Claude Code