-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from JeremyEastham/master
feat: Run Core Script, Script Options, Script Consolidation
- Loading branch information
Showing
15 changed files
with
386 additions
and
388 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,6 +68,7 @@ releasePassword | |
install | ||
install.bat | ||
LICENSE.md | ||
.testEnvRunning | ||
|
||
|
||
|
||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,52 @@ | ||
#!/bin/bash | ||
|
||
function cleanup { | ||
kill %1 > /dev/null # Send exit to startTestEnv | ||
} | ||
|
||
usage="Usage: runCore [--help] [--silent] [--cicd] [--force]" | ||
silent=false | ||
cicd=false | ||
force=false | ||
|
||
# Based on https://stackoverflow.com/a/33826763/11827673 | ||
while [[ "$#" -gt 0 ]]; do | ||
case $1 in | ||
-h|--help) echo "$usage"; exit ;; | ||
-s|--silent) silent=true ;; | ||
-c|--cicd) cicd=true ;; | ||
-f|--force) force=true ;; | ||
*) echo "Unknown parameter passed: $1"; echo "$usage"; exit 1 ;; | ||
esac | ||
shift | ||
done | ||
|
||
if [[ $force = true && -f .testEnvRunning ]]; then | ||
[[ $silent = false ]] && echo "Removing previous testing environment..." | ||
if [[ $cicd = true ]]; then | ||
./utils/cleanTestEnv --cicd | ||
else | ||
./utils/cleanTestEnv --local | ||
fi | ||
fi | ||
|
||
trap cleanup EXIT | ||
|
||
./startTestEnv --wait --silent & # Run in background | ||
|
||
[[ $silent = false ]] && echo "Waiting for testing environment to start..." | ||
until [[ -f .testEnvRunning ]] | ||
do | ||
sleep 1 | ||
done | ||
[[ $silent = false ]] && echo "Test environment started!" | ||
cp ./temp/config.yaml . | ||
[[ $silent = false ]] && echo "Starting core..." | ||
|
||
classpath="./core/*:./plugin-interface/*" | ||
|
||
if which cygpath > /dev/null; then # Convert path to Windows-style if using Git Bash | ||
classpath="$(cygpath -C ANSI -w -p "${classpath}")" | ||
fi | ||
|
||
java -classpath "${classpath}" io.supertokens.Main ./ DEV |
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,55 @@ | ||
#!/bin/bash | ||
|
||
function cleanup { | ||
if [[ $cicd = true ]]; then | ||
./utils/cleanTestEnv --cicd | ||
else | ||
./utils/cleanTestEnv --local | ||
fi | ||
} | ||
|
||
usage="Usage: startTestEnv [--help] [--wait] [--silent] [--cicd] [--force]" | ||
wait=false | ||
silent=false | ||
cicd=false | ||
force=false | ||
|
||
# Based on https://stackoverflow.com/a/33826763/11827673 | ||
while [[ "$#" -gt 0 ]]; do | ||
case $1 in | ||
-h|--help) echo "$usage"; exit ;; | ||
-w|--wait) wait=true ;; | ||
-s|--silent) silent=true ;; | ||
-c|--cicd) cicd=true ;; | ||
-f|--force) force=true ;; | ||
*) echo "Unknown parameter passed: $1"; echo "$usage"; exit 1 ;; | ||
esac | ||
shift | ||
done | ||
|
||
if [[ $force = true && -f .testEnvRunning ]]; then | ||
[[ $silent = false ]] && echo "Removing previous testing environment..." | ||
cleanup | ||
fi | ||
|
||
trap cleanup EXIT | ||
|
||
[[ $silent = false ]] && echo "Setting up testing environment..." | ||
if [[ $cicd = true ]]; then | ||
./utils/setupTestEnv --cicd | ||
else | ||
./utils/setupTestEnv --local | ||
fi | ||
|
||
|
||
if [[ $wait = true ]]; then | ||
[[ $silent = false ]] && echo "Test environment started! Leave this script running while running tests." | ||
# Wait for the user to end the session | ||
while true; do | ||
sleep 1 | ||
done | ||
else | ||
[[ $silent = false ]] && echo "Running all tests..." | ||
# Tests are run relative to the project's folder | ||
./gradlew test | ||
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 |
---|---|---|
@@ -1,45 +1,5 @@ | ||
#!/bin/bash | ||
|
||
function cleanup { | ||
if [[ $1 = "--cicd" ]] | ||
then | ||
./utils/cleanTestEnvCicd | ||
else | ||
./utils/cleanTestEnvLocal | ||
fi | ||
} | ||
|
||
trap cleanup EXIT | ||
|
||
wait=false | ||
|
||
if [[ $1 = "--cicd" ]] | ||
then | ||
if [[ $2 = "--wait" ]] | ||
then | ||
wait=true | ||
fi | ||
./utils/setupTestEnvCicd | ||
else | ||
if [[ $1 = "--wait" ]] | ||
then | ||
wait=true | ||
fi | ||
./utils/setupTestEnvLocal | ||
fi | ||
|
||
|
||
if [[ $wait = "true" ]] | ||
then | ||
echo "Test environment started! Leave this script running while running tests." | ||
# we wait for user to end the session | ||
while [[ true ]] | ||
do | ||
echo "Test environment running..." | ||
sleep 2 | ||
done | ||
else | ||
echo "Running all tests..." | ||
# ../ because the tests are run relative to the project's folder. | ||
./gradlew test | ||
fi | ||
RED="\033[0;31m" | ||
NC="\033[0m" | ||
printf "${RED}WARNING: startTestingEnv is DEPRECATED! Use startTestEnv instead.${NC}\n" >&2 | ||
./startTestEnv "$@" # Pass all arguments |
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,30 @@ | ||
#!/bin/bash | ||
|
||
usage="Usage: cleanTestEnv [--help] [ [--cicd] | [--local] ] [--silent]" | ||
cicd=false | ||
silent=false | ||
|
||
# Based on https://stackoverflow.com/a/33826763/11827673 | ||
while [[ "$#" -gt 0 ]]; do | ||
case $1 in | ||
-h|--help) echo "$usage"; exit ;; | ||
-c|--cicd) cicd=true ;; | ||
-l|--local) cicd=false ;; | ||
-s|--silent) silent=true ;; | ||
*) echo "Unknown parameter passed: $1"; echo "$usage"; exit 1 ;; | ||
esac | ||
shift | ||
done | ||
|
||
rm -rf core | ||
rm -rf plugin-interface | ||
rm -rf plugin | ||
rm -rf cli | ||
rm -rf downloader | ||
rm version.yaml | ||
rm -rf temp | ||
rm install | ||
rm install.bat | ||
rm LICENSE.md | ||
rm .testEnvRunning | ||
[[ $silent = false ]] && echo "Testing environment destroyed." |
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,5 @@ | ||
#!/bin/bash | ||
rm -rf core | ||
rm -rf plugin-interface | ||
rm -rf plugin | ||
rm -rf cli | ||
rm -rf downloader | ||
rm version.yaml | ||
rm -rf temp | ||
rm install | ||
rm install.bat | ||
rm LICENSE.md | ||
rm .testEnvRunning | ||
RED="\033[0;31m" | ||
NC="\033[0m" | ||
printf "${RED}WARNING: cleanTestEnvCicd is DEPRECATED! Use cleanTestEnv --cicd instead.${NC}\n" >&2 | ||
./utils/cleanTestEnv --cicd "$@" # Pass all arguments |
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,5 @@ | ||
#!/bin/bash | ||
rm -rf core | ||
rm -rf plugin-interface | ||
rm -rf plugin | ||
rm -rf cli | ||
rm -rf downloader | ||
rm version.yaml | ||
rm -rf temp | ||
rm install | ||
rm install.bat | ||
rm LICENSE.md | ||
rm .testEnvRunning | ||
RED="\033[0;31m" | ||
NC="\033[0m" | ||
printf "${RED}WARNING: cleanTestEnvLocal is DEPRECATED! Use cleanTestEnv instead.${NC}\n" >&2 | ||
./utils/cleanTestEnv --local "$@" # Pass all arguments |
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
Oops, something went wrong.