ci: cache API compatibility production compilation - #833
Closed
jbeckwith-oai wants to merge 1 commit into
Closed
Conversation
There was a problem hiding this comment.
Pull request overview
This PR optimizes the API compatibility CI job by re-enabling Gradle build cache for normal production compilation while ensuring the API compatibility fixture compilations still always execute (never up-to-date and never cacheable). This reduces required-CI wall time without weakening the “fail closed” behavior of the compatibility detector.
Changes:
- Remove the global
--no-build-cachefrom the API compatibility detector Gradle invocation. - Add an init-script policy to force the compatibility compilation tasks to always run and to never use the build cache.
- Add a
buildSrcregression test (with proper task inputs) to guard this cache-safety boundary.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
scripts/detect-breaking-changes |
Keeps build cache enabled for production compilation, while forcing compatibility compilation tasks to be non-cacheable and never up-to-date. |
buildSrc/src/test/kotlin/com/openai/gradle/ApiCompatibilityCachePolicyTest.kt |
Adds a regression test to ensure the detector script retains the intended caching policy. |
buildSrc/build.gradle.kts |
Configures the buildSrc test task to track the detector script as an input so changes invalidate test up-to-date checks. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Why
The API compatibility job is frequently on the required-CI critical path. Its global
--no-build-cacheflag forced the large production Kotlin compilation to rerun even when an identical content-addressed result was available. Compatibility fixtures still need fresh compilation, but that does not require disabling caching for the entire build.Local measurement
With relevant module outputs removed before each run on the same commit:
The restoration run reported both production Kotlin compilations
FROM-CACHE, whilecompileExternalApiCompatibilityKotlinandcompileProposedApiCompatibilityKotlinboth executed normally.CI experiment result
The first PR run completed the API compatibility job in 10m54s, effectively unchanged from the 10–11 minute baseline. Although setup-gradle restored a default-branch cache, all 16 Gradle tasks executed and
openai-java-core:compileKotlintook about 6m24s. The restored entry came from the default-branchanalyzejob, where CodeQL intentionally runs with--no-build-cache, so it did not contain a matching production compilation result.This draft therefore does not yet meet the performance acceptance bar. It remains open to discuss whether explicit trusted cache seeding is worth its additional CI cost and cache-poisoning boundary; no review is requested yet.
Safety validation
Validation
bash -n scripts/detect-breaking-changes./scripts/gradle :buildSrc:test./scripts/lint./scripts/test