Skip to content

Commit

Permalink
Update psalm and phpunit (#16)
Browse files Browse the repository at this point in the history
* Add scripts to composer

* Upgrade psalm

* Add psalm config

* Fix errors

* update test workflow

* Upgrade phpunit to v9.5

* Remove Makefile
  • Loading branch information
Slava authored Oct 8, 2021
1 parent 786326c commit c3293fa
Show file tree
Hide file tree
Showing 8 changed files with 1,667 additions and 1,121 deletions.
53 changes: 46 additions & 7 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:

env:
EXECUTE_COVERAGE: ${{ matrix.php-version == '7.3' }}
CLOVER_PATH: "clover.xml"

steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -43,22 +44,22 @@ jobs:
run: composer config -g github-oauth.github.com ${{ secrets.COMPOSER_TOKEN }}

- name: Install dependencies
run: make install
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --no-suggest

- name: Run PhpUnit with coverage
if: env.EXECUTE_COVERAGE == 'true'
run: make report-coverage
run: composer run test-unit -- --coverage-clover ${{ env.CLOVER_PATH }}

- name: Run PhpUnit
if: env.EXECUTE_COVERAGE != 'true'
run: make test
run: composer run test-unit

- name: Coverage monitor
if: env.EXECUTE_COVERAGE == 'true'
uses: slavcodev/coverage-monitor-action@1.0.1
uses: slavcodev/coverage-monitor-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
clover_file: "logs/clover.xml"
clover_file: ${{ env.CLOVER_PATH }}
comment: false
threshold_alert: 80
threshold_warning: 90
Expand Down Expand Up @@ -96,7 +97,45 @@ jobs:
run: composer config -g github-oauth.github.com ${{ secrets.COMPOSER_TOKEN }}

- name: Install dependencies
run: make install
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --no-suggest

- name: Lint code
run: make lint
run: composer run test-cs

static-analysis:
runs-on: ubuntu-latest

strategy:
matrix:
php-version: ['7.3']

steps:
- uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: ${{ env.PHP_EXTENSIONS }}
tools: composer:v1

- name: Get Composer Cache Directory
id: composer-cache
run: |
echo "::set-output name=dir::$(composer config cache-files-dir)"
- uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-composer-
- name: Login composer
run: composer config -g github-oauth.github.com ${{ secrets.COMPOSER_TOKEN }}

- name: Install dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --no-suggest

- name: Run psalm
run: composer run test-code
66 changes: 0 additions & 66 deletions Makefile

This file was deleted.

20 changes: 15 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@

"require-dev": {
"friendsofphp/php-cs-fixer": "^2.16",
"php-coveralls/php-coveralls": "^2.1",
"phpunit/phpunit": "^9.0",
"psalm/plugin-phpunit": "^0.9.0",
"vimeo/psalm": "^3.9"
"phpunit/phpunit": "^9.5",
"psalm/plugin-phpunit": "^0.16.1",
"vimeo/psalm": "^4.10"
},

"autoload": {
Expand All @@ -43,5 +42,16 @@
},

"suggest": {},
"scripts": {}
"scripts": {
"test-unit": "phpunit",
"show-coverage": "phpunit --coverage-text=php://stdout",
"test-code": "psalm --threads=1 --no-cache --find-dead-code=always --show-info=false",
"fix-cs": "php-cs-fixer fix --config=.php_cs -v --using-cache=no --ansi",
"test-cs": "php-cs-fixer fix --dry-run --config=.php_cs -v --using-cache=no --ansi",
"test": [
"@test-cs",
"@test-code",
"@test-unit"
]
}
}
Loading

0 comments on commit c3293fa

Please sign in to comment.