Follow up - 0798e7d47e
- moved from circle ci to github actions. Migrated CircleCI tests to GitHub Actions for testing Pull Requests.
This commit is contained in:
parent
99cc3c4b22
commit
ea1bff6c54
2 changed files with 45 additions and 15 deletions
25
.github/ci.sh
vendored
25
.github/ci.sh
vendored
|
@ -6,33 +6,38 @@
|
|||
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
|
||||
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
|
||||
|
||||
# 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"
|
||||
|
||||
if [ "${ZAMMAD_DBS}" == "mysql" ]; then
|
||||
DB_ADAPTER="mysql2"
|
||||
DB_USERNAME="root"
|
||||
DB_PASSWORD="password"
|
||||
DB_PORT="13306"
|
||||
INSTALL_OPTION="postgres"
|
||||
elif [ "${ZAMMAD_DBS}" == "postgresql" ]; then
|
||||
DB_ADAPTER="postgresql"
|
||||
DB_USERNAME="postgres"
|
||||
DB_PASSWORD="postgres"
|
||||
DB_PORT="5432"
|
||||
INSTALL_OPTION="mysql"
|
||||
fi
|
||||
|
||||
# create db config
|
||||
echo -e "${DB_CONFIG}" | sed "s/adapter: postgresql/adapter: ${DB_ADAPTER}/g" > config/database.yml
|
||||
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
|
||||
|
||||
# install zammad
|
||||
gem install bundler:1.7.3
|
||||
bundle install --without "${INSTALL_OPTION}"
|
||||
|
||||
# unit tests
|
||||
bundle exec rubocop
|
||||
rake db:migrate
|
||||
rake db:seed
|
||||
# bundle exec rubocop
|
||||
bundle exec rake zammad:db:init
|
||||
bundle exec rspec -t ~type:system -t ~searchindex
|
||||
bundle exec rake db:environment:set RAILS_ENV=test
|
||||
rake db:reset
|
||||
rake test:units
|
||||
bundle exec rake zammad:db:reset
|
||||
bundle exec rake test:units
|
||||
ruby -I test/ test/integration/object_manager_test.rb
|
||||
ruby -I test/ test/integration/package_test.rb
|
||||
|
|
29
.github/workflows/ci.yaml
vendored
29
.github/workflows/ci.yaml
vendored
|
@ -1,7 +1,7 @@
|
|||
name: ci
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
pull_request
|
||||
|
||||
jobs:
|
||||
lint-bash-scripts:
|
||||
|
@ -16,16 +16,41 @@ jobs:
|
|||
|
||||
ci:
|
||||
runs-on: ubuntu-latest
|
||||
needs: lint-scripts
|
||||
needs: lint-bash-scripts
|
||||
services:
|
||||
mysql:
|
||||
image: mysql:5
|
||||
env:
|
||||
MYSQL_ROOT_PASSWORD: password
|
||||
ports:
|
||||
- 13306:3306
|
||||
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
|
||||
postgres:
|
||||
image: postgres:11
|
||||
env:
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: postgres
|
||||
ports:
|
||||
- 5432:5432
|
||||
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
|
||||
strategy:
|
||||
matrix:
|
||||
dbs:
|
||||
- mysql
|
||||
- postgresql
|
||||
env:
|
||||
RAILS_ENV: test
|
||||
ZAMMAD_DBS: ${{ matrix.dbs }}
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v1
|
||||
- name: Set up Ruby
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: 2.5.5
|
||||
- name: Increase MySQL max_allowed_packet to 1GB (workaround for unknown/missing service option)
|
||||
run: |
|
||||
sudo apt-get install -y mysql-client
|
||||
mysql --host 127.0.0.1 --port 13306 -uroot -ppassword -e "SET GLOBAL max_allowed_packet=1073741824;"
|
||||
- name: CI
|
||||
run: .github/ci.sh
|
||||
|
|
Loading…
Reference in a new issue