-
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.
chore: make every examples test a workspace
This setup will allow turbo to parallelize and cache execution of these tests. It also reduces the number of Github Workflow runs that are triggered when an example changes, greatly reducing the amount of computing power required to run the tests. This commit does not change the fact that all examples tests are run when any of the examples change. We may be able to wire up dependencies more carefully in the future, but this is not feasible at the moment because each example itself is not a workspace.
- Loading branch information
Showing
36 changed files
with
404 additions
and
117 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
File renamed without changes.
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,6 @@ | ||
{ | ||
"name": "@turborepo-examples-tests/helpers", | ||
"scripts": { | ||
"setup": "./setup_prysk.sh" | ||
} | ||
} |
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,14 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
BASE_DIR="$PWD/.." | ||
|
||
echo "basedir: $BASE_DIR" | ||
|
||
if [ -f "$BASE_DIR/.cram_env/bin/prysk" ]; then | ||
echo "Skipping prysk setup, prysk and venv already exists" | ||
else | ||
python3 -m venv "$BASE_DIR/.cram_env" | ||
"$BASE_DIR/.cram_env/bin/python3" -m pip install --quiet --upgrade pip | ||
"$BASE_DIR/.cram_env/bin/pip" install "prysk==0.15.0" | ||
fi |
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 @@ | ||
{ | ||
"extends": ["//"], | ||
"pipeline": { | ||
"setup": {}, | ||
"topo": {} | ||
} | ||
} |
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,11 @@ | ||
{ | ||
"name": "@turborepo-examples-tests/npm-non-monorepo", | ||
"scripts": { | ||
"example-test": "../.cram_env/bin/prysk --shell=`which bash` test.t" | ||
}, | ||
"dependencies": { | ||
"turborepo-tests-helpers": "workspace:*", | ||
"@turborepo-examples-tests/helpers": "workspace:*", | ||
"turborepo-examples": "workspace:*" | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...-tests/examples/tests/yarn-non-monorepo.t → examples-tests/npm-non-monorepo/test.t
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,11 @@ | ||
{ | ||
"name": "@turborepo-examples-tests/npm-with-npm", | ||
"scripts": { | ||
"example-test": "../.cram_env/bin/prysk --shell=`which bash` test.t" | ||
}, | ||
"dependencies": { | ||
"turborepo-tests-helpers": "workspace:*", | ||
"@turborepo-examples-tests/helpers": "workspace:*", | ||
"turborepo-examples": "workspace:*" | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...repo-tests/examples/tests/npm-with-yarn.t → examples-tests/npm-with-npm/test.t
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,11 @@ | ||
{ | ||
"name": "@turborepo-examples-tests/npm-with-yarn", | ||
"scripts": { | ||
"example-test": "../.cram_env/bin/prysk --shell=`which bash` test.t" | ||
}, | ||
"dependencies": { | ||
"turborepo-tests-helpers": "workspace:*", | ||
"@turborepo-examples-tests/helpers": "workspace:*", | ||
"turborepo-examples": "workspace:*" | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...orepo-tests/examples/tests/npm-with-npm.t → examples-tests/npm-with-yarn/test.t
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,11 @@ | ||
{ | ||
"name": "@turborepo-examples-tests/pnpm-basic", | ||
"scripts": { | ||
"example-test": "../.cram_env/bin/prysk --shell=`which bash` test.t" | ||
}, | ||
"dependencies": { | ||
"turborepo-tests-helpers": "workspace:*", | ||
"@turborepo-examples-tests/helpers": "workspace:*", | ||
"turborepo-examples": "workspace:*" | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
turborepo-tests/examples/tests/pnpm-basic.t → examples-tests/pnpm-basic/test.t
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,11 @@ | ||
{ | ||
"name": "@turborepo-examples-tests/pnpm-gatsby", | ||
"scripts": { | ||
"example-test": "../.cram_env/bin/prysk --shell=`which bash` test.t" | ||
}, | ||
"dependencies": { | ||
"turborepo-tests-helpers": "workspace:*", | ||
"@turborepo-examples-tests/helpers": "workspace:*", | ||
"turborepo-examples": "workspace:*" | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
turborepo-tests/examples/tests/pnpm-gatsby.t → examples-tests/pnpm-gatsby/test.t
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,11 @@ | ||
{ | ||
"name": "@turborepo-examples-tests/pnpm-kitchen-sink", | ||
"scripts": { | ||
"example-test": "../.cram_env/bin/prysk --shell=`which bash` test.t" | ||
}, | ||
"dependencies": { | ||
"turborepo-tests-helpers": "workspace:*", | ||
"@turborepo-examples-tests/helpers": "workspace:*", | ||
"turborepo-examples": "workspace:*" | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...o-tests/examples/tests/pnpm-with-svelte.t → examples-tests/pnpm-kitchen-sink/test.t
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,11 @@ | ||
{ | ||
"name": "@turborepo-examples-tests/pnpm-with-svelte", | ||
"scripts": { | ||
"example-test": "../.cram_env/bin/prysk --shell=`which bash` test.t" | ||
}, | ||
"dependencies": { | ||
"turborepo-tests-helpers": "workspace:*", | ||
"@turborepo-examples-tests/helpers": "workspace:*", | ||
"turborepo-examples": "workspace:*" | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
...-tests/examples/tests/pnpm-kitchen-sink.t → examples-tests/pnpm-with-svelte/test.t
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 |
---|---|---|
@@ -1,12 +1,12 @@ | ||
#!/bin/bash | ||
set -e | ||
set -eo pipefail | ||
|
||
exampleName=$1 | ||
pkgManager=$2 | ||
|
||
# Copy the example dir over to the test dir that prysk puts you in | ||
SCRIPT_DIR=$(dirname "${BASH_SOURCE[0]}") | ||
MONOREPO_ROOT_DIR="$SCRIPT_DIR/../../.." | ||
MONOREPO_ROOT_DIR="$SCRIPT_DIR/.." | ||
EXAMPLE_DIR="$MONOREPO_ROOT_DIR/examples/$exampleName" | ||
|
||
TARGET_DIR="$(pwd)" | ||
|
@@ -28,6 +28,7 @@ fi | |
|
||
function set_package_manager() { | ||
cat package.json | jq ".packageManager=\"$1\"" | sponge package.json | ||
corepack enable | ||
} | ||
|
||
# Set the packageManger version | ||
|
@@ -36,16 +37,19 @@ PNPM_PACKAGE_MANAGER_VALUE="[email protected]" | |
YARN_PACKAGE_MANAGER_VALUE="[email protected]" | ||
if [ "$pkgManager" == "npm" ]; then | ||
set_package_manager "$NPM_PACKAGE_MANAGER_VALUE" | ||
npm install > /dev/null | ||
npm install > /dev/null 2>&1 | ||
elif [ "$pkgManager" == "pnpm" ]; then | ||
set_package_manager "$PNPM_PACKAGE_MANAGER_VALUE" | ||
pnpm install > /dev/null | ||
pnpm install > /dev/null 2>&1 | ||
elif [ "$pkgManager" == "yarn" ]; then | ||
set_package_manager "$YARN_PACKAGE_MANAGER_VALUE" | ||
yarn install > /dev/null | ||
# Pass a --cache-folder here because yarn seems to have trouble | ||
# running multiple yarn installs at the same time and we are running | ||
# examples tests in parallel. https://github.com/yarnpkg/yarn/issues/1275 | ||
yarn install --cache-folder="$PWD/.yarn-cache" | ||
fi | ||
|
||
# Delete .git directory if it's there, we'll set up a new git repo | ||
[ ! -d .git ] || rm -rf .git | ||
|
||
"$MONOREPO_ROOT_DIR/turborepo-tests/helpers/setup_git.sh" "${TARGET_DIR}" | ||
"$MONOREPO_ROOT_DIR/turborepo-tests/helpers/setup_git.sh" "${TARGET_DIR}" "false" |
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,11 @@ | ||
{ | ||
"name": "@turborepo-examples-tests/yarn-non-monorepo", | ||
"scripts": { | ||
"example-test": "../.cram_env/bin/prysk --shell=`which bash` test.t" | ||
}, | ||
"dependencies": { | ||
"turborepo-tests-helpers": "workspace:*", | ||
"@turborepo-examples-tests/helpers": "workspace:*", | ||
"turborepo-examples": "workspace:*" | ||
} | ||
} |
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,39 @@ | ||
$ . ${TESTDIR}/../setup.sh non-monorepo yarn | ||
yarn cache v1.22.17 | ||
success Cleared cache. | ||
Done in [\.0-9]+m?s\. (re) | ||
yarn install v1.22.17 | ||
info No lockfile found. | ||
[1/4] Resolving packages... | ||
[2/4] Fetching packages... | ||
[3/4] Linking dependencies... | ||
[4/4] Building fresh packages... | ||
success Saved lockfile. | ||
Done in [\.0-9]+m?s\. (re) | ||
|
||
# run twice and make sure it works | ||
$ yarn turbo build lint --output-logs=none | ||
yarn run v1.22.17 | ||
\$ (.*)node_modules/.bin/turbo build lint --output-logs=none (re) | ||
• Running build, lint | ||
• Remote caching disabled | ||
|
||
Tasks: 2 successful, 2 total | ||
Cached: 0 cached, 2 total | ||
Time:\s*[\.0-9]+m?s (re) | ||
|
||
Done in [\.0-9]+m?s\. (re) | ||
|
||
$ yarn turbo build lint --output-logs=none | ||
yarn run v1.22.17 | ||
\$ (.*)node_modules/.bin/turbo build lint --output-logs=none (re) | ||
• Running build, lint | ||
• Remote caching disabled | ||
|
||
Tasks: 2 successful, 2 total | ||
Cached: 2 cached, 2 total | ||
Time:\s*[\.0-9]+m?s >>> FULL TURBO (re) | ||
|
||
Done in [\.0-9]+m?s\. (re) | ||
|
||
$ git diff |
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,11 @@ | ||
{ | ||
"name": "@turborepo-examples-tests/yarn-with-npm", | ||
"scripts": { | ||
"example-test": "../.cram_env/bin/prysk --shell=`which bash` test.t" | ||
}, | ||
"dependencies": { | ||
"turborepo-tests-helpers": "workspace:*", | ||
"@turborepo-examples-tests/helpers": "workspace:*", | ||
"turborepo-examples": "workspace:*" | ||
} | ||
} |
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,41 @@ | ||
$ . ${TESTDIR}/../setup.sh with-npm yarn | ||
yarn cache v1.22.17 | ||
success Cleared cache. | ||
Done in [\.0-9]+m?s\. (re) | ||
yarn install v1.22.17 | ||
info No lockfile found. | ||
[1/4] Resolving packages... | ||
[2/4] Fetching packages... | ||
[3/4] Linking dependencies... | ||
[4/4] Building fresh packages... | ||
success Saved lockfile. | ||
Done in [\.0-9]+m?s\. (re) | ||
|
||
# run twice and make sure it works | ||
$ yarn turbo build lint --output-logs=none | ||
yarn run v1.22.17 | ||
\$ (.*)node_modules/.bin/turbo build lint --output-logs=none (re) | ||
• Packages in scope: docs, eslint-config-custom, tsconfig, ui, web | ||
• Running build, lint in 5 packages | ||
• Remote caching disabled | ||
|
||
Tasks: 5 successful, 5 total | ||
Cached: 0 cached, 5 total | ||
Time:\s*[\.0-9]+m?s (re) | ||
|
||
Done in [\.0-9]+m?s\. (re) | ||
|
||
$ yarn turbo build lint --output-logs=none | ||
yarn run v1.22.17 | ||
\$ (.*)node_modules/.bin/turbo build lint --output-logs=none (re) | ||
• Packages in scope: docs, eslint-config-custom, tsconfig, ui, web | ||
• Running build, lint in 5 packages | ||
• Remote caching disabled | ||
|
||
Tasks: 5 successful, 5 total | ||
Cached: 5 cached, 5 total | ||
Time:\s*[\.0-9]+m?s >>> FULL TURBO (re) | ||
|
||
Done in [\.0-9]+m?s\. (re) | ||
|
||
$ git diff |
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,11 @@ | ||
{ | ||
"name": "@turborepo-tests-examples/yarn-with-yarn", | ||
"scripts": { | ||
"example-test": "../.cram_env/bin/prysk --shell=`which bash` test.t" | ||
}, | ||
"dependencies": { | ||
"turborepo-tests-helpers": "workspace:*", | ||
"@turborepo-examples-tests/helpers": "workspace:*", | ||
"turborepo-examples": "workspace:*" | ||
} | ||
} |
Oops, something went wrong.