From 3c91d71fb08f068e5b7fc7ae9fc2ccfc7b1dded5 Mon Sep 17 00:00:00 2001 From: Wilmer Arambula <42547589+terabytesoftw@users.noreply.github.com> Date: Tue, 16 Jun 2020 20:18:08 -0400 Subject: [PATCH] Adjust github actions (#258) * Remove mutation testing. * Add dependabot. --- .github/dependabot.yml | 7 +++++ .github/workflows/build.yml | 7 +++-- .github/workflows/mutation.yml | 51 ---------------------------------- .github/workflows/static.yml | 13 ++++++--- README.md | 32 +++++++++++++++++++-- composer.json | 4 +-- infection.json.dist | 16 ----------- 7 files changed, 52 insertions(+), 78 deletions(-) create mode 100644 .github/dependabot.yml delete mode 100644 .github/workflows/mutation.yml delete mode 100644 infection.json.dist diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 000000000..afb98ae0c --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,7 @@ +version: 2 +updates: +- package-ecosystem: github-actions + directory: "/" + schedule: + interval: daily + open-pull-requests-limit: 10 diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2dc627e1f..d4100c11c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -7,9 +7,11 @@ name: build jobs: tests: name: PHP ${{ matrix.php-version }}-${{ matrix.os }} + env: extensions: curl, mbstring, dom, intl, json, libxml, xml, xmlwriter key: cache-v1 + update: true runs-on: ${{ matrix.os }} @@ -29,14 +31,14 @@ jobs: - name: Setup cache environment id: cache-env - uses: shivammathur/cache-extensions@v1 + uses: shivammathur/cache-extensions@1.1.0 with: php-version: ${{ matrix.php-version }} extensions: ${{ env.extensions }} key: ${{ env.key }} - name: Cache extensions - uses: actions/cache@v1 + uses: actions/cache@v2 with: path: ${{ steps.cache-env.outputs.dir }} key: ${{ steps.cache-env.outputs.key }} @@ -49,6 +51,7 @@ jobs: extensions: ${{ env.extensions }} ini-values: date.timezone='UTC' coverage: pcov + tools: composer:v2 - name: Determine composer cache directory on Linux if: matrix.os == 'ubuntu-latest' diff --git a/.github/workflows/mutation.yml b/.github/workflows/mutation.yml deleted file mode 100644 index 84fd18fdf..000000000 --- a/.github/workflows/mutation.yml +++ /dev/null @@ -1,51 +0,0 @@ -on: - pull_request: - push: - branches: - - "master" - -name: mutation test - -jobs: - mutation: - name: PHP ${{ matrix.php-version }}-${{ matrix.os }} - - runs-on: ${{ matrix.os }} - - strategy: - matrix: - os: - - ubuntu-latest - - php-version: - - "7.4" - - steps: - - name: "Checkout" - uses: "actions/checkout@v2" - - - name: "Install PHP" - uses: "shivammathur/setup-php@v2" - with: - coverage: "pcov" - php-version: "${{ matrix.php-version }}" - ini-values: memory_limit=-1 - - - name: Determine composer cache directory - run: echo "::set-env name=COMPOSER_CACHE_DIR::$(composer config cache-dir)" - - - name: Cache dependencies installed with composer - uses: actions/cache@v1 - with: - path: ${{ env.COMPOSER_CACHE_DIR }} - key: php${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }} - restore-keys: | - php${{ matrix.php-version }}-composer- - - - name: Install dependencies with composer - run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader - - - name: Run test mutation infection with coverage - run: vendor/bin/infection - env: - STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }} diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml index d3df1b645..b79d84c94 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/static.yml @@ -2,12 +2,16 @@ on: - pull_request - push -name: static analysis with phan +name: static analysis jobs: mutation: name: PHP ${{ matrix.php-version }}-${{ matrix.os }} + env: + extensions: ast + update: true + runs-on: ${{ matrix.os }} strategy: @@ -26,14 +30,15 @@ jobs: uses: "shivammathur/setup-php@v2" with: php-version: "${{ matrix.php-version }}" - tools: cs2pr, phan + extensions: ${{ env.extensions }} + tools: composer:v2, cs2pr coverage: none - name: Determine composer cache directory run: echo "::set-env name=COMPOSER_CACHE_DIR::$(composer config cache-dir)" - name: Cache dependencies installed with composer - uses: actions/cache@v1 + uses: actions/cache@v2 with: path: ${{ env.COMPOSER_CACHE_DIR }} key: php${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }} @@ -44,4 +49,4 @@ jobs: run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader - name: Static analysis with phan - run: phan --no-progress-bar --output-mode checkstyle | cs2pr --graceful-warnings --colorize + run: vendor/bin/phan --no-progress-bar --output-mode checkstyle | cs2pr --graceful-warnings --colorize diff --git a/README.md b/README.md index 86c072861..8f8fa767b 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@

- - Yii Framework + +

Yii Framework Web Extension


@@ -14,10 +14,12 @@ This [Yii Framework] extension allows easy creation of web applications. [![Latest Stable Version](https://poser.pugx.org/yiisoft/yii-web/v/stable.png)](https://packagist.org/packages/yiisoft/yii-web) [![Total Downloads](https://poser.pugx.org/yiisoft/yii-web/downloads.png)](https://packagist.org/packages/yiisoft/yii-web) -[![Build Status](https://github.com/yiisoft/yii-web/workflows/build/badge.svg)](https://github.com/yiisoft/yii-web/actions) +[![Build Status](https://github.com/yiisoft/yii-web/workflows/build/badge.svg)](https://github.com/yiisoft/yii-web/actions?query=workflow%3Abuild) [![Scrutinizer Quality Score](https://scrutinizer-ci.com/g/yiisoft/yii-web/badges/quality-score.png?s=b1074a1ff6d0b214d54fa5ab7abbb90fc092471d)](https://scrutinizer-ci.com/g/yiisoft/yii-web/) [![Code Coverage](https://scrutinizer-ci.com/g/yiisoft/yii-web/badges/coverage.png?s=31d80f1036099e9d6a3e4d7738f6b000b3c3d10e)](https://scrutinizer-ci.com/g/yiisoft/yii-web/) [![Mutation testing badge](https://img.shields.io/endpoint?style=flat&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2Fyiisoft%2Fyii-web%2Fmaster)](https://dashboard.stryker-mutator.io/reports/github.com/yiisoft/yii-web/master) +[![static analysis](https://github.com/yiisoft/yii-web/workflows/static%20analysis/badge.svg)](https://github.com/yiisoft/yii-web/actions?query=workflow%3A%22static+analysis%22) + Installation ------------ @@ -89,3 +91,27 @@ If your code is hosted at GitHub, you can place the following in your README.md ``` [![Yii](https://img.shields.io/badge/Powered_by-Yii_Framework-green.svg?style=flat)](http://www.yiiframework.com/) ``` + +### Unit testing + +The package is tested with [PHPUnit](https://phpunit.de/). To run tests: + +```php +./vendor/bin/phpunit +``` + +### Mutation testing + +The package tests are checked with [Infection](https://infection.github.io/) mutation framework. To run it: + +```php +./vendor/bin/infection +``` + +### Static analysis + +The code is statically analyzed with [Phan](https://github.com/phan/phan/wiki). To run static analysis: + +```php +./vendor/bin/phan +``` diff --git a/composer.json b/composer.json index bc98f738b..cefffb062 100644 --- a/composer.json +++ b/composer.json @@ -44,9 +44,9 @@ "yiisoft/event-dispatcher": "^3.0@dev" }, "require-dev": { - "infection/infection": "^0.16.3", "nyholm/psr7": "^1.0", - "phpunit/phpunit": "^9.2.0", + "phan/phan": "^3.0.2", + "phpunit/phpunit": "^9.2", "yiisoft/cache": "^3.0@dev", "yiisoft/composer-config-plugin": "^1.0@dev", "yiisoft/di": "^3.0@dev", diff --git a/infection.json.dist b/infection.json.dist deleted file mode 100644 index d319ab15a..000000000 --- a/infection.json.dist +++ /dev/null @@ -1,16 +0,0 @@ -{ - "source": { - "directories": [ - "src" - ] - }, - "logs": { - "text": "php:\/\/stderr", - "badge": { - "branch": "master" - } - }, - "mutators": { - "@default": true - } -}