Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .github/actions/cache-go-dependencies/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,20 @@ runs:
find "$gocache" -mindepth 1 -type d -empty -delete 2>/dev/null || true;
after=$(du -sm "$gocache" 2>/dev/null | cut -f1);
echo "GOCACHE trimmed: ${before:-0}MB -> ${after:-0}MB (removed $((${before:-0} - ${after:-0}))MB)"

- name: Stabilize file mtimes for Go test cache
run: |
# Go's test cache validates inputs by (path, size, mtime) — NOT content.
# git checkout sets all mtimes to "now", which differs between CI runs,
# causing every test to miss the cache. Setting a fixed mtime makes the
# test cache hit across runs when file content hasn't changed.
#
# Risk: if a non-.go testdata file changes content but not size between
# commits, the test cache could return a stale result. This is extremely
# rare and Go's own test cache has the same inherent limitation.
git ls-files | xargs touch -t 200101010000
# Also stabilize directory mtimes — tests using os.ReadDir or
# filepath.Walk check directory mtimes too. git ls-files only
# lists files, not directories.
git ls-files | sed 's|/[^/]*$||' | sort -u | xargs touch -t 200101010000
shell: bash
Loading