Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Update dev dependencies, pipelines, fix Scrutinizer
  • Loading branch information
terabytesoftw committed Nov 6, 2020
1 parent ef36b04 commit f444810
Show file tree
Hide file tree
Showing 7 changed files with 210 additions and 93 deletions.
74 changes: 74 additions & 0 deletions .github/workflows/build.yml
@@ -0,0 +1,74 @@
on:
- pull_request
- push

name: build

jobs:
tests:
name: PHP ${{ matrix.php }}-${{ matrix.os }}

env:
key: cache-v1

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

strategy:
matrix:
os:
- ubuntu-latest
- windows-latest

php:
- "7.4"
- "8.0"

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

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
ini-values: date.timezone='UTC'
coverage: pcov
tools: composer:v2

- name: Determine composer cache directory on Linux
if: matrix.os == 'ubuntu-latest'
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 "COMPOSER_CACHE_DIR=~\AppData\Local\Composer" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append

- name: Cache dependencies installed with composer
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: Install dependencies with composer php 7.4
if: matrix.php == '7.4'
run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi

- name: Install dependencies with composer php 8.0
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
if: matrix.os != 'ubuntu-latest' || matrix.php != '7.4'
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
54 changes: 54 additions & 0 deletions .github/workflows/mutation.yml
@@ -0,0 +1,54 @@
on:
pull_request:
push:
branches:
- "master"

name: mutation test

jobs:
mutation:
name: PHP ${{ matrix.php }}-${{ matrix.os }}

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

strategy:
matrix:
os:
- ubuntu-latest

php:
- "7.4"

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

- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: "${{ matrix.php }}"
ini-values: memory_limit=-1
coverage: "pcov"
tools: composer:v2

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

- name: Cache dependencies installed with composer
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: Install dependencies with composer
run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi

- name: Run infection
run: |
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 }}
47 changes: 47 additions & 0 deletions .github/workflows/static.yml
@@ -0,0 +1,47 @@
on:
- pull_request
- push

name: static analysis

jobs:
mutation:
name: PHP ${{ matrix.php }}-${{ matrix.os }}

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

strategy:
matrix:
os:
- ubuntu-latest

php:
- "7.4"

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

- 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 "COMPOSER_CACHE_DIR=$(composer config cache-dir)" >> $GITHUB_ENV

- name: Cache dependencies installed with composer
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: Install dependencies with composer
run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi

- name: Static analysis
run: vendor/bin/psalm --shepherd --stats --output-format=checkstyle | cs2pr --graceful-warnings --colorize
34 changes: 24 additions & 10 deletions .scrutinizer.yml
@@ -1,18 +1,32 @@
build:
environment:
php: "7.4"
nodes:
analysis:
tests:
override:
- php-scrutinizer-run
checks:
php: true

filter:
paths:
- "src/*"
checks:
php: true

tools:
php_code_coverage:
enabled: true
external_code_coverage:
timeout: 600

build:
environment:
php: 7.4.12
nodes:
analysis:
tests:
override:
- php-scrutinizer-run
dependencies:
override:
- 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
78 changes: 0 additions & 78 deletions .travis.yml

This file was deleted.

9 changes: 7 additions & 2 deletions README.md
Expand Up @@ -10,7 +10,12 @@ This library provides the VarDumper helper.

[![Latest Stable Version](https://poser.pugx.org/yiisoft/var-dumper/v/stable.png)](https://packagist.org/packages/yiisoft/var-dumper)
[![Total Downloads](https://poser.pugx.org/yiisoft/var-dumper/downloads.png)](https://packagist.org/packages/yiisoft/var-dumper)
[![Build Status](https://travis-ci.com/yiisoft/var-dumper.svg?branch=master)](https://travis-ci.com/yiisoft/var-dumper)
[![Build Status](https://github.com/yiisoft/var-dumper/workflows/build/badge.svg)](https://github.com/yiisoft/var-dumper/actions)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/yiisoft/var-dumper/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/yiisoft/var-dumper/?branch=master)
[![Code Coverage](https://scrutinizer-ci.com/g/yiisoft/var-dumper/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/yiisoft/var-dumper/?branch=master)
[![Mutation testing badge](https://img.shields.io/endpoint?style=flat&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2Fyiisoft%2Fvar-dumper%2Fmaster)](https://dashboard.stryker-mutator.io/reports/github.com/yiisoft/var-dumper/master)
[![static analysis](https://github.com/yiisoft/var-dumper/workflows/static%20analysis/badge.svg)](https://github.com/yiisoft/var-dumper/actions?query=workflow%3A%22static+analysis%22)
[![type-coverage](https://shepherd.dev/github/yiisoft/var-dumper/coverage.svg)](https://shepherd.dev/github/yiisoft/var-dumper)

## Unit testing

Expand All @@ -26,4 +31,4 @@ The code is statically analyzed with [Psalm](https://psalm.dev/). To run static

```php
./vendor/bin/psalm
```
```
7 changes: 4 additions & 3 deletions composer.json
Expand Up @@ -25,9 +25,10 @@
"ext-json": "*"
},
"require-dev": {
"phpunit/phpunit": "^9.3",
"yiisoft/composer-config-plugin": "^1.0@dev",
"vimeo/psalm": "^4.0"
"phpunit/phpunit": "^9.4",
"roave/infection-static-analysis-plugin": "^1.3",
"vimeo/psalm": "^4.1",
"yiisoft/composer-config-plugin": "^1.0@dev"
},
"autoload": {
"psr-4": {
Expand Down

0 comments on commit f444810

Please sign in to comment.