diff --git a/.gitattributes b/.gitattributes index 98ab92e..d962543 100644 --- a/.gitattributes +++ b/.gitattributes @@ -9,7 +9,6 @@ /.gitignore export-ignore /.phpcs.xml export-ignore /.phpcs.xml.dist export-ignore -/.travis.yml export-ignore /phpcs.xml export-ignore /phpcs.xml.dist export-ignore /phpunit.xml export-ignore diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..fd4e455 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,64 @@ +name: Test + +on: + # Run on all pushes and on all pull requests. + push: + pull_request: + # Allow manually triggering the workflow. + workflow_dispatch: + +# Cancels all previous workflow runs for the same branch that have not yet completed. +concurrency: + # The concurrency group contains the workflow name and the branch name. + group: ${{ github.workflow }}-${{ github.head_ref }} + cancel-in-progress: true + +jobs: + test: + runs-on: ubuntu-latest + + strategy: + matrix: + php_version: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2'] + + name: "Lint and test: PHP ${{ matrix.php_version }}" + + # Allow builds to fail on as-of-yet unreleased PHP versions. + continue-on-error: ${{ matrix.php_version == '8.1' || matrix.php_version == '8.2' }} + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Install PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php_version }} + ini-values: zend.assertions=1, error_reporting=-1, display_errors=On + coverage: none + tools: cs2pr + + # YoastCS has a minimum PHP requirement of 5.4, so remove it and hard require Parallel Lint. + - name: Adjust Composer dependencies (PHP 5.3) + if: matrix.php_version == '5.3' + run: | + composer remove --dev --no-update --no-scripts yoast/yoastcs + composer require --dev --no-update --no-scripts php-parallel-lint/php-parallel-lint + + # Install dependencies and handle caching in one go. + # @link https://github.com/marketplace/actions/install-composer-dependencies + - name: Install Composer dependencies (PHP < 8.2) + if: matrix.php_version != '8.2' + uses: ramsey/composer-install@v1 + + - name: Install Composer dependencies (PHP 8.2) + if: matrix.php_version == '8.2' + uses: ramsey/composer-install@v1 + with: + composer-options: "--ignore-platform-req=php" + + - name: Lint against parse errors + run: composer lint -- --checkstyle | cs2pr + + - name: Run the unit tests + run: vendor/bin/phpunit diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index b28ac63..0000000 --- a/.travis.yml +++ /dev/null @@ -1,50 +0,0 @@ -os: linux -language: php - -## Cache composer downloads. -cache: - directories: - # Cache directory for older Composer versions. - - $HOME/.composer/cache/files - # Cache directory for more recent Composer versions. - - $HOME/.cache/composer/files - -php: -- 8.0 -- 7.4 -- 7.3 -- 7.2 -- 7.1 - -jobs: - fast_finish: true - include: - - php: 7.0 - dist: xenial - - php: 5.6 - dist: xenial - - php: 5.5 - dist: trusty - - php: 5.4 - dist: trusty - - php: 5.3 - dist: precise - -before_install: - - phpenv config-rm xdebug.ini || echo 'No xdebug config.' - -install: -- if [[ $TRAVIS_PHP_VERSION == "5.3" ]]; then phpenv local 5.3.29; fi -# Remove "dev" packages which will not install on PHP 5.3. -- | - if [[ $TRAVIS_PHP_VERSION == "5.3" ]]; then - travis_retry composer remove --dev --no-update --no-scripts yoast/yoastcs - travis_retry composer require --dev --no-update --no-scripts php-parallel-lint/php-parallel-lint - fi -- travis_retry composer install --no-interaction -- if [[ $TRAVIS_PHP_VERSION == "5.3" ]]; then phpenv local --unset; fi - -script: -- echo $TRAVIS_PHP_VERSION -- composer lint -- ./vendor/bin/phpunit diff --git a/README.md b/README.md index 792de82..0b8a305 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ [![CS](https://github.com/Yoast/whip/actions/workflows/cs.yml/badge.svg)](https://github.com/Yoast/whip/actions/workflows/cs.yml) +[![Test](https://github.com/Yoast/whip/actions/workflows/test.yml/badge.svg)](https://github.com/Yoast/whip/actions/workflows/test.yml) # whip A WordPress package to nudge users to upgrade their software versions (starting with PHP)