endtoend-build-ci 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #!/usr/bin/env bash
  2. set -o pipefail
  3. set -o errexit
  4. set -o nounset
  5. set -o xtrace
  6. # Set magic variables for current file & dir
  7. __dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
  8. __file="${__dir}/$(basename "${BASH_SOURCE[0]}")"
  9. __base="$(basename ${__file} .sh)"
  10. __root="$(cd "$(dirname "${__dir}")" && pwd)"
  11. VERDACCIO_REGISTRY=http://localhost:4002
  12. cleanup() {
  13. rm -rf "${__root}/test/endtoend/node_modules"
  14. rm -rf "${__root}/test/endtoend/tmp"
  15. }
  16. echo "Preparing for end to end test: copying static HTML and CSS, building JS"
  17. rm -rf "${__root}/test/endtoend/node_modules"
  18. PACKAGES="$(for pkg in packages/@uppy/*; do echo "${pkg#packages/}"; done)"
  19. cleanup
  20. npm run build
  21. # https://github.com/facebook/create-react-app/pull/4626
  22. (cd && npm-auth-to-token -u user -p password -e user@example.com -r "$VERDACCIO_REGISTRY")
  23. # Simulate a publish of everything, to the local registry,
  24. # without changing things in git
  25. # Use --cd-version to skip version prompts
  26. lerna publish --yes \
  27. --force-publish="*" \
  28. --registry="$VERDACCIO_REGISTRY" \
  29. --npm-client=npm \
  30. --skip-git \
  31. --cd-version=prerelease
  32. # revert version changes
  33. git checkout -- packages/*/package.json packages/@uppy/*/package.json
  34. # install all packages to the endtoend folder
  35. # (Don't use the npm cache, don't generate a package-lock, don't save dependencies to any package.json)
  36. (cd "${__root}/test/endtoend" && npm install --prefer-online --registry "$VERDACCIO_REGISTRY" --no-package-lock --no-save uppy $PACKAGES)
  37. bash "${__dir}/endtoend-build-tests"
  38. cleanup