diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f8d813b..d1220cd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -105,20 +105,3 @@ jobs: # Temporary integration-test workaround; see issue #98. MEDIAWIKI_HAS_INTEGRATION_TESTS=1 vendor/bin/phpunit -c phpunit.xml extensions/BootstrapComponents/tests/phpunit/Unit fi - - - if: env.TYPE == 'coverage' - name: Run PHPUnit (coverage) - run: | - if [ -f tests/phpunit/phpunit.php ]; then - php tests/phpunit/phpunit.php -c extensions/BootstrapComponents/ --testsuite bootstrap-components-unit --coverage-clover coverage.clover - else - # MW 1.46 and later - composer phpunit:config - # Temporary integration-test workaround; see issue #98. - MEDIAWIKI_HAS_INTEGRATION_TESTS=1 vendor/bin/phpunit -c phpunit.xml extensions/BootstrapComponents/tests/phpunit/Unit --coverage-clover coverage.clover - fi - - - if: env.TYPE == 'coverage' - name: upload coverage report - working-directory: ~ - run: bash EarlyCopy/.github/workflows/uploadCoverageReport.sh diff --git a/.github/workflows/uploadCoverageReport.sh b/.github/workflows/uploadCoverageReport.sh deleted file mode 100644 index 9243780..0000000 --- a/.github/workflows/uploadCoverageReport.sh +++ /dev/null @@ -1,14 +0,0 @@ -#! /bin/bash - -COVERAGE_REPORT=${MW_ROOT}/coverage.clover - -if [[ ! -e ${COVERAGE_REPORT} ]]; then - echo "File coverage.clover is missing. Abort the upload!" - # this was exit 127; restore exit value when code coverage is again supported - exit -fi - -cd EarlyCopy - -wget https://scrutinizer-ci.com/ocular.phar -php ocular.phar code-coverage:upload --format=php-clover ../${COVERAGE_REPORT} diff --git a/.scrutinizer.yml b/.scrutinizer.yml deleted file mode 100644 index c96ee8c..0000000 --- a/.scrutinizer.yml +++ /dev/null @@ -1,29 +0,0 @@ -filter: - excluded_paths: - - 'vendor/*' - -tools: - php_mess_detector: - config: - controversial_rules: { superglobals: false } - php_cpd: true - php_pdepend: true - php_code_coverage: false - php_code_sniffer: true - php_cs_fixer: true - php_loc: true - php_analyzer: true - sensiolabs_security_checker: true - # TODO: Scrutinizer Ocular coverage disabled due to https://github.com/scrutinizer-ci/ocular/issues/51 - # external_code_coverage: - # timeout: '1200' # timeout in seconds - -checks: - php: - psr2_class_declaration: false - psr2_switch_declaration: false - sql_injection_vulnerabilities: true - security_vulnerabilities: true - no_eval: true - code_rating: true - duplication: true diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 869ea39..0000000 --- a/.travis.yml +++ /dev/null @@ -1,62 +0,0 @@ -##### -# This file is part of the MediaWiki Extension BootstrapComponents. -# -# @copyright 2018, Tobias Oetterer, Paderborn University -# @license GNU General Public License, version 3 (or any later version) -# -# You should have received a copy of the GNU General Public License along with -# this program. If not, see . -# -# @file -# -# @author Tobias Oetterer -# @since 1.0 -# @ingroup BootstrapComponents -##### - -os: linux - -# https://docs.travis-ci.com/user/languages/php -language: php - -# https://docs.travis-ci.com/user/trusty-ci-environment/ -dist: trusty - -jobs: - fast_finish: true - include: - - env: DB=mysql; MW=REL1_35; PHPUNIT=7.5.* - php: 7.4 - - env: DB=mysql; MW=REL1_37; PHPUNIT=8.5.* - php: 7.4 - - env: DB=mysql; MW=REL1_38; PHPUNIT=8.5.* - php: 8.0 - - env: DB=mysql; MW=REL1_39; PHPUNIT=8.5.*; TYPE=coverage - php: 7.4 - - env: DB=mysql; MW=REL1_39; PHPUNIT=8.5.* - php: 8.0 - - env: DB=mysql; MW=master; PHPUNIT=8.5.* - php: 7.4 - - env: DB=mysql; MW=master; PHPUNIT=8.5.* - php: 8.0 - allow_failures: - - env: DB=mysql; MW=master; PHPUNIT=8.5.* - - -install: - - bash ./tests/travis/install-system.sh - -script: - - bash ./tests/travis/run-tests.sh - -after_success: - - bash ./tests/travis/upload-coverage-report.sh - -notifications: - email: - on_success: change - on_failure: always - -cache: - directories: - - $HOME/.composer/cache diff --git a/README.md b/README.md index 006bd9c..9d51b29 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,6 @@ [![Build Status](https://github.com/oetterer/BootstrapComponents/actions/workflows/ci.yml/badge.svg)](https://github.com/oetterer/BootstrapComponents/actions/workflows/ci.yml) ![Latest Stable Version](https://img.shields.io/packagist/v/mediawiki/bootstrap-components.svg) ![Total Download Count](https://img.shields.io/packagist/dt/mediawiki/bootstrap-components.svg) -[![Code Coverage](https://scrutinizer-ci.com/g/oetterer/BootstrapComponents/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/oetterer/BootstrapComponents/?branch=master) -[![Code Quality](https://scrutinizer-ci.com/g/oetterer/BootstrapComponents/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/oetterer/BootstrapComponents/?branch=master) Bootstrap Components is a [MediaWiki] extension that aims to provide editors with easy access to certain components introduced by diff --git a/docs/credits.md b/docs/credits.md index 93cf813..4c861bc 100644 --- a/docs/credits.md +++ b/docs/credits.md @@ -8,9 +8,6 @@ It is based upon the [Bootstrap extension][ExtensionBootstrap] created by Stephan Gambke, now maintained by [ProfessionalWiki][ProWiki]. Also, some parts of its documentation is copied and used here. -Code snippets used for CI on [Travis] and [Scrutinizer] were taken from -the [SemanticScribunto] software repository. - Integration tests use the `JsonTestCaseScriptRunner` class created by mwjames for [SemanticMediaWiki] and both json test classes and the `ReadmeContentsBuilder` are adaptions of his work, also. @@ -27,8 +24,7 @@ See its documentation on [mediawiki.org][ExtensionBootstrap] and [GitHub][BootstrapGitHub]. For integration tests, this extension relies on classes from the extension -[SemanticMediaWiki]. It is only installed, when conduction CI tests on -[Travis]. +[SemanticMediaWiki]. It is only installed when conducting CI tests. ### Thanks! @@ -48,8 +44,5 @@ If I forgot somebody, sorry. Please drop me a note, so I can add them here. [ExtensionBootstrap]: https://www.mediawiki.org/wiki/Extension:Bootstrap [BootstrapGitHub]: https://github.com/ProfessionalWiki/Bootstrap [ProWiki]: https://github.com/ProfessionalWiki -[Travis]: https://travis-ci.org -[Scrutinizer]: https://scrutinizer-ci.com -[SemanticScribunto]: https://github.com/SemanticMediaWiki/SemanticScribunto [SemanticMediaWiki]: https://github.com/SemanticMediaWiki/SemanticMediaWiki [Sandbox]: https://sandbox.semantic-mediawiki.org/wiki/BootstrapComponents diff --git a/docs/testing.md b/docs/testing.md index 8741a40..2c52b64 100644 --- a/docs/testing.md +++ b/docs/testing.md @@ -1,7 +1,7 @@ ## Testing This extension provides unit and integration tests that are run by a -[continuous integration platform][travis] but can also be executed using the +[continuous integration platform][ci] but can also be executed using the `composer phpunit` command from the extension base directory that will run all tests. @@ -17,5 +17,5 @@ provided for convenience: See [Information on unit testing][mw-testing] if you want to expand the tests yourself. -[travis]: https://travis-ci.org/oetterer/BootstrapComponents +[ci]: https://github.com/oetterer/BootstrapComponents/actions/workflows/ci.yml [mw-testing]: https://www.mediawiki.org/wiki/Manual:PHP_unit_testing diff --git a/tests/travis/install-system.sh b/tests/travis/install-system.sh deleted file mode 100755 index 2deb922..0000000 --- a/tests/travis/install-system.sh +++ /dev/null @@ -1,179 +0,0 @@ -#!/bin/bash -set -ex - -originalDirectory=$(pwd) -cd .. -baseDir=$(pwd) -mwDir=mw - -## Use sha (master@5cc1f1d) to download a particular commit to avoid breakages -## introduced by MediaWiki core -if [[ "${MW}" == *@* ]]; then - arrMw=(${MW//@/ }) - MW=${arrMw[0]} - SOURCE=${arrMw[1]} -else - MW=${MW} - SOURCE=${MW} -fi - -if [[ "${MW}" == master ]]; then - BRANCH=master -else - BRANCH=${MW%.*} - BRANCH=${BRANCH/./_} -fi - -function installMWCoreAndDB() { - - echo -e "*** Installing MW Version ${MW}\n" - - cd ${baseDir} - wget https://github.com/wikimedia/mediawiki/archive/${SOURCE}.tar.gz -O ${MW}.tar.gz - tar -zxf ${MW}.tar.gz - mv mediawiki-* ${mwDir} - - cd ${mwDir} - - composer self-update --1 - - # Hack to fix "... jetbrains/phpstorm-stubs/PhpStormStubsMap.php): failed to open stream: No such file or directory ..." - # https://phabricator.wikimedia.org/T226766 - composer remove jetbrains/phpstorm-stubs --no-interaction - - composer install --no-suggest - - echo -e "*** Installing database ${DB}\n" - - if [[ "${DB}" == "postgres" ]]; then - sudo /etc/init.d/postgresql stop - sudo /etc/init.d/postgresql start - - psql -c 'create database its_a_mw;' -U postgres - php maintenance/install.php --dbtype ${DB} --dbuser postgres --dbname its_a_mw --pass nyanNYANnyan --scriptpath /TravisWiki TravisWiki admin - else - mysql -e 'create database its_a_mw;' - php maintenance/install.php --dbtype ${DB} --dbuser root --dbname its_a_mw --dbpath $(pwd) --pass nyanNYANnyan --scriptpath /TravisWiki TravisWiki admin - fi -} - -function installSkin() { - - echo -e "*** Installing skin vector\n" - cd ${baseDir}/${mwDir}/skins - - # most mw dumps ship with empty skin directories - [[ -e Vector ]] && rm -rf Vector - - git clone --branch ${BRANCH} https://github.com/wikimedia/Vector.git -} - -function installDependencies() { - - echo -e "*** Installing Dependencies\n" - cd ${baseDir}/${mwDir} - - #composer require 'mediawiki/semantic-media-wiki=~3.0' --update-with-dependencies --no-suggest - composer require 'mediawiki/bootstrap=~4.0' --update-with-dependencies - composer require 'mediawiki/mw-extension-registry-helper=^1.0' --update-with-dependencies - - if [ "$PHPUNIT" != "" ]; then - composer require 'phpunit/phpunit='$PHPUNIT --update-with-dependencies - else - composer require 'phpunit/phpunit=6.5.*' --update-with-dependencies - fi - - cd extensions - - wget https://github.com/wikimedia/mediawiki-extensions-Scribunto/archive/${MW}.tar.gz - - tar -zxf $MW.tar.gz - [[ -e Scribunto ]] && rm -rf Scribunto - mv mediawiki-extensions-Scribunto* Scribunto - - cd .. -} - -function installSourceViaComposer() { - # not used atm - echo -e "Running composer install build on ${TRAVIS_BRANCH}\n" - cd ${baseDir}/${mwDir} - - composer require mediawiki/bootstrap-components "dev-master" --dev --update-with-dependencies - - cd /extensions/BootstrapComponents - - # 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 the repository to make sure that the latest 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 ../.. - - # Rebuild the class map for added classes during git fetch - composer dump-autoload -} - -function installSourceFromPull() { - - echo -e "*** Installing Extension\n" - cd ${baseDir}/${mwDir}/extensions - - cp -r ${originalDirectory} BootstrapComponents - - cd .. -} - -function augmentConfiguration() { - echo -e "*** Augmenting LocalSettings\n" - - cd ${baseDir}/${mwDir} - - # Site language - if [[ "${SITELANG}" != "" ]]; then - echo '$wgLanguageCode = "'${SITELANG}'";' >>LocalSettings.php - fi - echo '$wgArticlePath = $wgScriptPath . "/$1";' >> LocalSettings.php - - echo 'wfLoadExtension( "Bootstrap" );' >> LocalSettings.php - echo 'wfLoadExtension( "BootstrapComponents" );' >> LocalSettings.php - echo '$wgBootstrapComponentsModalReplaceImageTag = true;' >> LocalSettings.php - - echo 'wfLoadExtension( "Scribunto" );' >> LocalSettings.php -# echo '$wgScribuntoDefaultEngine = "luastandalone";' >>LocalSettings.php - - echo '$wgEnableUploads = true;' >> LocalSettings.php - echo 'wfLoadSkin( "Vector" );' >> LocalSettings.php - - 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 - #echo 'wfLoadExtension( "SemanticMediaWiki" );' >> LocalSettings.php - - php maintenance/update.php --quick --skip-external-dependencies -} - -function injectResources() { - - echo -e "*** Uploading test images\n" - - cd ${baseDir}/${mwDir} - php maintenance/importImages.php ${baseDir}/${mwDir}/extensions/BootstrapComponents/tests/resources/ png - php maintenance/runJobs.php --quiet -} - -installMWCoreAndDB -installSkin -installDependencies -installSourceFromPull -augmentConfiguration -injectResources diff --git a/tests/travis/run-tests.sh b/tests/travis/run-tests.sh deleted file mode 100755 index 691e101..0000000 --- a/tests/travis/run-tests.sh +++ /dev/null @@ -1,20 +0,0 @@ -#! /bin/bash -set -ex - -originalDirectory=$(pwd) -cd .. -baseDir=$(pwd) -mwDir=mw - - -cd ${baseDir}/${mwDir}/extensions/BootstrapComponents - -if [[ "${TYPE}" == "coverage" ]]; then - composer unit -- --coverage-clover ${originalDirectory}/build/coverage.clover -elif [[ "${TYPE}" == "integration" ]]; then - composer integration -elif [[ "${TYPE}" == "unit" ]]; then - composer unit -else - composer unit -fi diff --git a/tests/travis/upload-coverage-report.sh b/tests/travis/upload-coverage-report.sh deleted file mode 100755 index 4afe084..0000000 --- a/tests/travis/upload-coverage-report.sh +++ /dev/null @@ -1,9 +0,0 @@ -#! /bin/bash -set -ex - -originalDirectory=$(pwd) - -if [[ "$TYPE" == "coverage" ]]; then - wget https://scrutinizer-ci.com/ocular.phar - php ocular.phar code-coverage:upload --format=php-clover ${originalDirectory}/build/coverage.clover -fi \ No newline at end of file