File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -187,8 +187,14 @@ async function main() {
187187 core . exportVariable ( 'ZIG_LOCAL_CACHE_DIR' , cache_path ) ;
188188
189189 if ( core . getBooleanInput ( 'use-cache' ) ) {
190- core . info ( 'Attempting restore of Zig cache' ) ;
191- await cache . restoreCache ( [ cache_path ] , await common . getCachePrefix ( ) ) ;
190+ const cache_prefix = await common . getCachePrefix ( ) ;
191+ core . info ( `Attempting restore of Zig cache with prefix '${ cache_prefix } '` ) ;
192+ const hit = await cache . restoreCache ( [ cache_path ] , cache_prefix ) ;
193+ if ( hit === undefined ) {
194+ core . info ( `Cache miss: leaving Zig cache directory at ${ cache_path } unpopulated` ) ;
195+ } else {
196+ core . info ( `Cache hit (key '${ hit } '): populating Zig cache directory at ${ cache_path } ` ) ;
197+ }
192198 }
193199 } catch ( err ) {
194200 core . setFailed ( err . message ) ;
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ async function main() {
1818 }
1919
2020 if ( accessible ) {
21- core . info ( ' Checking cache size' ) ;
21+ core . info ( ` Checking size of cache directory at ${ cache_path } ` ) ;
2222 const size = await dirSize ( cache_path ) ;
2323 const size_limit = core . getInput ( 'cache-size-limit' ) * 1024 * 1024 ; // MiB -> bytes
2424 if ( size_limit !== 0 && size > size_limit ) {
@@ -33,7 +33,7 @@ async function main() {
3333
3434 const prefix = await common . getCachePrefix ( ) ;
3535 const name = `${ prefix } ${ github . context . runId } -${ github . context . runAttempt } ` ;
36- core . info ( ' Saving Zig cache' ) ;
36+ core . info ( ` Saving Zig cache with key ' ${ name } '` ) ;
3737 await cache . saveCache ( [ cache_path ] , name ) ;
3838 } else {
3939 core . info ( 'Zig cache directory is inaccessible; nothing to save' ) ;
@@ -49,14 +49,18 @@ async function dirSize(dir_path) {
4949 let total = 0 ;
5050 for ( const ent of await fs . readdir ( dir_path , { withFileTypes : true , recursive : true } ) ) {
5151 if ( ent . isFile ( ) ) {
52+ const p = path . join ( ent . parentPath , ent . name ) ;
5253 try {
53- const stat = await fs . stat ( path . join ( ent . parentPath , ent . name ) ) ;
54+ const stat = await fs . stat ( p ) ;
5455 total += stat . size ;
55- } catch { }
56+ } catch {
57+ core . warning ( `Failed to stat ${ p } : ${ err } ` ) ;
58+ }
5659 }
5760 }
5861 return total ;
59- } catch {
62+ } catch ( err ) {
63+ core . warning ( `Failed to compute size of '${ dir_path } ': ${ err } ` ) ;
6064 return 0 ;
6165 }
6266}
You can’t perform that action at this time.
0 commit comments