2019-02-11 21:05:28 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
#
|
|
|
|
# install & unit test zammad
|
|
|
|
#
|
|
|
|
|
|
|
|
set -o errexit
|
|
|
|
set -o pipefail
|
|
|
|
|
|
|
|
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"
|
|
|
|
|
|
|
|
# install build dependencies
|
|
|
|
sudo apt-get update
|
2019-02-14 05:42:41 +00:00
|
|
|
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
|
2019-02-11 21:05:28 +00:00
|
|
|
|
2020-03-04 20:23:02 +00:00
|
|
|
if [ "${ZAMMAD_DBS}" == "mysql" ]; then
|
2019-02-11 21:05:28 +00:00
|
|
|
DB_ADAPTER="mysql2"
|
|
|
|
INSTALL_OPTION="postgres"
|
2020-03-04 20:23:02 +00:00
|
|
|
elif [ "${ZAMMAD_DBS}" == "postgresql" ]; then
|
2019-02-11 21:05:28 +00:00
|
|
|
DB_ADAPTER="postgresql"
|
|
|
|
INSTALL_OPTION="mysql"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# create db config
|
|
|
|
echo -e "${DB_CONFIG}" | sed "s/adapter: postgresql/adapter: ${DB_ADAPTER}/g" > config/database.yml
|
|
|
|
|
|
|
|
# install zammad
|
|
|
|
bundle install --without "${INSTALL_OPTION}"
|
|
|
|
|
|
|
|
# unit tests
|
|
|
|
bundle exec rubocop
|
|
|
|
rake db:migrate
|
|
|
|
rake db:seed
|
2019-09-26 12:08:17 +00:00
|
|
|
bundle exec rspec -t ~type:system -t ~searchindex
|
2019-02-11 21:05:28 +00:00
|
|
|
bundle exec rake db:environment:set RAILS_ENV=test
|
|
|
|
rake db:reset
|
|
|
|
rake test:units
|
|
|
|
ruby -I test/ test/integration/object_manager_test.rb
|
|
|
|
ruby -I test/ test/integration/package_test.rb
|