-
Notifications
You must be signed in to change notification settings - Fork 489
Fix travis build #302
Fix travis build #302
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,9 @@ | ||
--- | ||
# Use Ubuntu Precise instead of new default Trusty which cause build fail | ||
# with pre installed yarn v0.17.8 | ||
# https://github.com/facebookincubator/create-react-app/issues/3054 | ||
# TODO: remove after Trusty environment is updated with a lastet version of yarn | ||
dist: precise | ||
dist: trusty | ||
language: node_js | ||
node_js: | ||
- 6 | ||
- 8 | ||
- 9 | ||
cache: | ||
directories: | ||
- node_modules | ||
|
@@ -16,13 +12,17 @@ cache: | |
install: true | ||
script: | ||
- 'if [ $TEST_SUITE = "simple" ]; then tasks/e2e-simple.sh; fi' | ||
- 'if [ $TEST_SUITE = "installs" ]; then tasks/e2e-installs.sh; fi' | ||
- 'if [ $TEST_SUITE = "kitchensink" ]; then tasks/e2e-kitchensink.sh; fi' | ||
- 'if [ $TEST_SUITE = "old-node" ]; then tasks/e2e-old-node.sh; fi' | ||
env: | ||
global: | ||
- USE_YARN=no | ||
matrix: | ||
- TEST_SUITE=simple | ||
- TEST_SUITE=install | ||
# There's a weird Yarn/Lerna bug related to prerelease versions. | ||
# TODO: reenable after we ship 1.0. | ||
# - node_js: 6 | ||
# env: USE_YARN=yes TEST_SUITE=simple | ||
- TEST_SUITE=installs | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can just keep There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
- TEST_SUITE=kitchensink | ||
matrix: | ||
include: | ||
- node_js: 0.10 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think we want this line, more for testing There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
env: TEST_SUITE=old-node | ||
- node_js: 6 | ||
env: TEST_SUITE=kitchensink |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,13 +14,17 @@ cd "$(dirname "$0")" | |
|
||
# CLI and app temporary locations | ||
# http://unix.stackexchange.com/a/84980 | ||
temp_cli_path=`mktemp -d 2>/dev/null || mktemp -d -t 'temp_cli_path'` | ||
temp_app_path=`mktemp -d 2>/dev/null || mktemp -d -t 'temp_app_path'` | ||
custom_registry_url=http://localhost:4873 | ||
original_npm_registry_url=`npm get registry` | ||
original_yarn_registry_url=`yarn config get registry` | ||
|
||
function cleanup { | ||
echo 'Cleaning up.' | ||
cd "$root_path" | ||
rm -rf "$temp_cli_path" "$temp_app_path" | ||
rm -rf "$temp_app_path" | ||
npm set registry "$original_npm_registry_url" | ||
yarn config set registry "$original_yarn_registry_url" | ||
} | ||
|
||
# Error messages are redirected to stderr | ||
|
@@ -55,10 +59,6 @@ function checkDependencies { | |
fi | ||
} | ||
|
||
function create_react_app { | ||
node "$temp_cli_path"/node_modules/create-react-app/index.js $* | ||
} | ||
|
||
# Exit the script with a helpful error message when any error is encountered | ||
trap 'set +x; handle_error $LINENO $BASH_COMMAND' ERR | ||
|
||
|
@@ -72,98 +72,82 @@ set -x | |
cd .. | ||
root_path=$PWD | ||
|
||
# Clear cache to avoid issues with incorrect packages being used | ||
if hash yarnpkg 2>/dev/null | ||
then | ||
# AppVeyor uses an old version of yarn. | ||
# Once updated to 0.24.3 or above, the workaround can be removed | ||
# and replaced with `yarnpkg cache clean` | ||
# Issues: | ||
# https://github.com/yarnpkg/yarn/issues/2591 | ||
# https://github.com/appveyor/ci/issues/1576 | ||
# https://github.com/facebookincubator/create-react-app/pull/2400 | ||
# When removing workaround, you may run into | ||
# https://github.com/facebookincubator/create-react-app/issues/2030 | ||
case "$(uname -s)" in | ||
*CYGWIN*|MSYS*|MINGW*) yarn=yarn.cmd;; | ||
*) yarn=yarnpkg;; | ||
esac | ||
$yarn cache clean | ||
fi | ||
|
||
if hash npm 2>/dev/null | ||
then | ||
# npm 5 is too buggy right now | ||
if [ $(npm -v | head -c 1) -eq 5 ]; then | ||
npm i -g npm@^4.x | ||
fi; | ||
npm i -g npm@latest | ||
npm cache clean || npm cache verify | ||
fi | ||
|
||
# Prevent bootstrap, we only want top-level dependencies | ||
cp package.json package.json.bak | ||
grep -v "postinstall" package.json > temp && mv temp package.json | ||
npm install | ||
mv package.json.bak package.json | ||
# Bootstrap monorepo | ||
yarn | ||
|
||
if [ "$USE_YARN" = "yes" ] | ||
then | ||
# Install Yarn so that the test can use it to install packages. | ||
npm install -g yarn | ||
yarn cache clean | ||
fi | ||
# ****************************************************************************** | ||
# First, publish the monorepo. | ||
# ****************************************************************************** | ||
|
||
# Start local registry | ||
tmp_registry_log=`mktemp` | ||
nohup npx [email protected] &>$tmp_registry_log & | ||
# Wait for `verdaccio` to boot | ||
grep -q 'http address' <(tail -f $tmp_registry_log) | ||
|
||
# We removed the postinstall, so do it manually | ||
node bootstrap.js | ||
# Set registry to local registry | ||
npm set registry "$custom_registry_url" | ||
yarn config set registry "$custom_registry_url" | ||
|
||
cd packages/react-error-overlay/ | ||
npm run build:prod | ||
cd ../.. | ||
# Login so we can publish packages | ||
npx [email protected] -u user -p password -e [email protected] -r "$custom_registry_url" --quotes | ||
|
||
# Publish the monorepo | ||
git clean -df | ||
./tasks/publish.sh --yes --force-publish=* --skip-git --cd-version=prerelease --exact --npm-tag=latest | ||
|
||
# ****************************************************************************** | ||
# First, pack and install create-react-app. | ||
# Test --scripts-version with a version number | ||
# ****************************************************************************** | ||
|
||
# Pack CLI | ||
cd "$root_path"/packages/create-react-app | ||
cli_path=$PWD/`npm pack` | ||
cd "$temp_app_path" | ||
npx create-react-app --scripts-version=1.0.17 test-app-version-number | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This test suite is disabled for now. |
||
cd test-app-version-number | ||
|
||
# Install the CLI in a temporary location | ||
cd "$temp_cli_path" | ||
npm install "$cli_path" | ||
# Check corresponding scripts version is installed. | ||
exists node_modules/react-scripts | ||
grep '"version": "1.0.17"' node_modules/react-scripts/package.json | ||
checkDependencies | ||
|
||
# ****************************************************************************** | ||
# Test --scripts-version with a version number | ||
# Test --use-npm flag | ||
# ****************************************************************************** | ||
|
||
cd "$temp_app_path" | ||
create_react_app --scripts-version=0.4.0 test-app-version-number | ||
cd test-app-version-number | ||
npx create-react-app --use-npm --scripts-version=1.0.17 test-use-npm-flag | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above |
||
cd test-use-npm-flag | ||
|
||
# Check corresponding scripts version is installed. | ||
exists node_modules/react-scripts | ||
grep '"version": "0.4.0"' node_modules/react-scripts/package.json | ||
[ ! -e "yarn.lock" ] && echo "yarn.lock correctly does not exist" | ||
grep '"version": "1.0.17"' node_modules/react-scripts/package.json | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Our version is different now |
||
checkDependencies | ||
|
||
# ****************************************************************************** | ||
# Test --scripts-version with a tarball url | ||
# ****************************************************************************** | ||
|
||
cd "$temp_app_path" | ||
create_react_app --scripts-version=https://registry.npmjs.org/react-scripts/-/react-scripts-0.4.0.tgz test-app-tarball-url | ||
npx create-react-app --scripts-version=https://registry.npmjs.org/react-scripts/-/react-scripts-1.0.17.tgz test-app-tarball-url | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above |
||
cd test-app-tarball-url | ||
|
||
# Check corresponding scripts version is installed. | ||
exists node_modules/react-scripts | ||
grep '"version": "0.4.0"' node_modules/react-scripts/package.json | ||
grep '"version": "1.0.17"' node_modules/react-scripts/package.json | ||
checkDependencies | ||
|
||
# ****************************************************************************** | ||
# Test --scripts-version with a custom fork of react-scripts | ||
# ****************************************************************************** | ||
|
||
cd "$temp_app_path" | ||
create_react_app --scripts-version=react-scripts-fork test-app-fork | ||
npx create-react-app --scripts-version=react-scripts-fork test-app-fork | ||
cd test-app-fork | ||
|
||
# Check corresponding scripts version is installed. | ||
|
@@ -175,7 +159,7 @@ exists node_modules/react-scripts-fork | |
|
||
cd "$temp_app_path" | ||
# we will install a non-existing package to simulate a failed installataion. | ||
create_react_app --scripts-version=`date +%s` test-app-should-not-exist || true | ||
npx create-react-app --scripts-version=`date +%s` test-app-should-not-exist || true | ||
# confirm that the project folder was deleted | ||
test ! -d test-app-should-not-exist | ||
|
||
|
@@ -187,7 +171,7 @@ cd "$temp_app_path" | |
mkdir test-app-should-remain | ||
echo '## Hello' > ./test-app-should-remain/README.md | ||
# we will install a non-existing package to simulate a failed installataion. | ||
create_react_app --scripts-version=`date +%s` test-app-should-remain || true | ||
npx create-react-app --scripts-version=`date +%s` test-app-should-remain || true | ||
# confirm the file exist | ||
test -e test-app-should-remain/README.md | ||
# confirm only README.md is the only file in the directory | ||
|
@@ -201,7 +185,7 @@ fi | |
|
||
cd $temp_app_path | ||
curl "https://registry.npmjs.org/@enoah_netzach/react-scripts/-/react-scripts-0.9.0.tgz" -o enoah-scripts-0.9.0.tgz | ||
create_react_app --scripts-version=$temp_app_path/enoah-scripts-0.9.0.tgz test-app-scoped-fork-tgz | ||
npx create-react-app --scripts-version=$temp_app_path/enoah-scripts-0.9.0.tgz test-app-scoped-fork-tgz | ||
cd test-app-scoped-fork-tgz | ||
|
||
# Check corresponding scripts version is installed. | ||
|
@@ -216,22 +200,22 @@ cd "$temp_app_path" | |
mkdir test-app-nested-paths-t1 | ||
cd test-app-nested-paths-t1 | ||
mkdir -p test-app-nested-paths-t1/aa/bb/cc/dd | ||
create_react_app test-app-nested-paths-t1/aa/bb/cc/dd | ||
npx create-react-app test-app-nested-paths-t1/aa/bb/cc/dd | ||
cd test-app-nested-paths-t1/aa/bb/cc/dd | ||
npm start -- --smoke-test | ||
yarn start --smoke-test | ||
|
||
# Testing a path that does not exist | ||
cd "$temp_app_path" | ||
create_react_app test-app-nested-paths-t2/aa/bb/cc/dd | ||
npx create-react-app test-app-nested-paths-t2/aa/bb/cc/dd | ||
cd test-app-nested-paths-t2/aa/bb/cc/dd | ||
npm start -- --smoke-test | ||
yarn start --smoke-test | ||
|
||
# Testing a path that is half exists | ||
cd "$temp_app_path" | ||
mkdir -p test-app-nested-paths-t3/aa | ||
create_react_app test-app-nested-paths-t3/aa/bb/cc/dd | ||
npx create-react-app test-app-nested-paths-t3/aa/bb/cc/dd | ||
cd test-app-nested-paths-t3/aa/bb/cc/dd | ||
npm start -- --smoke-test | ||
yarn start --smoke-test | ||
|
||
# Cleanup | ||
cleanup | ||
cleanup |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can just keep
e2e-simple
as the others test a lot of stuff fromcreate-react-app
we don't care about.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
install
is disabled for now.