Skip to content

Commit

Permalink
Update test pipelines and dev dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
terabytesoftw committed Nov 5, 2020
1 parent 1605ff8 commit 831b9b3
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 57 deletions.
33 changes: 17 additions & 16 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ name: build

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

env:
key: cache-v1

Expand All @@ -18,48 +19,48 @@ jobs:
- ubuntu-latest
- windows-latest

php-version:
php:
- "7.4"
- "8.0"

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

- 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@v2
with:
path: ${{ env.COMPOSER_CACHE_DIR }}
key: php${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }}
key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: |
php${{ matrix.php-version }}-composer-
php${{ matrix.php }}-composer-
- name: Install dependencies with composer php 7.4
if: matrix.php-version == '7.4'
run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader
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-version == '8.0'
run: composer update --ignore-platform-reqs --prefer-dist --no-interaction --no-progress --optimize-autoloader
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-version == '7.4'
run: vendor/bin/phpunit --coverage-clover=coverage.clover
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-version != '7.4'
run: vendor/bin/phpunit
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-version == '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
29 changes: 14 additions & 15 deletions .github/workflows/mutation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ name: mutation test

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

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

Expand All @@ -17,39 +17,38 @@ jobs:
os:
- ubuntu-latest

php-version:
php:
- "7.4"

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

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: "${{ matrix.php-version }}"
php-version: "${{ matrix.php }}"
ini-values: memory_limit=-1
coverage: "pcov"
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
with:
path: ${{ env.COMPOSER_CACHE_DIR }}
key: php${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }}
key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: |
php${{ matrix.php-version }}-composer-
php${{ matrix.php }}-composer-
- name: Install dependencies with composer
run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader
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
vendor/bin/infection --threads=2 --coverage=build/logs --show-mutations --no-progress --min-msi=10 --min-covered-msi=10
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 }}
27 changes: 12 additions & 15 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@ name: static analysis

jobs:
mutation:
name: PHP ${{ matrix.php-version }}-${{ matrix.os }}
env:
extensions: ast
name: PHP ${{ matrix.php }}-${{ matrix.os }}

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

Expand All @@ -17,34 +15,33 @@ jobs:
os:
- ubuntu-latest

php-version:
php:
- "7.4"

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

- name: "Install PHP"
uses: "shivammathur/setup-php@v2"
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: "${{ matrix.php-version }}"
extensions: ${{ env.extensions }}
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
with:
path: ${{ env.COMPOSER_CACHE_DIR }}
key: php${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }}
key: php${{ matrix.php }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: |
php${{ matrix.php-version }}-composer-
php${{ matrix.php }}-composer-
- name: Install dependencies with composer
run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader
run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi

- name: Static analysis with psalm
- name: Static analysis
run: vendor/bin/psalm --shepherd --stats --output-format=checkstyle | cs2pr --graceful-warnings --colorize
34 changes: 24 additions & 10 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
[![Code Coverage](https://scrutinizer-ci.com/g/yiisoft/cookies/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/yiisoft/cookies/?branch=master)
[![Mutation testing badge](https://img.shields.io/endpoint?style=flat&url=https%3A%2F%2Fbadge-api.stryker-mutator.io%2Fgithub.com%2Fyiisoft%2Fcookies%2Fmaster)](https://dashboard.stryker-mutator.io/reports/github.com/yiisoft/cookies/master)
[![static analysis](https://github.com/yiisoft/cookies/workflows/static%20analysis/badge.svg)](https://github.com/yiisoft/cookies/actions?query=workflow%3A%22static+analysis%22)
[![type-coverage](https://shepherd.dev/github/yiisoft/cookies/coverage.svg)](https://shepherd.dev/github/yiisoft/cookies)

The package helps in working with HTTP cookies in a [PSR-7](https://www.php-fig.org/psr/psr-7/) environment:

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
"yiisoft/http": "^1.0"
},
"require-dev": {
"infection/infection": "^0.20.1",
"nyholm/psr7": "^1.3",
"phpunit/phpunit": "^9.4",
"roave/infection-static-analysis-plugin": "^1.3",
"vimeo/psalm": "^4.1"
},
"autoload": {
Expand Down

0 comments on commit 831b9b3

Please sign in to comment.