install.sh 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #!/usr/bin/env bash
  2. #
  3. # install & unit test zammad
  4. #
  5. set -o errexit
  6. set -o pipefail
  7. DB_CONFIG="test:\n adapter: postgresql\n database: zammad_test\n host: 127.0.0.1\n pool: 50\n timeout: 5000\n encoding: utf8\n username: zammad_test\n password: zammad_test"
  8. # install build dependencies
  9. sudo apt-get update
  10. sudo apt-get install -y --no-install-recommends autoconf automake autotools-dev bison build-essential curl git-core libffi-dev libgdbm-dev libgmp-dev libmariadbclient-dev-compat libncurses5-dev libreadline-dev libsqlite3-dev libssl-dev libtool libxml2-dev libxslt1-dev libyaml-0-2 libyaml-dev patch pkg-config postfix sqlite3 zlib1g-dev
  11. if [ "${CIRCLE_JOB}" == "install-mysql" ]; then
  12. DB_ADAPTER="mysql2"
  13. INSTALL_OPTION="postgres"
  14. elif [ "${CIRCLE_JOB}" == "install-postgresql" ]; then
  15. DB_ADAPTER="postgresql"
  16. INSTALL_OPTION="mysql"
  17. else
  18. echo "nothing to do for circle ci job ${CIRCLE_JOB}..."
  19. exit 0
  20. fi
  21. # create db config
  22. echo -e "${DB_CONFIG}" | sed "s/adapter: postgresql/adapter: ${DB_ADAPTER}/g" > config/database.yml
  23. # install zammad
  24. bundle install --without "${INSTALL_OPTION}"
  25. # unit tests
  26. bundle exec rubocop
  27. rake db:migrate
  28. rake db:seed
  29. bundle exec rspec -t ~type:system
  30. bundle exec rake db:environment:set RAILS_ENV=test
  31. rake db:reset
  32. rake test:units
  33. ruby -I test/ test/integration/object_manager_test.rb
  34. ruby -I test/ test/integration/package_test.rb