-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix behaviour when discovering files for global hashing (#6738)
### Description When turbo tries to discover files for the global hash we were incorrectly yielding folders which were being passed on to git. This adds a unit and integration test to ensure this doesn't happen, and fixes the bug. Closes #6729 and supersedes #6736 ### Testing Instructions Run unit tests or integration tests Closes TURBO-1875 --------- Co-authored-by: Greg Soltis <Greg Soltis>
- Loading branch information
Showing
11 changed files
with
172 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
node_modules/ | ||
.turbo | ||
.npmrc |
Empty file.
10 changes: 10 additions & 0 deletions
10
turborepo-tests/integration/fixtures/global_deps/apps/my-app/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"name": "my-app", | ||
"scripts": { | ||
"build": "echo building", | ||
"maybefails": "exit 4" | ||
}, | ||
"dependencies": { | ||
"util": "*" | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
turborepo-tests/integration/fixtures/global_deps/global_deps/bar.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
other file, not a global dependency |
1 change: 1 addition & 0 deletions
1
turborepo-tests/integration/fixtures/global_deps/global_deps/foo.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
global dep! all tasks depend on this content! |
10 changes: 10 additions & 0 deletions
10
turborepo-tests/integration/fixtures/global_deps/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"name": "monorepo", | ||
"scripts": { | ||
"something": "turbo run build" | ||
}, | ||
"workspaces": [ | ||
"apps/**", | ||
"packages/**" | ||
] | ||
} |
4 changes: 4 additions & 0 deletions
4
turborepo-tests/integration/fixtures/global_deps/packages/another/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"name": "another", | ||
"scripts": {} | ||
} |
7 changes: 7 additions & 0 deletions
7
turborepo-tests/integration/fixtures/global_deps/packages/util/package.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"name": "util", | ||
"scripts": { | ||
"build": "echo building", | ||
"maybefails": "echo didnotfail" | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
turborepo-tests/integration/fixtures/global_deps/turbo.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{ | ||
"$schema": "https://turbo.build/schema.json", | ||
"globalDependencies": ["global_deps/**"], | ||
"globalEnv": ["SOME_ENV_VAR"], | ||
"pipeline": { | ||
"build": { | ||
"env": ["NODE_ENV"], | ||
"outputs": [] | ||
}, | ||
// this comment verifies that turbo can read .json files with comments | ||
"my-app#build": { | ||
"outputs": ["banana.txt", "apple.json"], | ||
"dotEnv": [".env.local"] | ||
}, | ||
|
||
"something": {}, | ||
"//#something": {}, | ||
|
||
"maybefails": {} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
Setup | ||
$ . ${TESTDIR}/../../helpers/setup_integration_test.sh global_deps | ||
|
||
Run a build | ||
$ ${TURBO} build -F my-app --output-logs=hash-only | ||
\xe2\x80\xa2 Packages in scope: my-app (esc) | ||
\xe2\x80\xa2 Running build in 1 packages (esc) | ||
\xe2\x80\xa2 Remote caching disabled (esc) | ||
my-app:build: cache miss, executing 81165ceb4ed0e31f | ||
|
||
Tasks: 1 successful, 1 total | ||
Cached: 0 cached, 1 total | ||
Time:\s*[\.0-9]+m?s (re) | ||
|
||
|
||
$ echo "new text" > global_deps/foo.txt | ||
$ ${TURBO} build -F my-app --output-logs=hash-only | ||
\xe2\x80\xa2 Packages in scope: my-app (esc) | ||
\xe2\x80\xa2 Running build in 1 packages (esc) | ||
\xe2\x80\xa2 Remote caching disabled (esc) | ||
my-app:build: cache miss, executing 7bc88ba3e84628fd | ||
|
||
Tasks: 1 successful, 1 total | ||
Cached: 0 cached, 1 total | ||
Time:\s*[\.0-9]+m?s (re) | ||
|