endtoend-build-ci 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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. function on_exit() {
  17. # revert to public registry
  18. npm set registry https://registry.npmjs.org
  19. cleanup
  20. }
  21. trap on_exit EXIT
  22. echo "Preparing for end to end test: copying static HTML and CSS, building JS"
  23. rm -rf "${__root}/test/endtoend/node_modules"
  24. # list of @uppy/* packages
  25. PACKAGES="$(for pkg in packages/@uppy/*; do echo "${pkg#packages/}"; done)"
  26. cleanup
  27. # Initialise verdaccio storage path.
  28. mkdir -p "${__root}/test/endtoend/tmp/verdaccio"
  29. npm run build
  30. # https://github.com/facebook/create-react-app/pull/4626
  31. (cd && npm-auth-to-token -u user -p password -e user@example.com -r "$VERDACCIO_REGISTRY")
  32. # Simulate a publish of everything, to the local registry,
  33. # without changing things in git
  34. # Use --cd-version to skip version prompts
  35. lerna publish --yes \
  36. --force-publish \
  37. --registry="$VERDACCIO_REGISTRY" \
  38. --npm-client=npm \
  39. --no-git-tag-version --no-push \
  40. --canary
  41. # revert version changes
  42. git checkout -- packages/*/package.json packages/@uppy/*/package.json
  43. # install all packages to the endtoend folder
  44. # (Don't use the npm cache, don't generate a package-lock, don't save dependencies to any package.json)
  45. pushd "${__root}/test/endtoend"
  46. npm install \
  47. --prefer-online \
  48. --registry "$VERDACCIO_REGISTRY" \
  49. --no-package-lock \
  50. --no-save \
  51. uppy $PACKAGES
  52. popd
  53. bash "${__dir}/endtoend-build-tests"
  54. cleanup