-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
19c5277
commit 45df6bf
Showing
2 changed files
with
88 additions
and
0 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,87 @@ | ||
#!/usr/bin/env bash | ||
|
||
function print_help { | ||
echo "Usage: ${0} [OPTIONS]" | ||
echo "" | ||
echo "OPTIONS:" | ||
echo " --node-version <version> the node version to use while testing [6]" | ||
echo " --git-branch <branch> the git branch to checkout for testing [the current one]" | ||
echo " --test-suite <suite> which test suite to use ('simple', installs', 'kitchensink', 'all') ['all']" | ||
echo " --yarn if present, use yarn as the package manager" | ||
echo " --help print this message and exit" | ||
echo "" | ||
} | ||
|
||
cd $(dirname $0) | ||
|
||
node_version=6 | ||
git_branch=`git rev-parse --abbrev-ref HEAD` | ||
use_yarn=no | ||
test_suite=all | ||
|
||
while [ "$1" != "" ]; do | ||
case $1 in | ||
"--node-version") | ||
shift | ||
node_version=$1 | ||
;; | ||
"--git-branch") | ||
shift | ||
git_branch=$1 | ||
;; | ||
"--yarn") | ||
use_yarn=yes | ||
;; | ||
"--test-suite") | ||
shift | ||
test_suite=$1 | ||
;; | ||
"--help") | ||
print_help | ||
exit 0 | ||
;; | ||
esac | ||
shift | ||
done | ||
|
||
test_command="./tasks/e2e-simple.sh && ./tasks/e2e-kitchensink.sh && ./tasks/e2e-installs.sh" | ||
case ${test_suite} in | ||
"all") | ||
;; | ||
"simple") | ||
test_command="./tasks/e2e-simple.sh" | ||
;; | ||
"kitchensink") | ||
test_command="./tasks/e2e-kitchensink.sh" | ||
;; | ||
"installs") | ||
test_command="./tasks/e2e-installs.sh" | ||
;; | ||
*) | ||
;; | ||
esac | ||
|
||
read -r -d '' command <<- CMD | ||
echo "prefix=~/.npm" > ~/.npmrc | ||
mkdir ~/.npm | ||
export PATH=\$PATH:~/.npm/bin | ||
set -x | ||
git clone /var/create-react-app create-react-app --branch ${git_branch} | ||
cd create-react-app | ||
node --version | ||
npm --version | ||
npm install | ||
set +x | ||
${test_command} && echo -e "\n\e[1;32m✔ Job passed\e[0m" || echo -e "\n\e[1;31m✘ Job failes\e[0m" | ||
CMD | ||
|
||
docker run \ | ||
--env CI=true \ | ||
--env NPM_CONFIG_QUIET=true \ | ||
--env USE_YARN=${use_yarn} \ | ||
--tty \ | ||
--user node \ | ||
--volume ${PWD}/..:/var/create-react-app \ | ||
--workdir /home/node \ | ||
node:${node_version} \ | ||
bash -c "${command}" |