diff options
Diffstat (limited to 'Tests/travis')
-rwxr-xr-x | Tests/travis/gen_apidocs.sh | 69 | ||||
-rwxr-xr-x | Tests/travis/prepare.sh | 35 | ||||
-rwxr-xr-x | Tests/travis/prepare_mysql.sh | 53 | ||||
-rwxr-xr-x | Tests/travis/prepare_pgsql.sh | 54 |
4 files changed, 211 insertions, 0 deletions
diff --git a/Tests/travis/gen_apidocs.sh b/Tests/travis/gen_apidocs.sh new file mode 100755 index 000000000..e5938e1e8 --- /dev/null +++ b/Tests/travis/gen_apidocs.sh @@ -0,0 +1,69 @@ +#!/usr/bin/env bash + +# +# Copyright (c) 2016 Hubzilla +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +# + +# Exit if anything fails +set -e + +# Only create and deploy API documentation once, on first build job. +# Waiting for upcoming 'Build Stages' Q1/Q2 2017 to make this cleaner. +# https://github.com/travis-ci/travis-ci/issues/929 +if [[ "$TRAVIS_JOB_NUMBER" != "${TRAVIS_BUILD_NUMBER}.1" ]]; then + echo "Not the first build job. Creating API documentation only once is enough." + echo "We are finished ..." + exit +fi + +echo "Doxygen version >= 1.8 is required" +doxygen --version + +# Check if newer version of Doxygen should be used +if [ ! -z "$DOXY_VER" ]; then + export DOXY_BINPATH=$HOME/doxygen/doxygen-$DOXY_VER/bin + if [ ! -e "$DOXY_BINPATH/doxygen" ]; then + echo "Installing newer Doxygen $DOXY_VER ..." + mkdir -p $HOME/doxygen && cd $HOME/doxygen + wget -O - http://ftp.stack.nl/pub/users/dimitri/doxygen-$DOXY_VER.linux.bin.tar.gz | tar xz + export PATH=$DOXY_BINPATH:$PATH + fi + echo "Doxygen version" + doxygen --version +fi + +echo "Generating Doxygen API documentation ..." +cd $TRAVIS_BUILD_DIR +mkdir -p ./doc/html +# Redirect stderr and stdout to log file and console to be able to review documentation errors +doxygen $DOXYFILE 2>&1 | tee ./doc/html/doxygen.log + +# Check if Doxygen successfully created the documentation +if [ -d "doc/html" ] && [ -f "doc/html/index.html" ]; then + echo "API documentation generated" + if [ -n "${TRAVIS_TAG}" ]; then + echo "Generate API documentation archive for release deployment ..." + zip -9 -r -q doc/hubzilla-api-documentation.zip doc/html/ + fi +else + echo "No API documentation files have been found" >&2 + exit 1 +fi diff --git a/Tests/travis/prepare.sh b/Tests/travis/prepare.sh new file mode 100755 index 000000000..267b4ec46 --- /dev/null +++ b/Tests/travis/prepare.sh @@ -0,0 +1,35 @@ +#!/usr/bin/env bash + +# +# Copyright (c) 2016 Hubzilla +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +# + +# Exit if anything fails +set -e + +# gd is required, show some info about the used one +php -r "var_dump(gd_info());" + + +echo "Creating required folders for Hubzilla ..." +mkdir -p ./store/\[data\]/smarty3 + +echo "TODO: create .htconfig" diff --git a/Tests/travis/prepare_mysql.sh b/Tests/travis/prepare_mysql.sh new file mode 100755 index 000000000..5b1c96d78 --- /dev/null +++ b/Tests/travis/prepare_mysql.sh @@ -0,0 +1,53 @@ +#!/usr/bin/env bash + +# +# Copyright (c) 2016 Hubzilla +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +# + +# Exit if anything fails +set -e + +echo "Preparing for MySQL/MariaDB ..." + +if [[ "$MYSQL_VERSION" == "5.7" ]]; then + echo "Using MySQL 5.7 in Docker container, need to use TCP" + export PROTO="--protocol=TCP" +fi + +# Print out some MySQL information +mysql --version +mysql $PROTO -e "SELECT VERSION();" +mysql $PROTO -e "SHOW VARIABLES LIKE 'max_allowed_packet';" +mysql $PROTO -e "SHOW VARIABLES LIKE 'collation_%';" +mysql $PROTO -e "SHOW VARIABLES LIKE 'character_set%';" +mysql $PROTO -e "SELECT @@sql_mode;" + +# Create Hubzilla database +mysql $PROTO -u root -e "CREATE DATABASE IF NOT EXISTS travis_hubzilla;"; +mysql $PROTO -u root -e "CREATE USER 'travis_hz'@'%' IDENTIFIED BY 'hubzilla';" +mysql $PROTO -u root -e "GRANT ALL ON travis_hubzilla.* TO 'travis_hz'@'%';" + +# Import table structure +mysql $PROTO -u root travis_hubzilla < ./install/schema_mysql.sql + +# Show databases and tables +mysql $PROTO -u root -e "SHOW DATABASES;" +mysql $PROTO -u root -e "USE travis_hubzilla; SHOW TABLES;" diff --git a/Tests/travis/prepare_pgsql.sh b/Tests/travis/prepare_pgsql.sh new file mode 100755 index 000000000..c6b12e4d6 --- /dev/null +++ b/Tests/travis/prepare_pgsql.sh @@ -0,0 +1,54 @@ +#!/usr/bin/env bash + +# +# Copyright (c) 2016 Hubzilla +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +# + +# Exit if anything fails +set -e + +echo "Preparing for PostgreSQL ..." + +if [[ "$POSTGRESQL_VERSION" == "10" ]]; then + echo "Using PostgreSQL in Docker container, need to use TCP" + export PROTO="-h localhost" +fi + +# Print out some PostgreSQL information +psql --version +# Why does this hang further execution of the job? +psql $PROTO -U postgres -c "SELECT VERSION();" + +# Create Hubzilla database +psql $PROTO -U postgres -c "DROP DATABASE IF EXISTS travis_hubzilla;" +psql $PROTO -U postgres -v ON_ERROR_STOP=1 <<-EOSQL + CREATE USER travis_hz WITH PASSWORD 'hubzilla'; + CREATE DATABASE travis_hubzilla; + ALTER DATABASE travis_hubzilla OWNER TO travis_hz; + GRANT ALL PRIVILEGES ON DATABASE travis_hubzilla TO travis_hz; +EOSQL + +# Import table structure +psql $PROTO -U travis_hz -v ON_ERROR_STOP=1 travis_hubzilla < ./install/schema_postgres.sql + +# Show databases and tables +psql $PROTO -U postgres -l +psql $PROTO -U postgres -d travis_hubzilla -c "\dt;" |