ci.sh 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #!/usr/bin/env bash
  2. #
  3. # install & unit test zammad
  4. #
  5. set -o errexit
  6. set -o pipefail
  7. # install build dependencies
  8. sudo apt-get update
  9. 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 libimlib2 libimlib2-dev
  10. # create db config
  11. DB_CONFIG="test:\n adapter: postgresql\n database: zammad_test\n host: 127.0.0.1\n port: DB_PORT\n pool: 50\n timeout: 5000\n encoding: utf8\n username: DB_USERNAME\n password: DB_PASSWORD"
  12. if [ "${ZAMMAD_DBS}" == "mysql" ]; then
  13. DB_ADAPTER="mysql2"
  14. DB_USERNAME="root"
  15. DB_PASSWORD="password"
  16. DB_PORT="13306"
  17. INSTALL_OPTION="postgres"
  18. elif [ "${ZAMMAD_DBS}" == "postgresql" ]; then
  19. DB_ADAPTER="postgresql"
  20. DB_USERNAME="postgres"
  21. DB_PASSWORD="postgres"
  22. DB_PORT="5432"
  23. INSTALL_OPTION="mysql"
  24. fi
  25. echo -e "${DB_CONFIG}" | sed -e "s/adapter: postgresql/adapter: ${DB_ADAPTER}/g" -e "s/DB_USERNAME/${DB_USERNAME}/g" -e "s/DB_PASSWORD/${DB_PASSWORD}/g" -e "s/DB_PORT/${DB_PORT}/g" > config/database.yml
  26. # install zammad
  27. gem install bundler:1.7.3
  28. bundle install --without "${INSTALL_OPTION}"
  29. # unit tests
  30. bundle exec rubocop
  31. bundle exec rake zammad:db:init
  32. bundle exec rspec -t ~type:system -t ~searchindex -t ~required_envs
  33. bundle exec rake zammad:db:reset
  34. bundle exec rake test:units
  35. ruby -I test/ test/integration/object_manager_test.rb
  36. ruby -I test/ test/integration/package_test.rb