Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
internal/ci: restore git modified times after cloning
On one hand, "git clone" creates every file anew, with their modified times representing the current time. On the other, Go's test caching tracks the attributes and contents of the files opened by each test as part of its cache key hashes. Unfortunately, the modified times are always part of that hash, even when the files are small. See https://go.dev/issues/58571. Due to those factors, the trybots always re-run nearly all tests. In particular, we use testdata files in quite a few packages, so none of those can realistically hit the test cache in CI. Until Go's test caching can be made a bit smarter about modified times, use a python script packaged as a GitHub Action to restore each file tracked by git to the commit time when they were last modified. Luckily, the action only runs a simple python script, so it seems to consistently finish in under a second. We also have to fetch the git repository with full history, since actions/checkout defaults to a shallow clone and the python script needs full git history to properly reconstruct modified times. Luckily, GitHub seem to have optimized git cloning from Actions, so the actions/checkout step still seems to finish in around one second. Signed-off-by: Daniel Martí <mvdan@mvdan.cc> Change-Id: I7f1decd2ad1484f1a30e092b530b93833f6099c2 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/551227 Reviewed-by: Paul Jolly <paul@myitcv.io> TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
- Loading branch information