From c45bf125671f3f6237a605241486a6dd35b142a7 Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Fri, 30 Oct 2020 22:50:24 +0300 Subject: [PATCH] Use GitHub actions --- .github/workflows/build.yml | 47 ++++++++++++++++++++++++++++++++++++++++++++ .travis.yml | 48 --------------------------------------------- README.md | 2 +- composer.json | 12 +++++++++++- 4 files changed, 59 insertions(+), 50 deletions(-) create mode 100644 .github/workflows/build.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..65c872d --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,47 @@ +name: build + +on: [push, pull_request] + +env: + DEFAULT_COMPOSER_FLAGS: "--prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi" + +jobs: + phpunit: + name: PHP ${{ matrix.php }} on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest] + php: ['5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0'] + + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Install PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + - name: Get composer cache directory + id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + - name: Cache composer dependencies + uses: actions/cache@v1 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: ${{ runner.os }}-composer- + - name: Install dependencies + run: composer update $DEFAULT_COMPOSER_FLAGS + - name: Run unit tests with coverage + run: vendor/bin/phpunit --verbose --coverage-clover=coverage.clover --colors=always + if: matrix.php == '7.1' + - name: Run unit tests without coverage + run: vendor/bin/phpunit --verbose --colors=always + if: matrix.php != '7.1' + - name: Upload code coverage + run: | + wget https://scrutinizer-ci.com/ocular.phar + php ocular.phar code-coverage:upload --format=php-clover coverage.clover + if: matrix.php == '7.1' + continue-on-error: true # if is fork diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 6293723..0000000 --- a/.travis.yml +++ /dev/null @@ -1,48 +0,0 @@ -language: php - -matrix: - fast_finish: true - include: - - php: "7.3" - - - php: "7.2" - - - php: "7.1" - - - php: "7.0" - - - php: "5.6" - - - php: "5.5" - dist: trusty - - - php: "5.4" - dist: trusty - -sudo: false - -# cache vendor dirs -cache: - directories: - - $HOME/.composer/cache - -install: - - travis_retry composer self-update && composer --version - - export PATH="$HOME/.composer/vendor/bin:$PATH" - - travis_retry composer install --prefer-dist --no-interaction - -before_script: - - | - if [ $TRAVIS_PHP_VERSION = '5.6' ]; then - PHPUNIT_FLAGS="--coverage-clover=coverage.clover" - fi - -script: - - ./vendor/bin/phpunit --verbose $PHPUNIT_FLAGS - -after_script: - - | - if [ $TRAVIS_PHP_VERSION = '5.6' ]; then - travis_retry wget https://scrutinizer-ci.com/ocular.phar - php ocular.phar code-coverage:upload --format=php-clover coverage.clover - fi diff --git a/README.md b/README.md index cf5bec0..a794897 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Documentation is at [docs/guide/README.md](docs/guide/README.md). [![Latest Stable Version](https://poser.pugx.org/yiisoft/yii2-bootstrap/v/stable.png)](https://packagist.org/packages/yiisoft/yii2-bootstrap) [![Total Downloads](https://poser.pugx.org/yiisoft/yii2-bootstrap/downloads.png)](https://packagist.org/packages/yiisoft/yii2-bootstrap) -[![Build Status](https://travis-ci.com/yiisoft/yii2-bootstrap.svg?branch=master)](https://travis-ci.com/yiisoft/yii2-bootstrap) +[![Build Status](https://github.com/yiisoft/yii2-bootstrap/workflows/build/badge.svg)](https://github.com/yiisoft/yii2-bootstrap/actions) Installation diff --git a/composer.json b/composer.json index b7f6214..a8b9ee1 100644 --- a/composer.json +++ b/composer.json @@ -36,7 +36,8 @@ "bower-asset/bootstrap": "3.4.* | 3.3.* | 3.2.* | 3.1.*" }, "require-dev": { - "phpunit/phpunit": "<7" + "cweagans/composer-patches": "^1.7", + "phpunit/phpunit": "4.8.34" }, "repositories": [ { @@ -52,6 +53,15 @@ "extra": { "branch-alias": { "dev-master": "2.0.x-dev" + }, + "patches": { + "phpunit/phpunit-mock-objects": { + "Fix PHP 7 and 8 compatibility": "https://yiisoft.github.io/phpunit-patches/phpunit_mock_objects.patch" + }, + "phpunit/phpunit": { + "Fix PHP 7 compatibility": "https://yiisoft.github.io/phpunit-patches/phpunit_php7.patch", + "Fix PHP 8 compatibility": "https://yiisoft.github.io/phpunit-patches/phpunit_php8.patch" + } } } }