mirror of
https://github.com/gradle/actions.git
synced 2026-08-22 05:42:51 +00:00
Render configuration-cache status in the caching Job Summary (#989)
Render the configuration-cache restore-state in the caching Job Summary, driven by the new `CacheReport.configurationCache` field produced by the `gradle-actions-caching` provider. ## What's here - `cache-service.ts`: add a `ConfigurationCacheStatus` type (`not-active` / `restored` / `not-restored` / `restore-incomplete`) and an optional `configurationCache` field on `CacheReport`. - `caching-report.ts`: a `CONFIG_CACHE_COPY` map and a prominent status line in `renderCachingReport`, beside the cleanup line. The `not-active` case links to the `#cache-encryption-key` docs. ## Cross-repo dependency The field is populated by gradle/actions-caching PR #75 ("Restore configuration-cache support for simple builds"). This rendering compiles independently (it uses this repo's own `CacheReport` type) and renders nothing until the vendored `gradle-actions-caching` bundle is refreshed from that branch — so this should land with/after the vendor refresh. ## Verification `npm run check` clean; full Jest suite (366 tests) passes, including 3 new rendering tests. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
3f131e8634
commit
e993c93d71
@@ -79,6 +79,39 @@ describe('renderCachingReport', () => {
|
||||
expect(md).toContain('<summary>Entries: 1 restored, 0 saved - Expand for more details</summary>')
|
||||
})
|
||||
|
||||
it('renders the configuration-cache status line inside the details', () => {
|
||||
const report: CacheReport = {
|
||||
status: 'enabled',
|
||||
cleanup: 'enabled',
|
||||
configurationCache: 'restored',
|
||||
entries: [entry()]
|
||||
}
|
||||
const md = renderCachingReport(report, ENHANCED)
|
||||
|
||||
const detailsBody = md.slice(md.indexOf('</summary>'))
|
||||
expect(detailsBody).toContain('Configuration cache state was restored from the cache.')
|
||||
})
|
||||
|
||||
it('explains an inactive configuration cache with a link to the encryption key docs', () => {
|
||||
const report: CacheReport = {
|
||||
status: 'enabled',
|
||||
cleanup: 'enabled',
|
||||
configurationCache: 'not-active',
|
||||
entries: [entry()]
|
||||
}
|
||||
const md = renderCachingReport(report, ENHANCED)
|
||||
|
||||
expect(md).toContain('Configuration cache state was not cached')
|
||||
expect(md).toContain('#cache-encryption-key')
|
||||
})
|
||||
|
||||
it('omits the configuration-cache line when the status is absent', () => {
|
||||
const report: CacheReport = {status: 'enabled', cleanup: 'enabled', entries: [entry()]}
|
||||
const md = renderCachingReport(report, ENHANCED)
|
||||
|
||||
expect(md).not.toContain('Configuration cache state')
|
||||
})
|
||||
|
||||
it('renders a compact disabled report with no note and no details', () => {
|
||||
const report: CacheReport = {status: 'disabled', entries: []}
|
||||
const md = renderCachingReport(report, undefined)
|
||||
|
||||
Reference in New Issue
Block a user