2019-02-11 21:05:28 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
#
|
|
|
|
# install & unit test zammad
|
|
|
|
#
|
|
|
|
|
|
|
|
set -o errexit
|
|
|
|
set -o pipefail
|
|
|
|
|
|
|
|
# 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-05 18:43:50 +00:00
|
|
|
# create db config
|
|
|
|
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"
|
|
|
|
|
2020-03-04 20:23:02 +00:00
|
|
|
if [ "${ZAMMAD_DBS}" == "mysql" ]; then
|
2019-02-11 21:05:28 +00:00
|
|
|
DB_ADAPTER="mysql2"
|
2020-03-05 18:43:50 +00:00
|
|
|
DB_USERNAME="root"
|
|
|
|
DB_PASSWORD="password"
|
|
|
|
DB_PORT="13306"
|
2019-02-11 21:05:28 +00:00
|
|
|
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"
|
2020-03-05 18:43:50 +00:00
|
|
|
DB_USERNAME="postgres"
|
|
|
|
DB_PASSWORD="postgres"
|
|
|
|
DB_PORT="5432"
|
2019-02-11 21:05:28 +00:00
|
|
|
INSTALL_OPTION="mysql"
|
|
|
|
fi
|
|
|
|
|
2020-03-05 18:43:50 +00:00
|
|
|
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
|
2019-02-11 21:05:28 +00:00
|
|
|
|
|
|
|
# install zammad
|
2020-03-05 18:43:50 +00:00
|
|
|
gem install bundler:1.7.3
|
2019-02-11 21:05:28 +00:00
|
|
|
bundle install --without "${INSTALL_OPTION}"
|
|
|
|
|
|
|
|
# unit tests
|
2020-03-06 08:54:05 +00:00
|
|
|
bundle exec rubocop
|
2020-03-05 18:43:50 +00:00
|
|
|
bundle exec rake zammad:db:init
|
2021-06-18 13:06:22 +00:00
|
|
|
bundle exec rspec -t ~type:system -t ~searchindex -t ~required_envs
|
2020-03-05 18:43:50 +00:00
|
|
|
bundle exec rake zammad:db:reset
|
|
|
|
bundle exec rake test:units
|
2019-02-11 21:05:28 +00:00
|
|
|
ruby -I test/ test/integration/object_manager_test.rb
|
|
|
|
ruby -I test/ test/integration/package_test.rb
|