2017-01-27 09:17:50 -08:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
2018-04-23 11:46:02 -07:00
|
|
|
set -u -e -o pipefail
|
2017-01-27 09:17:50 -08:00
|
|
|
|
2018-03-15 15:36:11 -07:00
|
|
|
# see https://circleci.com/docs/2.0/env-vars/#circleci-built-in-environment-variables
|
|
|
|
|
CI=${CI:-false}
|
2018-02-27 17:06:06 -05:00
|
|
|
|
2018-03-15 15:36:11 -07:00
|
|
|
cd "$(dirname "$0")"
|
2017-01-27 09:17:50 -08:00
|
|
|
|
2020-03-09 22:17:48 -07:00
|
|
|
# If we aren't running on CircleCI, we do not shard tests because this would be the job of
|
|
|
|
|
# Bazel eventually. For now, we just run all tests sequentially when running locally.
|
|
|
|
|
if [ -n "${1:-}" ]; then
|
|
|
|
|
readonly RUN_TESTS=$@
|
2018-04-23 11:46:02 -07:00
|
|
|
else
|
2020-03-09 22:17:48 -07:00
|
|
|
readonly RUN_TESTS=$(find $(ls) -maxdepth 0 -type d)
|
2018-03-20 12:34:27 -07:00
|
|
|
fi
|
2017-08-03 15:18:55 -07:00
|
|
|
|
2020-03-09 22:17:48 -07:00
|
|
|
echo "Running integration tests:"
|
|
|
|
|
echo ${RUN_TESTS}
|
|
|
|
|
|
|
|
|
|
# Build the packages-dist directory.
|
|
|
|
|
# This should be fast on incremental re-build.
|
|
|
|
|
node ../scripts/build/build-packages-dist.js
|
2020-02-04 11:45:40 -08:00
|
|
|
|
2017-02-10 16:23:44 -08:00
|
|
|
# Workaround https://github.com/yarnpkg/yarn/issues/2165
|
|
|
|
|
# Yarn will cache file://dist URIs and not update Angular code
|
2020-01-15 21:54:36 +02:00
|
|
|
export readonly cache=.yarn_local_cache
|
2017-02-10 16:23:44 -08:00
|
|
|
function rm_cache {
|
|
|
|
|
rm -rf $cache
|
|
|
|
|
}
|
|
|
|
|
rm_cache
|
|
|
|
|
mkdir $cache
|
|
|
|
|
trap rm_cache EXIT
|
|
|
|
|
|
2020-02-04 11:45:40 -08:00
|
|
|
for testDir in ${RUN_TESTS}; do
|
2017-01-27 09:17:50 -08:00
|
|
|
[[ -d "$testDir" ]] || continue
|
2020-02-04 11:45:40 -08:00
|
|
|
|
|
|
|
|
echo ""
|
|
|
|
|
echo "######################################################################"
|
2017-01-27 09:17:50 -08:00
|
|
|
echo "Running integration test $testDir"
|
2020-02-04 11:45:40 -08:00
|
|
|
echo "######################################################################"
|
|
|
|
|
|
2017-01-27 09:17:50 -08:00
|
|
|
(
|
|
|
|
|
cd $testDir
|
2017-08-03 15:18:55 -07:00
|
|
|
rm -rf dist
|
2018-04-23 11:46:02 -07:00
|
|
|
|
2019-11-25 17:48:18 +02:00
|
|
|
# Ensure the versions of (non-local) dependencies are exact versions (not version ranges) and
|
|
|
|
|
# in-sync between `package.json` and the lockfile.
|
|
|
|
|
# (NOTE: This must be run before `yarn install`, which updates the lockfile.)
|
|
|
|
|
node ../check-dependencies .
|
|
|
|
|
|
2017-02-10 16:23:44 -08:00
|
|
|
yarn install --cache-folder ../$cache
|
2017-02-09 19:08:16 +02:00
|
|
|
yarn test || exit 1
|
2018-10-31 13:03:22 +02:00
|
|
|
|
2018-03-15 15:36:11 -07:00
|
|
|
# remove the temporary node modules directory to keep the source folder clean.
|
|
|
|
|
rm -rf node_modules
|
2017-01-27 09:17:50 -08:00
|
|
|
)
|
|
|
|
|
done
|