Merge remote-tracking branch 'monotek/develop' into develop
This commit is contained in:
commit
de15ce2cdf
11 changed files with 163 additions and 149 deletions
67
.circleci/config.yml
Normal file
67
.circleci/config.yml
Normal file
|
@ -0,0 +1,67 @@
|
|||
version: 2.1
|
||||
jobs:
|
||||
lint-scripts:
|
||||
docker:
|
||||
- image: koalaman/shellcheck-alpine
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
name: lint-scripts
|
||||
command: .circleci/lint-scripts.sh
|
||||
|
||||
install-mysql:
|
||||
docker:
|
||||
- image: circleci/ruby:2.4.4
|
||||
- image: circleci/mysql:5.7-ram
|
||||
command: --max_allowed_packet=64MB
|
||||
environment:
|
||||
MYSQL_DATABASE: zammad_test
|
||||
MYSQL_USER: zammad_test
|
||||
MYSQL_PASSWORD: zammad_test
|
||||
environment:
|
||||
RAILS_ENV: test
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
name: install-mysql
|
||||
command: .circleci/install.sh
|
||||
|
||||
install-postgresql:
|
||||
docker:
|
||||
- image: circleci/ruby:2.4.4
|
||||
- image: circleci/postgres:11-ram
|
||||
environment:
|
||||
POSTGRES_DB: zammad_test
|
||||
POSTGRES_USER: zammad_test
|
||||
POSTGRES_PASSWORD: zammad_test
|
||||
environment:
|
||||
RAILS_ENV: test
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
name: install-postgresql
|
||||
command: .circleci/install.sh
|
||||
|
||||
docker-image-build:
|
||||
machine: true
|
||||
steps:
|
||||
- checkout
|
||||
- run:
|
||||
name: docker-image-build
|
||||
command: .circleci/docker-image-build.sh
|
||||
|
||||
workflows:
|
||||
version: 2
|
||||
install_unittest_dockerbuild:
|
||||
jobs:
|
||||
- lint-scripts
|
||||
- install-mysql:
|
||||
requires:
|
||||
- lint-scripts
|
||||
- install-postgresql:
|
||||
requires:
|
||||
- lint-scripts
|
||||
- docker-image-build:
|
||||
requires:
|
||||
- install-mysql
|
||||
- install-postgresql
|
35
.circleci/docker-image-build.sh
Executable file
35
.circleci/docker-image-build.sh
Executable file
|
@ -0,0 +1,35 @@
|
|||
#!/usr/bin/env bash
|
||||
#
|
||||
# build zammads docker & docker-compose images
|
||||
|
||||
set -o errexit
|
||||
set -o pipefail
|
||||
|
||||
REPO_ROOT="$(git rev-parse --show-toplevel)"
|
||||
REPO_USER="zammad"
|
||||
ZAMMAD_VERSION="$(git describe --tags | sed -e 's/-[a-z0-9]\{8,\}.*//g')"
|
||||
export ZAMMAD_VERSION
|
||||
|
||||
if [ "${CIRCLE_BRANCH}" == 'develop' ]; then
|
||||
DOCKER_REPOSITORY="zammad-docker"
|
||||
BUILD_SCRIPT="scripts/build_image.sh"
|
||||
elif [ "${CIRCLE_BRANCH}" == 'stable' ]; then
|
||||
DOCKER_REPOSITORY="zammad-docker-compose"
|
||||
BUILD_SCRIPT="hooks/build.sh"
|
||||
else
|
||||
echo "branch is ${CIRCLE_BRANCH}... no docker image build needed..."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# dockerhub auth
|
||||
echo "${DOCKER_PASSWORD}" | docker login --username="${DOCKER_USERNAME}" --password-stdin
|
||||
|
||||
# clone docker repo
|
||||
git clone https://github.com/"${REPO_USER}"/"${DOCKER_REPOSITORY}"
|
||||
|
||||
# enter dockerfile dir
|
||||
cd "${REPO_ROOT}/${DOCKER_REPOSITORY}"
|
||||
|
||||
# build & push docker image
|
||||
# shellcheck disable=SC1090
|
||||
source "${REPO_ROOT}/${DOCKER_REPOSITORY}/${BUILD_SCRIPT}"
|
41
.circleci/install.sh
Executable file
41
.circleci/install.sh
Executable file
|
@ -0,0 +1,41 @@
|
|||
#!/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
|
||||
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
|
||||
|
||||
if [ "${CIRCLE_JOB}" == "install-mysql" ]; then
|
||||
DB_ADAPTER="mysql2"
|
||||
INSTALL_OPTION="postgres"
|
||||
elif [ "${CIRCLE_JOB}" == "install-postgresql" ]; then
|
||||
DB_ADAPTER="postgresql"
|
||||
INSTALL_OPTION="mysql"
|
||||
else
|
||||
echo "nothing to do for circle ci job ${CIRCLE_JOB}..."
|
||||
exit 0
|
||||
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
|
||||
bundle exec rspec -t ~type:system
|
||||
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
|
18
.circleci/lint-scripts.sh
Executable file
18
.circleci/lint-scripts.sh
Executable file
|
@ -0,0 +1,18 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# lint bash scripts
|
||||
#
|
||||
|
||||
set -o errexit
|
||||
|
||||
CONFIG_DIR="./.circleci"
|
||||
TMP_FILE="$(mktemp)"
|
||||
|
||||
find "${CONFIG_DIR}" -type f -name "*.sh" > "${TMP_FILE}"
|
||||
|
||||
while read -r FILE; do
|
||||
echo lint "${FILE}"
|
||||
shellcheck -x "${FILE}"
|
||||
done < "${TMP_FILE}"
|
||||
|
||||
rm "${TMP_FILE}"
|
70
.travis.yml
70
.travis.yml
|
@ -1,70 +0,0 @@
|
|||
dist: xenial
|
||||
sudo: false
|
||||
notifications:
|
||||
email:
|
||||
- me+tv@zammad.com
|
||||
env:
|
||||
- DB=mysql
|
||||
- DB=postgresql
|
||||
addons:
|
||||
apt:
|
||||
packages:
|
||||
- autoconf
|
||||
- automake
|
||||
- autotools-dev
|
||||
- bison
|
||||
- build-essential
|
||||
- curl
|
||||
- git-core
|
||||
- libffi-dev
|
||||
- libgdbm-dev
|
||||
- libgmp-dev
|
||||
- libmysqlclient-dev
|
||||
- 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
|
||||
services:
|
||||
- mysql
|
||||
- postgresql
|
||||
language: ruby
|
||||
rvm:
|
||||
- 2.4.4
|
||||
before_install:
|
||||
- gem update --system # Due to: https://github.com/travis-ci/travis-ci/issues/8978
|
||||
- git fetch --unshallow
|
||||
- if [ "${DB}" = "mysql" ]; then mysql -u root -e "CREATE USER 'some_user'@'localhost' IDENTIFIED BY 'some_pass';"; fi
|
||||
- if [ "${DB}" = "mysql" ]; then mysql -u root -e "GRANT ALL PRIVILEGES ON *.* TO 'some_user'@'localhost';"; fi
|
||||
- if [ "${DB}" = "mysql" ]; then cp contrib/travis-ci.org/database.yml.test-mysql config/database.yml; fi
|
||||
- if [ "${DB}" = "postgresql" ]; then psql -c 'create database zammad_test;' -U postgres; fi
|
||||
- if [ "${DB}" = "postgresql" ]; then cp contrib/travis-ci.org/database.yml.test-postgresql config/database.yml; fi
|
||||
- export RAILS_ENV=test
|
||||
- export ZAMMAD_VERSION=$(git describe --tags | sed -e 's/-[a-z0-9]\{8,\}.*//g')
|
||||
install:
|
||||
- if [ "${DB}" = "mysql" ]; then bundle install --without postgres; fi
|
||||
- if [ "${DB}" = "postgresql" ]; then bundle install; fi
|
||||
script:
|
||||
- bundle exec rubocop
|
||||
- rake db:create
|
||||
- rake db:migrate
|
||||
- rake db:seed
|
||||
- bundle exec rspec -t ~type:system
|
||||
- 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
|
||||
after_success:
|
||||
- if [ "${DB}" = "mysql" ]; then contrib/travis-ci.org/trigger_docker_image_build.sh; fi
|
||||
- if [ "${DB}" = "mysql" ]; then contrib/travis-ci.org/trigger_docker_image_compose_build.sh; fi
|
||||
- if [ "${DB}" = "mysql" ]; then contrib/travis-ci.org/trigger_docker_image_univention_build.sh; fi
|
|
@ -11,7 +11,7 @@ You're going to love Zammad!
|
|||
|
||||
## Status
|
||||
|
||||
- Build: [![Build Status](https://travis-ci.org/zammad/zammad.svg?branch=develop)](https://travis-ci.org/zammad/zammad)
|
||||
- Build: [![Build Status](https://circleci.com/gh/zammad/zammad.svg?style=svg)](https://circleci.com/gh/zammad/zammad)
|
||||
- Code: [![Code Climate](https://codeclimate.com/github/zammad/zammad/badges/gpa.svg)](https://codeclimate.com/github/zammad/zammad) [![Coverage Status](https://coveralls.io/repos/github/zammad/zammad/badge.svg)](https://coveralls.io/github/zammad/zammad)
|
||||
- Docs: [![Documentation Status](https://readthedocs.org/projects/zammad/badge/)](https://docs.zammad.org)
|
||||
- Issues: [![Percentage of issues still open](http://isitmaintained.com/badge/open/zammad/zammad.svg)](https://github.com/zammad/zammad/issues "Percentage of issues still open") [![Average time to resolve an issue](http://isitmaintained.com/badge/resolution/zammad/zammad.svg)](https://github.com/zammad/zammad/issues?q=is%3Aissue+is%3Aclosed "Average time to resolve an issue")
|
||||
|
@ -44,4 +44,3 @@ https://zammad.org/participate
|
|||
Thanks! ❤️ ❤️ ❤️
|
||||
|
||||
Your Zammad Team
|
||||
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
# Warning: The database defined as "test" will be erased and
|
||||
# re-generated from your development database when you run "rake".
|
||||
# Do not set this db to the same as development or production.
|
||||
test:
|
||||
adapter: mysql2
|
||||
database: zammad_test
|
||||
pool: 50
|
||||
timeout: 5000
|
||||
encoding: utf8
|
||||
username: some_user
|
||||
password: some_pass
|
|
@ -1,11 +0,0 @@
|
|||
# Warning: The database defined as "test" will be erased and
|
||||
# re-generated from your development database when you run "rake".
|
||||
# Do not set this db to the same as development or production.
|
||||
test:
|
||||
adapter: postgresql
|
||||
database: zammad_test
|
||||
pool: 50
|
||||
timeout: 5000
|
||||
encoding: utf8
|
||||
username: postgres
|
||||
password:
|
|
@ -1,18 +0,0 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# trigger build of https://github.com/zammad/zammad-docker on https://travis-ci.org/zammad/zammad-docker and upload it to https://hub.docker.com/r/zammad/zammad
|
||||
#
|
||||
|
||||
REPO_USER="zammad"
|
||||
REPO="zammad-docker"
|
||||
BRANCH="master"
|
||||
|
||||
if [ "${TRAVIS_BRANCH}" == 'develop' ]; then
|
||||
curl -X POST \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Travis-API-Version: 3" \
|
||||
-H "Accept: application/json" \
|
||||
-H "Authorization: token ${TRAVIS_API_TOKEN}" \
|
||||
-d '{"request":{ "message": "'"${TRAVIS_COMMIT_MESSAGE}"'","branch":"'${BRANCH}'","config":{"env":{"ZAMMAD_VERSION":"'${ZAMMAD_VERSION}'"}}}}' \
|
||||
"https://api.travis-ci.org/repo/${REPO_USER}%2F${REPO}/requests"
|
||||
fi
|
|
@ -1,18 +0,0 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# trigger build of https://github.com/zammad/zammad-docker-compose on https://travis-ci.org/zammad/zammad-docker-compose and upload it to https://hub.docker.com/r/zammad/zammad-docker-compose/
|
||||
#
|
||||
|
||||
REPO_USER="zammad"
|
||||
REPO="zammad-docker-compose"
|
||||
BRANCH="master"
|
||||
|
||||
if [ "${TRAVIS_BRANCH}" == 'stable' ]; then
|
||||
curl -X POST \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Travis-API-Version: 3" \
|
||||
-H "Accept: application/json" \
|
||||
-H "Authorization: token ${TRAVIS_API_TOKEN}" \
|
||||
-d '{"request":{ "message": "'"${TRAVIS_COMMIT_MESSAGE}"'","branch":"'${BRANCH}'","config":{"env":{"ZAMMAD_VERSION":"'${ZAMMAD_VERSION}'"}}}}' \
|
||||
"https://api.travis-ci.org/repo/${REPO_USER}%2F${REPO}/requests"
|
||||
fi
|
|
@ -1,18 +0,0 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# trigger build of https://github.com/zammad/zammad-docker-univention on https://travis-ci.org/zammad/zammad-docker-univention and upload it to https://hub.docker.com/r/zammad/zammad-docker-univention
|
||||
#
|
||||
|
||||
REPO_USER="zammad"
|
||||
REPO="zammad-docker-univention"
|
||||
BRANCH="master"
|
||||
|
||||
if [ "${TRAVIS_BRANCH}" == 'stable' ]; then
|
||||
curl -X POST \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Travis-API-Version: 3" \
|
||||
-H "Accept: application/json" \
|
||||
-H "Authorization: token ${TRAVIS_API_TOKEN}" \
|
||||
-d '{"request":{ "message": "'"${TRAVIS_COMMIT_MESSAGE}"'","branch":"'${BRANCH}'","config":{"env":{"ZAMMAD_VERSION":"'${ZAMMAD_VERSION}'"}}}}' \
|
||||
"https://api.travis-ci.org/repo/${REPO_USER}%2F${REPO}/requests"
|
||||
fi
|
Loading…
Reference in a new issue