diff options
author | Klaus Weidenbach <Klaus.Weidenbach@gmx.net> | 2016-10-22 22:43:25 +0200 |
---|---|---|
committer | Klaus Weidenbach <Klaus.Weidenbach@gmx.net> | 2017-03-14 20:31:13 +0100 |
commit | 33153b8f3a2e4974ae5b1e9f4017f669e35207fe (patch) | |
tree | e4d67029439358c6decb25d04a79e1c65245a99f /tests | |
parent | bdfdd23b36cac0881ef4096180e1c9242753dd49 (diff) | |
download | volse-hubzilla-33153b8f3a2e4974ae5b1e9f4017f669e35207fe.tar.gz volse-hubzilla-33153b8f3a2e4974ae5b1e9f4017f669e35207fe.tar.bz2 volse-hubzilla-33153b8f3a2e4974ae5b1e9f4017f669e35207fe.zip |
[FEATURE] :construction_worker: Extend Travis CI integration.
Testing several Travis CI features.
Add DBs to travis execution matrix.
Doxygen API docu generation and deployment to gh-pages.
Update phpunit to 5.7.
Diffstat (limited to 'tests')
l--------- | tests/phpunit-mariadb.xml | 1 | ||||
-rw-r--r-- | tests/phpunit-mysql.xml | 37 | ||||
-rw-r--r-- | tests/phpunit-pgsql.xml | 34 | ||||
-rwxr-xr-x | tests/travis/gen_apidocs.sh | 86 | ||||
-rwxr-xr-x | tests/travis/prepare.sh | 35 | ||||
-rwxr-xr-x | tests/travis/prepare_mysql.sh | 37 | ||||
-rwxr-xr-x | tests/travis/prepare_pgsql.sh | 37 |
7 files changed, 267 insertions, 0 deletions
diff --git a/tests/phpunit-mariadb.xml b/tests/phpunit-mariadb.xml new file mode 120000 index 000000000..63656b78b --- /dev/null +++ b/tests/phpunit-mariadb.xml @@ -0,0 +1 @@ +phpunit-mysql.xml
\ No newline at end of file diff --git a/tests/phpunit-mysql.xml b/tests/phpunit-mysql.xml new file mode 100644 index 000000000..b421d7a7b --- /dev/null +++ b/tests/phpunit-mysql.xml @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8"?> +<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/5.7/phpunit.xsd" + backupGlobals="false" + beStrictAboutCoversAnnotation="true" + beStrictAboutOutputDuringTests="true" + beStrictAboutTestsThatDoNotTestAnything="true" + beStrictAboutTodoAnnotatedTests="true" + processIsolation="true" + verbose="true"> + <testsuite name="Hubzilla default Test Suite"> + <directory suffix="Test.php">./unit/</directory> + </testsuite> + <testsuite name="API Test Suite"> + <directory suffix="Test.php" prefix="API">./unit/</directory> + </testsuite> + <testsuite name="Ex-/Import Test Suite"> + <directory suffix="Test.php">./unit/eximport/</directory> + </testsuite> + <groups> + <exclude> + <group>postgresql</group> + </exclude> + </groups> + <!--cover reporting--> + <filter> + <whitelist processUncoveredFilesFromWhitelist="true"> + <directory suffix=".php">../Zotlabs/</directory> + <directory suffix=".php">../include/</directory> + </whitelist> + </filter> + <logging> + <log type="junit" target="./results/junit.xml" logIncompleteSkipped="false"/> + <log type="coverage-html" target="./results/report/" lowUpperBound="35" + highLowerBound="70"/> + </logging> +</phpunit> diff --git a/tests/phpunit-pgsql.xml b/tests/phpunit-pgsql.xml new file mode 100644 index 000000000..f59dd05ad --- /dev/null +++ b/tests/phpunit-pgsql.xml @@ -0,0 +1,34 @@ +<?xml version="1.0" encoding="UTF-8"?> +<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/5.7/phpunit.xsd" + backupGlobals="false" + beStrictAboutCoversAnnotation="true" + beStrictAboutOutputDuringTests="true" + beStrictAboutTestsThatDoNotTestAnything="true" + beStrictAboutTodoAnnotatedTests="true" + processIsolation="true" + verbose="true"> + <testsuite name="Hubzilla default Test Suite"> + <directory suffix="Test.php">./unit/</directory> + </testsuite> + <testsuite name="API Test Suite"> + <directory suffix="Test.php" prefix="API">./unit/</directory> + </testsuite> + <groups> + <exclude> + <group>mysql</group> + </exclude> + </groups> + <!--cover reporting--> + <filter> + <whitelist processUncoveredFilesFromWhitelist="true"> + <directory suffix=".php">../Zotlabs/</directory> + <directory suffix=".php">../include/</directory> + </whitelist> + </filter> + <logging> + <log type="junit" target="./results/junit.xml" logIncompleteSkipped="false"/> + <log type="coverage-html" target="./results/report/" lowUpperBound="35" + highLowerBound="70"/> + </logging> +</phpunit> diff --git a/tests/travis/gen_apidocs.sh b/tests/travis/gen_apidocs.sh new file mode 100755 index 000000000..dc25347c6 --- /dev/null +++ b/tests/travis/gen_apidocs.sh @@ -0,0 +1,86 @@ +#!/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 + +# @TODO get newer doxygen +echo "Doxygen version 1.7 is too old for us :(" +doxygen --version + +# Only build API documentation for master branch push +if [[ "$TRAVIS_EVENT_TYPE" != "push" ]] || [[ "$TRAVIS_BRANCH" != "master" ]]; then + echo "Conditions not met to build API documentation." + echo "We are finished ..." + exit +fi + +echo "Generating Doxygen API documentation for master ..." + +cd $TRAVIS_BUILD_DIR +mkdir -p ./doc/html + +# Redirect stderr and stdout to log file and console +doxygen $DOXYFILE 2>&1 | tee ./doc/html/doxygen.log + +# Check if GitHub token is configured in Travis to be able to push to the repo +if [ -z "$GHP_TOKEN" ]; then + echo "No GitHub token configured in Travis, can not deploy to gh-pages ..." + echo "Add Environment Variable 'GHP_TOKEN' in Travis CI project settings" + echo "with a 'Personal access token' from GitHub with 'repo:public_repo'." + exit +fi + +# Upload the API documentation to the gh-pages branch of the GitHub repository. +# Only upload if Doxygen successfully created the documentation. +if [ -d "doc/html" ] && [ -f "doc/html/index.html" ]; then + echo "Uploading API documentation to the gh-pages branch ..." + + # Add the new API documentation as a Git commit + cd ./doc/html + + # Create and configure a new git repo for committing to gh-pages + git init + # Add a fake Travis CI user + git config user.name "Travis CI" + git config user.email "travis@travis-ci.org" + # Add the generated API documentation + git add --all + git commit -q -m "API documentation generated by Travis build: ${TRAVIS_BUILD_NUMBER}" -m "From commit: ${TRAVIS_COMMIT}" + + # No need for a history, force push to the remote gh-pages branch + git push -f "https://${GHP_TOKEN}@${GHP_REPO_REF}" master:gh-pages > /dev/null 2>&1 +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..96a562ac3 --- /dev/null +++ b/tests/travis/prepare_mysql.sh @@ -0,0 +1,37 @@ +#!/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 ..." + +# Print out some MySQL information +mysql --version +mysql -e "SELECT VERSION();" +mysql -e "SHOW VARIABLES LIKE 'max_allowed_packet';" +mysql -e "SELECT @@sql_mode;" + +# Create Hubzilla database +mysql -e "CREATE DATABASE IF NOT EXISTS hubzilla;" -uroot; diff --git a/tests/travis/prepare_pgsql.sh b/tests/travis/prepare_pgsql.sh new file mode 100755 index 000000000..64c3524e7 --- /dev/null +++ b/tests/travis/prepare_pgsql.sh @@ -0,0 +1,37 @@ +#!/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 ..." + +# Print out some PostgreSQL information +psql --version +# Why does this hang further execution of the job? +#psql -c "SELECT VERSION();" -U postgres + +# Create Hubzilla database +psql -c "DROP DATABASE IF EXISTS hubzilla;" -U postgres +psql -c "CREATE DATABASE hubzilla;" -U postgres |