diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..9a93b66 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,59 @@ +name: WordPress Plugin CI + +on: + push: + branches: + - master + pull_request: + +jobs: + test: + runs-on: ubuntu-latest + services: + mysql: + image: mysql:5.7 + env: + MYSQL_ROOT_PASSWORD: rootpassword + ports: + - 3306 + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 + + strategy: + matrix: + php: [7.4, 7.3, 7.2, 7.1] + wp: [latest, '5.9', '5.8', '5.7'] + include: + - php: 7.4 + wp: latest + run_phpcs: true + + steps: + - uses: actions/checkout@v2 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, mysql, mysqli, pdo_mysql, bcmath, soap, intl, gd, exif, iconv, imagick + coverage: none + + - name: Install dependencies + run: composer install --prefer-dist --no-progress --no-suggest + + - name: Install WordPress test suite + env: + WP_VERSION: ${{ matrix.wp }} + run: | + bash bin/install-wp-tests.sh wordpress_test root rootpassword 127.0.0.1:${{ job.services.mysql.ports['3306'] }} $WP_VERSION + + - name: Run PHPUnit + run: | + phpunit + WP_MULTISITE=1 phpunit + + - name: Run PHPCS + if: ${{ matrix.run_phpcs }} + run: | + composer global require wp-coding-standards/wpcs + phpcs --config-set installed_paths $HOME/.composer/vendor/wp-coding-standards/wpcs + phpcs --standard=phpcs.ruleset.xml $(find . -name '*.php') \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index f07ffb9..0000000 --- a/.travis.yml +++ /dev/null @@ -1,63 +0,0 @@ -language: php - -notifications: - email: - on_success: never - on_failure: change - -cache: - directories: - - vendor - - $HOME/.composer/cache - -matrix: - include: - - php: 7.4 - env: WP_VERSION=latest - - php: 7.3 - env: WP_VERSION=latest - - php: 7.2 - env: WP_VERSION=latest - - php: 7.1 - env: WP_VERSION=latest - - php: 7.1 - env: WP_VERSION=4.9 - - php: 7.1 - env: WP_VERSION=4.8 - - php: 7.1 - env: WP_VERSION=4.7 - - php: 7.1 - env: WP_TRAVISCI=phpcs - allow_failures: - - php: 7.1 - env: WP_TRAVISCI=phpcs - -branches: - only: - - master - -before_script: - - export PATH="$HOME/.composer/vendor/bin:$PATH" - - | - if [[ ! -z "$WP_VERSION" ]] ; then - bash bin/install-wp-tests.sh wordpress_test root '' localhost $WP_VERSION - phpenv config-rm xdebug.ini - composer global require "phpunit/phpunit=5.7.*" - fi - - | - if [[ "$WP_TRAVISCI" == "phpcs" ]] ; then - composer global require wp-coding-standards/wpcs - phpcs --config-set installed_paths $HOME/.composer/vendor/wp-coding-standards/wpcs - fi - - composer install --prefer-source --no-interaction --dev - -script: - - | - if [[ ! -z "$WP_VERSION" ]] ; then - phpdbg -qrr phpunit - WP_MULTISITE=1 phpdbg -qrr phpunit - fi - - | - if [[ "$WP_TRAVISCI" == "phpcs" ]] ; then - phpcs --standard=phpcs.ruleset.xml $(find . -name '*.php') - fi diff --git a/README.md b/README.md index 8c0b951..ab6a088 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Disable Comments for WordPress -[![Build Status](https://travis-ci.org/solarissmoke/disable-comments.svg?branch=master)](https://travis-ci.org/solarissmoke/disable-comments) +[![Build Status](https://github.com/WPDevelopers/disable-comments/actions/workflows/tests.yml/badge.svg)](https://github.com/WPDevelopers/disable-comments/actions/workflows/tests.yml) This is the development respository for the [Disable Comments](https://wordpress.org/plugins/disable-comments/) WordPress plugin. Send pull requests here, download the latest stable version there!