From 5fe2c71764dd57810b68770da5219abfc4045a46 Mon Sep 17 00:00:00 2001 From: gesinn-it Date: Wed, 24 Feb 2021 14:59:18 +0100 Subject: [PATCH] updated Travis, use CI scripts --- .travis.yml | 35 ++++-- ...stall-semantic-extra-special-properties.sh | 104 ++++++------------ 2 files changed, 57 insertions(+), 82 deletions(-) diff --git a/.travis.yml b/.travis.yml index 92b91ac..a09d702 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,41 +1,52 @@ -# https://docs.travis-ci.com/user/reference/overview/ language: php os: - linux +env: + global: + # fix "Xdebug 3 is installed by default, breaking builds" + # see https://travis-ci.community/t/xdebug-3-is-installed-by-default-breaking-builds/10748 + - XDEBUG_MODE=coverage + services: - mysql + - postgresql jobs: fast_finish: true include: - - env: DB=sqlite; MW=REL1_31; PHPUNIT=5.7.* - php: 7.2 - - env: DB=mysql; MW=REL1_31; PHPUNIT=5.7.* + # 1) sqlite, previous MW LTS stable, current SMW stable + - env: DB=sqlite; MW=REL1_31; SMW=3.2.2 php: 7.1 - - env: DB=mysql; MW=REL1_33; SITELANG=ja; PHPUNIT=5.7.* + # 2) postgres, current MW non-LTS stable, current SMW stable + - env: DB=postgres; MW=REL1_34; SMW=3.2.2 php: 7.2 - - env: DB=mysql; MW=REL1_34; PHPUNIT=6.5.* - php: 7.3 - - env: DB=mysql; MW=master; PHPUNIT=6.5.* + # 3) mysql, current MW LTS stable, current SMW stable, COVERAGE + # temp run against cherry-pick SMW until SMW 3.2.3 is available + # temp stay with MW 1.34 until all SMW tests are passing for 1.35 + - env: DB=mysql; MW=REL1_34; SMW='dev-master#229e166 as 3.2.2'; TYPE=coverage php: 7.3 - allow_failures: - - env: DB=mysql; MW=master; PHPUNIT=6.5.* before_install: # MW is not yet compatible with Composer 2.x, see https://phabricator.wikimedia.org/T266417 - composer self-update --1 + - wget https://raw.githubusercontent.com/SemanticMediaWiki/CIScripts/main/travis/install-mediawiki.sh + - wget https://raw.githubusercontent.com/SemanticMediaWiki/CIScripts/main/travis/install-phpunit.sh + - wget https://raw.githubusercontent.com/SemanticMediaWiki/CIScripts/main/travis/install-semantic-mediawiki.sh + - wget https://raw.githubusercontent.com/SemanticMediaWiki/CIScripts/main/travis/upload-scrutinizer-coverage-report.sh install: - - bash ./tests/travis/install-mediawiki.sh + - bash ./install-mediawiki.sh + - bash ./install-phpunit.sh + - bash ./install-semantic-mediawiki.sh - bash ./tests/travis/install-semantic-extra-special-properties.sh script: - bash ./tests/travis/run-tests.sh after_success: - - bash ./tests/travis/upload-coverage-report.sh + - bash ./upload-scrutinizer-coverage-report.sh notifications: email: diff --git a/tests/travis/install-semantic-extra-special-properties.sh b/tests/travis/install-semantic-extra-special-properties.sh index 132a585..f5daaf6 100644 --- a/tests/travis/install-semantic-extra-special-properties.sh +++ b/tests/travis/install-semantic-extra-special-properties.sh @@ -4,73 +4,37 @@ set -ex BASE_PATH=$(pwd) MW_INSTALL_PATH=$BASE_PATH/../mw -# Run Composer installation from the MW root directory -function installToMediaWikiRoot { - echo -e "Running MW root composer install build on $TRAVIS_BRANCH \n" - - cd $MW_INSTALL_PATH - - if [ "$PHPUNIT" != "" ] - then - composer require 'phpunit/phpunit='$PHPUNIT --prefer-source --update-with-dependencies - else - composer require 'phpunit/phpunit=3.7.*' --prefer-source --update-with-dependencies - fi - - if [ "$SESP" != "" ] - then - composer require 'mediawiki/semantic-extra-special-properties='$SESP --prefer-source --update-with-dependencies - else - composer init --stability dev - composer require mediawiki/semantic-extra-special-properties "dev-master" --prefer-source --dev --update-with-dependencies - - cd extensions - cd SemanticExtraSpecialProperties - - # Pull request number, "false" if it's not a pull request - # After the install via composer an additional get fetch is carried out to - # update th repository to make sure that the latests code changes are - # deployed for testing - if [ "$TRAVIS_PULL_REQUEST" != "false" ] - then - git fetch origin +refs/pull/"$TRAVIS_PULL_REQUEST"/merge: - git checkout -qf FETCH_HEAD - else - git fetch origin "$TRAVIS_BRANCH" - git checkout -qf FETCH_HEAD - fi - - cd ../.. - fi - - # Rebuild the class map for added classes during git fetch - composer dump-autoload -} - -function updateConfiguration { - - cd $MW_INSTALL_PATH - - # Site language - if [ "$SITELANG" != "" ] - then - echo '$wgLanguageCode = "'$SITELANG'";' >> LocalSettings.php - fi - - echo 'error_reporting(E_ALL| E_STRICT);' >> LocalSettings.php - echo 'ini_set("display_errors", 1);' >> LocalSettings.php - echo '$wgShowExceptionDetails = true;' >> LocalSettings.php - echo '$wgDevelopmentWarnings = true;' >> LocalSettings.php - echo "putenv( 'MW_INSTALL_PATH=$(pwd)' );" >> LocalSettings.php - - # SMW#1732 - echo 'wfLoadExtension( "SemanticMediaWiki" );' >> LocalSettings.php - - # SRF#103 - echo 'wfLoadExtension( "SemanticExtraSpecialProperties" );' >> LocalSettings.php - - php maintenance/update.php --quick -} - -installToMediaWikiRoot -updateConfiguration +## Install +echo -e "Running MW root composer install build on $TRAVIS_BRANCH \n" + +cd $MW_INSTALL_PATH + +if [ "$SESP" != "" ]; then + composer require 'mediawiki/semantic-extra-special-properties='$SESP --prefer-source --update-with-dependencies +else + composer init --stability dev + composer require mediawiki/semantic-extra-special-properties "dev-master" --prefer-source --dev --update-with-dependencies + + cd extensions + cd SemanticExtraSpecialProperties + + # Pull request number, "false" if it's not a pull request + # After the install via composer an additional get fetch is carried out to + # update th repository to make sure that the latests code changes are + # deployed for testing + if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then + git fetch origin +refs/pull/"$TRAVIS_PULL_REQUEST"/merge: + git checkout -qf FETCH_HEAD + else + git fetch origin "$TRAVIS_BRANCH" + git checkout -qf FETCH_HEAD + fi + + cd ../.. +fi + +composer dump-autoload + +## Configure +echo 'wfLoadExtension( "SemanticExtraSpecialProperties" );' >>LocalSettings.php +php maintenance/update.php --quick