From 238f6f10dbc86ca9d4d06a2e5b19c9d161a51224 Mon Sep 17 00:00:00 2001 From: Jan Skrasek Date: Mon, 26 Oct 2020 21:55:44 +0100 Subject: [PATCH 1/4] add GitHub actions --- .github/workflows/build.yml | 73 +++++++++++++++++++++++++++++++++++++ .travis.yml | 29 --------------- readme.md | 3 +- 3 files changed, 74 insertions(+), 31 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..849bc23 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,73 @@ +name: "Build" + +on: + pull_request: + types: [ "opened", "synchronize", "edited", "reopened" ] + push: + branches: + - master + - v*.* + +env: + php-tools: "composer:v2, pecl" + +jobs: + tests: + name: Tests + + strategy: + fail-fast: false + matrix: + php-version: [ '7.1', '7.2', '7.3', '7.4' ] + deps: [ 'lowest', 'newest' ] + exclude: + - php-version: '7.2' + deps: lowest + - php-version: '7.3' + deps: lowest + - php-version: '7.4' + deps: lowest + + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Setup PHP with pecl extension + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-version }} + extensions: mbstring, intl, ctype, json + tools: ${{ env.php-tools }} + + - name: Get composer cache directory + id: composercache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + + - name: Cache dependencies + uses: actions/cache@v2 + with: + path: ${{ steps.composercache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('composer.json') }} + restore-keys: ${{ runner.os }}-composer- + + - name: Install dependencies + if: matrix.deps == 'newest' + run: composer update --prefer-dist --no-interaction --no-progress --no-suggest + + - name: Install lowest dependencies + if: matrix.deps == 'lowest' + run: composer update --prefer-dist --no-interaction --no-progress --no-suggest --prefer-lowest --prefer-stable + + - name: Tests + run: ./vendor/bin/tester -C ./tests/test.php + + - name: PHPStan + run: ./vendor/bin/phpstan analyze + + - name: Print failed expectations + if: ${{ failure() }} + run: | + find tests -name \*.actual -exec echo "--- {}" \; -exec cat {} \; -exec echo \; -exec echo \; && \ + find tests -name \*.log -exec echo "--- {}" \; -exec cat {} \; -exec echo \; -exec echo \; diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 6648b2b..0000000 --- a/.travis.yml +++ /dev/null @@ -1,29 +0,0 @@ -language: php -php: - - 7.1 - - 7.2 - - 7.3 - -matrix: - fast_finish: true - -sudo: false - -cache: - directories: - - $HOME/.composer/cache - - vendor - -before_script: - # Install Nette Tester - - phpenv config-rm xdebug.ini || true - - travis_retry composer update --no-interaction --prefer-source - -script: - - ./vendor/bin/tester ./tests/test.php - - ./vendor/bin/phpstan analyse - -after_failure: - # Print *.actual content & log content - - for i in $(find tests -name \*.actual); do echo "--- $i"; cat $i; echo; echo; done - - for i in $(find tests -name \*.log); do echo "--- $i"; cat $i; echo; echo; done diff --git a/readme.md b/readme.md index 84ac767..aadf041 100644 --- a/readme.md +++ b/readme.md @@ -1,8 +1,7 @@ PHPStan for Nextras Orm ======================= -[![Build Status](https://travis-ci.org/nextras/orm-phpstan.svg?branch=master)](https://travis-ci.org/nextras/orm-phpstan) - +[![Build Status](https://github.com/nextras/orm-phpstan/workflows/Build/badge.svg?branch=master)](https://github.com/nextras/orm-phpstan/actions?query=workflow%3ABuild+branch%3Amaster) PHPStan extension for Nextras Orm. From 9cec94db426e2c9e38cadddc21f1ba02423655ff Mon Sep 17 00:00:00 2001 From: Jan Skrasek Date: Mon, 26 Oct 2020 22:01:49 +0100 Subject: [PATCH 2/4] composer update tester --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 027101b..04b3b5c 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,7 @@ "phpstan/phpstan": "^0.12.29" }, "require-dev": { - "nette/tester": "~2.0", + "nette/tester": "^2.3.1", "nextras/orm": "~4.0@dev", "nextras/dbal": "~4.0@dev" }, From a78f2732c94ac992cc2934e748a9605d2bec6c82 Mon Sep 17 00:00:00 2001 From: Jan Skrasek Date: Mon, 26 Oct 2020 22:02:56 +0100 Subject: [PATCH 3/4] composer: Orm is a dependency to force installation compatibility --- composer.json | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/composer.json b/composer.json index 04b3b5c..df01cbb 100644 --- a/composer.json +++ b/composer.json @@ -1,18 +1,17 @@ { "name": "nextras/orm-phpstan", - "description": "PhpStan extension for Nextras Orm", + "description": "PHPStan extension for Nextras Orm", "type": "phpstan-extension", "license": [ "MIT" ], "require": { "php": "~7.1", - "phpstan/phpstan": "^0.12.29" + "phpstan/phpstan": "^0.12.29", + "nextras/orm": "~4.0" }, "require-dev": { - "nette/tester": "^2.3.1", - "nextras/orm": "~4.0@dev", - "nextras/dbal": "~4.0@dev" + "nette/tester": "^2.3.1" }, "autoload": { "psr-4": { From 0870acdf766f860c0c22b4f6be2bfec795a949f1 Mon Sep 17 00:00:00 2001 From: Jan Skrasek Date: Mon, 26 Oct 2020 22:16:51 +0100 Subject: [PATCH 4/4] test with PHP 8.0 --- .github/workflows/build.yml | 4 +++- composer.json | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 849bc23..abb1c50 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,7 +18,7 @@ jobs: strategy: fail-fast: false matrix: - php-version: [ '7.1', '7.2', '7.3', '7.4' ] + php-version: [ '7.1', '7.2', '7.3', '7.4', '8.0' ] deps: [ 'lowest', 'newest' ] exclude: - php-version: '7.2' @@ -27,6 +27,8 @@ jobs: deps: lowest - php-version: '7.4' deps: lowest + - php-version: '8.0' + deps: lowest runs-on: ubuntu-latest diff --git a/composer.json b/composer.json index df01cbb..8f0fe9d 100644 --- a/composer.json +++ b/composer.json @@ -6,7 +6,7 @@ "MIT" ], "require": { - "php": "~7.1", + "php": "~7.1 || ~8.0", "phpstan/phpstan": "^0.12.29", "nextras/orm": "~4.0" },