Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Robo 4 and Github Actions #8

Merged
merged 3 commits into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Build
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build:
name: PHP ${{ matrix.php-versions }} ${{ matrix.composer-args }}
strategy:
fail-fast: false
matrix:
operating-system: [ubuntu-latest]
php-versions: ["7.4", "8.0", "8.1", "8.2", "8.3"]
composer-args: ["", "--prefer-lowest"]
runs-on: ${{ matrix.operating-system }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup PHP
uses: shivammathur/setup-php@2.30.2
with:
php-version: ${{ matrix.php-versions }}
extensions: mbstring
coverage: pcov
tools: cs2pr
- name: Setup problem matchers for PHPUnit
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: php${{ matrix.php-versions }}-composer-${{ matrix.composer-args }}-${{ hashFiles('**/composer.json') }}
restore-keys: php${{ matrix.php-versions }}-composer-${{ matrix.composer-args }}-
- name: Install Dependencies
run: |
composer update --no-progress --no-suggest --prefer-stable --optimize-autoloader ${{ matrix.composer-args }}
- name: PHPStan
run: composer phpstan
- name: Code Style Check
env:
PHP_CS_FIXER_IGNORE_ENV: true
run: composer style-check -- --format=checkstyle | cs2pr
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
composer.lock
.php_cs.cache
vendor/
.php-cs-fixer.cache
6 changes: 3 additions & 3 deletions .php_cs.dist → .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
->files()
->in(__DIR__)
;
return PhpCsFixer\Config::create()
->setRiskyAllowed(true)
$config = new PhpCsFixer\Config();
return $config->setRiskyAllowed(true)
->setRules([
'@PSR2' => true,
'@PHP70Migration' => true,
'@PHP71Migration' => true,
'@PHP71Migration:risky' => true,
'binary_operator_spaces' => ['align_double_arrow' => true, 'align_equals' => true],
'binary_operator_spaces' => ['operators' => ['=' => 'align', '=>' => 'align']],
'single_quote' => false,
'array_syntax' => ['syntax' => 'short'],
'concat_space' => ['spacing' => 'one'],
Expand Down
27 changes: 0 additions & 27 deletions .travis.yml

This file was deleted.

8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@
"php": ">=7.1"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.11",
"phpstan/phpstan": "^0.9.2"
"friendsofphp/php-cs-fixer": "3.54.0",
"phpstan/phpstan": "^1.10.0"
},
"scripts": {
"check-style": "php-cs-fixer fix --dry-run -vv",
"style-check": "php-cs-fixer fix --dry-run -vv",
"fix-style": "php-cs-fixer fix",
"phpstan-analysis": "phpstan analyse -l 7 -c phpstan.neon src"
"phpstan": "phpstan analyse -c phpstan.neon --ansi"
}
}
11 changes: 7 additions & 4 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
parameters:
level: 1
paths:
- ./src
ignoreErrors:
# The analyser can't follow these due to Robo's use of magic methods and call_user_func_array
- '#Method Robo\\Tasks::task\(\) invoked with 4 parameters, 0 required\.#'
- '#Method Robo\\Tasks::task\(\) invoked with 5 parameters, 0 required\.#'
- '#Call to an undefined method Robo\\Contract\\TaskInterface::withDumpSettings\(\)\.#'
- '#Call to an undefined method Robo\\Contract\\TaskInterface::toDir\(\)\.#'
#- '#Method Robo\\Tasks::task\(\) invoked with 4 parameters, 0 required\.#'
#- '#Method Robo\\Tasks::task\(\) invoked with 5 parameters, 0 required\.#'
#- '#Call to an undefined method Robo\\Contract\\TaskInterface::withDumpSettings\(\)\.#'
#- '#Call to an undefined method Robo\\Contract\\TaskInterface::toDir\(\)\.#'