PersistentCacheDir returns a path to a directory that will be cached between test runs in Github Actions.
(t *testing.T)
| 11 | // PersistentCacheDir returns a path to a directory |
| 12 | // that will be cached between test runs in Github Actions. |
| 13 | func PersistentCacheDir(t *testing.T) string { |
| 14 | t.Helper() |
| 15 | |
| 16 | // We don't use os.UserCacheDir() because the path it |
| 17 | // returns is different on different operating systems. |
| 18 | // This would make it harder to specify which cache dir to use |
| 19 | // in Github Actions. |
| 20 | home, err := os.UserHomeDir() |
| 21 | require.NoError(t, err) |
| 22 | dir := filepath.Join(home, ".cache", "coderv2-test") |
| 23 | |
| 24 | return dir |
| 25 | } |