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

feat: setup phpstan & rector #89

Merged
merged 8 commits into from
Oct 26, 2023
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
64 changes: 61 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: Continuous Integration
on: [push, pull_request]
on: [ push, pull_request ]

jobs:
linter:
name: Code style
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: 8.1
Expand All @@ -22,10 +22,68 @@ jobs:
flags: [ '', '--prefer-lowest' ]
fail-fast: false
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.version }}
coverage: xdebug2
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-
- run: composer update --prefer-dist --no-interaction ${{ matrix.flags }}
- run: bin/atoum

phpstan:
name: PHPStan checks
runs-on: ubuntu-20.04
strategy:
matrix:
version: [ 8.1, 8.2 ]
flags:
- ''
# TODO add --prefer-lowest once we're ready to handle it
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.version }}
coverage: xdebug2
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-
- run: composer update --prefer-dist --no-interaction ${{ matrix.flags }}
- run: bin/phpstan

rector:
name: Rector checks
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v4
- uses: shivammathur/setup-php@v2
with:
php-version: 8.1
coverage: xdebug2
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ runner.os }}-composer-
- run: composer update --prefer-dist --no-interaction
- run: bin/rector --dry-run
5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@
"atoum/stubs": "*",
"m6web/php-cs-fixer-config": "3.2.0",
"friendsofphp/php-cs-fixer": "3.35.1",
"guzzlehttp/promises": "^2"
"guzzlehttp/promises": "^2",
"phpstan/phpstan": "1.10.38",
"phpstan/phpstan-symfony": "1.3.4",
"rector/rector": "0.18.5"
},
"autoload": {
"psr-4": {"M6Web\\Bundle\\GuzzleHttpBundle\\": "src/"}
Expand Down
Loading