Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move fs cache location. #8126

Merged
merged 6 commits into from
May 17, 2024
Merged
Show file tree
Hide file tree
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
24 changes: 6 additions & 18 deletions crates/turborepo-cache/src/async_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,12 +272,8 @@ mod tests {
// Wait for async cache to process
async_cache.wait().await.unwrap();

let fs_cache_path = repo_root_path.join_components(&[
"node_modules",
".cache",
"turbo",
&format!("{}.tar.zst", hash),
]);
let fs_cache_path =
repo_root_path.join_components(&[".turbo", "cache", &format!("{}.tar.zst", hash)]);

// Confirm that fs cache file does *not* exist
assert!(!fs_cache_path.exists());
Expand Down Expand Up @@ -360,12 +356,8 @@ mod tests {
// Wait for async cache to process
async_cache.wait().await.unwrap();

let fs_cache_path = repo_root_path.join_components(&[
"node_modules",
".cache",
"turbo",
&format!("{}.tar.zst", hash),
]);
let fs_cache_path =
repo_root_path.join_components(&[".turbo", "cache", &format!("{}.tar.zst", hash)]);

// Confirm that fs cache file exists
assert!(fs_cache_path.exists());
Expand Down Expand Up @@ -454,12 +446,8 @@ mod tests {
// Wait for async cache to process
async_cache.wait().await.unwrap();

let fs_cache_path = repo_root_path.join_components(&[
"node_modules",
".cache",
"turbo",
&format!("{}.tar.zst", hash),
]);
let fs_cache_path =
repo_root_path.join_components(&[".turbo", "cache", &format!("{}.tar.zst", hash)]);

// Confirm that fs cache file exists
assert!(fs_cache_path.exists());
Expand Down
2 changes: 1 addition & 1 deletion crates/turborepo-cache/src/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ impl FSCache {
if let Some(override_dir) = override_dir {
AbsoluteSystemPathBuf::from_unknown(repo_root, override_dir)
} else {
repo_root.join_components(&["node_modules", ".cache", "turbo"])
repo_root.join_components(&[".turbo", "cache"])
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Do a dry run so we can see the state of the cache

Get the hash of the my-app#build task, so we can inspect the cache
$ HASH=$(cat dry.json | jq -r '.tasks | map(select(.taskId == "my-app#build")) | .[0].hash')
$ duration=$(cat "node_modules/.cache/turbo/$HASH-meta.json" | jq .duration)
$ duration=$(cat ".turbo/cache/$HASH-meta.json" | jq .duration)
check that it exists
$ echo $duration
[0-9]+ (re)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Setup
Time:\s*[\.0-9]+m?s (re)

$ HASH=$(cat tmp.log | grep -E "add-keys:add-keys-task.* executing .*" | awk '{print $5}')
$ tar -tf $TARGET_DIR/node_modules/.cache/turbo/$HASH.tar.zst;
$ tar -tf $TARGET_DIR/.turbo/cache/$HASH.tar.zst;
apps/add-keys/.turbo/turbo-add-keys-task.log
apps/add-keys/out/
apps/add-keys/out/.keep
Expand Down
8 changes: 4 additions & 4 deletions turborepo-tests/integration/tests/workspace-configs/cache.t
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ This test covers:
$ HASH=$(cat tmp.log | grep -E "cached:cached-task-1.* executing .*" | awk '{print $5}')
$ echo $HASH
[a-z0-9]{16} (re)
$ tar -tf $TARGET_DIR/node_modules/.cache/turbo/$HASH.tar.zst;
$ tar -tf $TARGET_DIR/.turbo/cache/$HASH.tar.zst;
apps/cached/.turbo/turbo-cached-task-1.log
apps/cached/out/
apps/cached/out/.keep
Expand All @@ -51,7 +51,7 @@ This test covers:
$ HASH=$(cat tmp.log | grep -E "cached:cached-task-2.* executing .*" | awk '{print $6}')
$ echo $HASH
[a-z0-9]{16} (re)
$ test -f $TARGET_DIR/node_modules/.cache/turbo/$HASH.tar.zst;
$ test -f $TARGET_DIR/.turbo/cache/$HASH.tar.zst;
[1]

no `cache` config in root, cache:false in workspace
Expand All @@ -73,7 +73,7 @@ no `cache` config in root, cache:false in workspace
$ HASH=$(cat tmp.log | grep -E "cached:cached-task-3.* executing .*" | awk '{print $6}')
$ echo $HASH
[a-z0-9]{16} (re)
$ test -f $TARGET_DIR/node_modules/.cache/turbo/$HASH.tar.zst;
$ test -f $TARGET_DIR/.turbo/cache/$HASH.tar.zst;
[1]

cache:false in root, no turbo.json in workspace.
Expand All @@ -97,5 +97,5 @@ we already have a workspace that doesn't have a config
$ HASH=$(cat tmp.log | grep -E "missing-workspace-config:cached-task-4.* executing .*" | awk '{print $6}')
$ echo $HASH
[a-z0-9]{16} (re)
$ test -f $TARGET_DIR/node_modules/.cache/turbo/$HASH.tar.zst;
$ test -f $TARGET_DIR/.turbo/cache/$HASH.tar.zst;
[1]
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Setup
Time:\s*[\.0-9]+m?s (re)

$ HASH=$(cat tmp.log | grep -E "missing-workspace-config:missing-workspace-config-task.* executing .*" | awk '{print $5}')
$ tar -tf $TARGET_DIR/node_modules/.cache/turbo/$HASH.tar.zst;
$ tar -tf $TARGET_DIR/.turbo/cache/$HASH.tar.zst;
apps/missing-workspace-config/.turbo/turbo-missing-workspace-config-task.log
apps/missing-workspace-config/out/
apps/missing-workspace-config/out/.keep
Expand Down Expand Up @@ -102,5 +102,5 @@ Setup
$ HASH=$(cat tmp.log | grep -E "missing-workspace-config:cached-task-4.* executing .*" | awk '{print $6}')
$ echo $HASH
[a-z0-9]{16} (re)
$ test -f $TARGET_DIR/node_modules/.cache/turbo/$HASH.tar.zst;
$ test -f $TARGET_DIR/.turbo/cache/$HASH.tar.zst;
[1]
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Setup
Time:\s*[\.0-9]+m?s (re)

$ HASH=$(cat tmp.log | grep -E "omit-keys:omit-keys-task-with-deps.* executing .*" | awk '{print $5}')
$ tar -tf $TARGET_DIR/node_modules/.cache/turbo/$HASH.tar.zst;
$ tar -tf $TARGET_DIR/.turbo/cache/$HASH.tar.zst;
apps/omit-keys/.turbo/turbo-omit-keys-task-with-deps.log
apps/omit-keys/out/
apps/omit-keys/out/.keep
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Setup
Time:\s*[\.0-9]+m?s (re)

$ HASH=$(cat tmp.log | grep -E "omit-keys:omit-keys-task.* executing .*" | awk '{print $5}')
$ tar -tf $TARGET_DIR/node_modules/.cache/turbo/$HASH.tar.zst;
$ tar -tf $TARGET_DIR/.turbo/cache/$HASH.tar.zst;
apps/omit-keys/.turbo/turbo-omit-keys-task.log
apps/omit-keys/out/
apps/omit-keys/out/.keep
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Setup
Time:\s*[\.0-9]+m?s (re)

$ HASH=$(cat tmp.log | grep -E "override-values:override-values-task.* executing .*" | awk '{print $5}')
$ tar -tf $TARGET_DIR/node_modules/.cache/turbo/$HASH.tar.zst;
$ tar -tf $TARGET_DIR/.turbo/cache/$HASH.tar.zst;
apps/override-values/.turbo/turbo-override-values-task.log
apps/override-values/lib/
apps/override-values/lib/.keep
Expand Down
Loading