diff --git a/.travis.yml b/.travis.yml index 96bbcf2161..a61a87d351 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,8 +1,9 @@ import: - - source: .travis.env-vars.yml - - source: .travis.tests-stage.yml - - source: .travis.release-stage.yml - - source: .travis.publish-stage.yml + - source: travis/.travis.env-vars.yml + - source: travis/.travis.tests-stage.yml + - source: travis/.travis.integration-test-MySQL.yml + - source: travis/.travis.release-stage.yml + - source: travis/.travis.publish-stage.yml dist: xenial sudo: required language: java diff --git a/scripts/mysql/common.sh b/scripts/mysql/common.sh new file mode 100755 index 0000000000..f6ed525df9 --- /dev/null +++ b/scripts/mysql/common.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash +set -e +CONTAINER_NAME=alfresco-db-mysql + +MYSQL_USER=alfresco +MYSQL_ROOT_PASSWORD=alfresco +MYSQL_DATABASE=alfresco + +MYSQL_HOST=127.0.0.1 +MYSQL_PORT=3306 \ No newline at end of file diff --git a/scripts/mysql/start.sh b/scripts/mysql/start.sh new file mode 100644 index 0000000000..155572ff0e --- /dev/null +++ b/scripts/mysql/start.sh @@ -0,0 +1,43 @@ +#!/bin/bash +set -e + +. $(dirname "${BASH_SOURCE[0]}")/common.sh + +echo "============================================" +echo "Generate custom config file" +echo "============================================" +rm -rf /tmp/Docker +mkdir -p /tmp/Docker + +echo " +[mysqld] +collation-server = utf8_unicode_ci +character-set-server = utf8 +innodb_locks_unsafe_for_binlog = 1 +default_storage_engine = InnoDB +max_connections = 275 +lock_wait_timeout = 5 +innodb_buffer_pool_size = 1G +innodb_additional_mem_pool_size = 16M +innodb_log_file_size = 256M +innodb_log_buffer_size = 16M +innodb_data_file_path = ibdata1:64M:autoextend +innodb_autoextend_increment = 64 +init_file=/etc/mysql/conf.d/init-file.sql +" > /tmp/Docker/config-file.cnf + +echo " +GRANT ALL on $MYSQL_USER.* to '$MYSQL_DATABASE'@'%' identified by '$MYSQL_ROOT_PASSWORD' with grant option; +FLUSH HOSTS; +FLUSH PRIVILEGES; +" > /tmp/Docker/init-file.sql + +echo "============================================" +echo "Pulling and Running $1" +echo "============================================" +sg docker "docker run -p $MYSQL_PORT:3306 -v /tmp/Docker:/etc/mysql/conf.d --name $CONTAINER_NAME -e MYSQL_ROOT_PASSWORD=$MYSQL_ROOT_PASSWORD -e MYSQL_USER=$MYSQL_USER -e MYSQL_DATABASE=$MYSQL_DATABASE -d $1" + +sleep 120 + +# The init_file option should be enough, but some old version of MariaDB do not honor it... +docker exec -t $CONTAINER_NAME mysql -v -h $MYSQL_HOST --port=$MYSQL_PORT -u root --password=$MYSQL_ROOT_PASSWORD -e "source /etc/mysql/conf.d/init-file.sql" \ No newline at end of file diff --git a/.travis.env-vars.yml b/travis/.travis.env-vars.yml similarity index 100% rename from .travis.env-vars.yml rename to travis/.travis.env-vars.yml diff --git a/travis/.travis.integration-test-MySQL.yml b/travis/.travis.integration-test-MySQL.yml new file mode 100644 index 0000000000..233c5eaeb7 --- /dev/null +++ b/travis/.travis.integration-test-MySQL.yml @@ -0,0 +1,23 @@ +### Integration tests on MySQL are running: +## - on stable branch +## - on demand with commit message [execute tests on MySQL] + +jobs: + include: + - &integration_test_on_MYSQL + name: "Community Integrations Tests on MySQL" + services: docker + stage: Tests + if: branch =~ /(release\/.*$|master)/ OR commit_message =~ /\[execute tests on MySQL\]/ + before_install: + - source ./scripts/mysql/start.sh mysql:5.6.26 + - docker run -d -p 61617:61617 -p 5673:5673 alfresco/alfresco-activemq:5.15.8 + script: + - travis_retry travis_wait 80 mvn -B -q clean install -Puse-mysql -DskipTests -Dskip.integrationtests=false -Dmy.db.name=alfresco -Dmy.db.port=3306 -Dcommunity -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn + + - <<: *integration_test_on_MYSQL + name: "Enterprise Integrations Tests on MySQL" + install: + - travis_retry travis_wait 60 mvn -B -q clean install ${MVN_SKIP} -f rm-community/pom.xml -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn + script: + - travis_retry travis_wait 80 mvn -B -q clean install -Puse-mysql -DskipTests -Dskip.integrationtests=false -Dmy.db.name=alfresco -Dmy.db.port=3306 -f rm-enterprise/pom.xml -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn diff --git a/.travis.publish-stage.yml b/travis/.travis.publish-stage.yml similarity index 100% rename from .travis.publish-stage.yml rename to travis/.travis.publish-stage.yml diff --git a/.travis.release-stage.yml b/travis/.travis.release-stage.yml similarity index 100% rename from .travis.release-stage.yml rename to travis/.travis.release-stage.yml diff --git a/.travis.tests-stage.yml b/travis/.travis.tests-stage.yml similarity index 96% rename from .travis.tests-stage.yml rename to travis/.travis.tests-stage.yml index b368d33bec..396c05a930 100644 --- a/.travis.tests-stage.yml +++ b/travis/.travis.tests-stage.yml @@ -1,14 +1,5 @@ jobs: include: - - name: "Community Integrations Tests on MySQL" - stage: Tests - script: - - echo "Community Integrations Tests on MySQL" - - name: "Enterprise Integrations Tests on MySQL" - stage: Tests - script: - - echo "Enterprise Integrations Tests on MySQL" - - name: "Community Rest API Tests" stage: Tests install: