Skip to content

Commit

Permalink
Update dev dependencies, pipelines and Scrutinizer
Browse files Browse the repository at this point in the history
  • Loading branch information
terabytesoftw committed Nov 10, 2020
1 parent 61d6ae2 commit 6336c50
Show file tree
Hide file tree
Showing 7 changed files with 95 additions and 76 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/bc.yml_
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
on:
- pull_request
- push

name: backwards compatibility
jobs:
roave_bc_check:
name: Roave BC Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: fetch tags
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/*
- name: Roave BC Check
uses: docker://nyholm/roave-bc-check-ga
48 changes: 9 additions & 39 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ jobs:
name: PHP ${{ matrix.php }}-${{ matrix.os }}

env:
extensions: mbstring
key: cache-v1
update: true

runs-on: ${{ matrix.os }}

Expand All @@ -27,48 +25,35 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v2.3.4

- name: Setup cache environment
id: cache-env
uses: shivammathur/cache-extensions@v1
with:
php-version: ${{ matrix.php }}
extensions: ${{ env.extensions }}
key: ${{ env.key }}

- name: Cache extensions
uses: actions/cache@v2
with:
path: ${{ steps.cache-env.outputs.dir }}
key: ${{ steps.cache-env.outputs.key }}
restore-keys: ${{ steps.cache-env.outputs.key }}

- name: Install PHP with extensions
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
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'
run: echo "::set-env name=COMPOSER_CACHE_DIR::$(composer config cache-dir)"
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV

- name: Determine composer cache directory on Windows
if: matrix.os == 'windows-latest'
run: ECHO "::set-env name=COMPOSER_CACHE_DIR::~\AppData\Local\Composer"
run: echo "COMPOSER_CACHE_DIR=~\AppData\Local\Composer" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append

- name: Cache dependencies installed with composer
uses: actions/cache@v1
uses: actions/cache@v2
with:
path: ${{ env.COMPOSER_CACHE_DIR }}
key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: |
php${{ matrix.php }}-composer-
- name: Update composer
run: composer self-update

- name: Install dependencies with composer php 7.4
if: matrix.php == '7.4'
run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi
Expand All @@ -77,20 +62,5 @@ jobs:
if: matrix.php == '8.0'
run: composer update --ignore-platform-reqs --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi

- name: Run tests with phpunit and coverage on Linux php 7.4
if: matrix.os == 'ubuntu-latest' && matrix.php == '7.4'
run: vendor/bin/phpunit --coverage-clover=coverage.clover --colors=always

- name: Run tests with phpunit without coverage on Linux php 8.0
if: matrix.os == 'ubuntu-latest' && matrix.php == '8.0'
run: vendor/bin/phpunit --colors=always

- name: Run tests with phpunit without coverage on Windows
if: matrix.os == 'windows-latest'
- name: Run tests with phpunit
run: vendor/bin/phpunit --colors=always

- name: Upload code coverage scrutinizer on Linux php 7.4
if: matrix.os == 'ubuntu-latest' && matrix.php == '7.4'
run: |
wget https://scrutinizer-ci.com/ocular.phar
php ocular.phar code-coverage:upload --format=php-clover coverage.clover
17 changes: 8 additions & 9 deletions .github/workflows/mutation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ jobs:
mutation:
name: PHP ${{ matrix.php }}-${{ matrix.os }}

env:
update: true

runs-on: ${{ matrix.os }}

strategy:
Expand All @@ -25,7 +22,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v2.3.4

- name: Install PHP
uses: shivammathur/setup-php@v2
Expand All @@ -36,7 +33,7 @@ jobs:
tools: composer:v2

- name: Determine composer cache directory
run: echo "::set-env name=COMPOSER_CACHE_DIR::$(composer config cache-dir)"
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV

- name: Cache dependencies installed with composer
uses: actions/cache@v2
Expand All @@ -46,13 +43,15 @@ jobs:
restore-keys: |
php${{ matrix.php }}-composer-
- name: Update composer
run: composer self-update

- name: Install dependencies with composer
run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi

- name: Run test mutation infection with coverage
- name: Run infection
run: |
mkdir -p build/logs
vendor/bin/phpunit --coverage-xml=build/logs/coverage-xml --log-junit=build/logs/junit.xml --colors=always
vendor/bin/infection --threads=2 --coverage=build/logs --show-mutations --no-progress --skip-initial-tests --min-msi=50 --min-covered-msi=80
git fetch --depth=1 origin $GITHUB_BASE_REF
vendor/bin/roave-infection-static-analysis-plugin -j2 --git-diff-filter=A --git-diff-base=origin/$GITHUB_BASE_REF --logger-github --ignore-msi-with-no-mutations --only-covered
env:
STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}
12 changes: 6 additions & 6 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ jobs:
mutation:
name: PHP ${{ matrix.php }}-${{ matrix.os }}

env:
update: true

runs-on: ${{ matrix.os }}

strategy:
Expand All @@ -23,17 +20,17 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v2.3.4

- name: Install PHP"
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: "${{ matrix.php }}"
tools: composer:v2, cs2pr
coverage: none

- name: Determine composer cache directory
run: echo "::set-env name=COMPOSER_CACHE_DIR::$(composer config cache-dir)"
run: echo "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV

- name: Cache dependencies installed with composer
uses: actions/cache@v2
Expand All @@ -43,6 +40,9 @@ jobs:
restore-keys: |
php${{ matrix.php }}-composer-
- name: Update composer
run: composer self-update

- name: Install dependencies with composer
run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi

Expand Down
40 changes: 28 additions & 12 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,34 @@
checks:
php: true

filter:
paths:
- "src/*"

build:
environment:
php: "7.4"
nodes:
analysis:
environment:
php: 7.4.12

tests:
override:
- php-scrutinizer-run
filter:
paths:
- "src/*"
checks:
php: true
tools:
php_code_coverage:
enabled: true
external_code_coverage:
timeout: 600

tests-and-coverage:
environment:
php: 7.4.12

dependencies:
override:
- composer self-update
- composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi

tests:
override:
-
command: "./vendor/bin/phpunit --coverage-clover ./coverage.xml"
on_node: 1
coverage:
file: coverage.xml
format: php-clover
33 changes: 26 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,26 +37,45 @@ There are three main steps using the package:
3. Optionally [use asset converter with asset bundle](docs/asset-converter.md) for asset format conversion (such as TypeScript to JavaScript).
4. Use your favorite method to include files into HTML (out of scope of this package).

## Unit testing
### Unit testing

The package is tested with [PHPUnit](https://phpunit.de/). To run tests:

```php
```shell
./vendor/bin/phpunit
```

## Mutation testing
### Mutation testing

The package tests are checked with [Infection](https://infection.github.io/) mutation framework. To run it:

```php
```shell
./vendor/bin/infection
```

## Static analysis
### Static analysis

The code is statically analyzed with [Psalm](https://psalm.dev/docs/). To run static analysis:
The code is statically analyzed with [Psalm](https://psalm.dev/). To run static analysis:

```php
```shell
./vendor/bin/psalm
```

### Support the project

[![Open Collective](https://img.shields.io/badge/Open%20Collective-sponsor-7eadf1?logo=open%20collective&logoColor=7eadf1&labelColor=555555)](https://opencollective.com/yiisoft)

### Follow updates

[![Official website](https://img.shields.io/badge/Powered_by-Yii_Framework-green.svg?style=flat)](https://www.yiiframework.com/)
[![Twitter](https://img.shields.io/badge/twitter-follow-1DA1F2?logo=twitter&logoColor=1DA1F2&labelColor=555555?style=flat)](https://twitter.com/yiiframework)
[![Telegram](https://img.shields.io/badge/telegram-join-1DA1F2?style=flat&logo=telegram)](https://t.me/yii3en)
[![Facebook](https://img.shields.io/badge/facebook-join-1DA1F2?style=flat&logo=facebook&logoColor=ffffff)](https://www.facebook.com/groups/yiitalk)
[![Slack](https://img.shields.io/badge/slack-join-1DA1F2?style=flat&logo=slack)](https://yiiframework.com/go/slack)

## License

The Yii Assets is free software. It is released under the terms of the BSD License.
Please see [`LICENSE`](./LICENSE.md) for more information.

Maintained by [Yii Software](https://www.yiiframework.com/).
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
"yiisoft/files": "^3.0@dev"
},
"require-dev": {
"infection/infection": "^0.19",
"phpunit/phpunit": "^9.4",
"vimeo/psalm": "^4.0",
"foxy/foxy": "^1.0.8",
"phpunit/phpunit": "^9.4",
"roave/infection-static-analysis-plugin": "^1.3",
"vimeo/psalm": "^4.1",
"yiisoft/di": "^3.0@dev"
},
"autoload": {
Expand Down

0 comments on commit 6336c50

Please sign in to comment.