forked from jenssegers/model
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add phpcs and phpstan to workflow
- Loading branch information
Showing
8 changed files
with
243 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,56 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
pull_request: | ||
push: | ||
pull_request: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
php: [8.1, 8.2, 8.3] | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php }} | ||
tools: pecl | ||
extensions: xdebug | ||
- name: Show php version | ||
run: php -v && composer -V | ||
- name: Debug if needed | ||
run: if [[ "$DEBUG" == "true" ]]; then env; fi | ||
env: | ||
DEBUG: ${{secrets.DEBUG}} | ||
- name: Get Composer Cache Directory | ||
id: composer-cache | ||
run: echo "::set-output name=dir::$(composer config cache-files-dir)" | ||
- name: Cache dependencies | ||
uses: actions/cache@v1 | ||
with: | ||
path: ${{ steps.composer-cache.outputs.dir }} | ||
key: ${{ matrix.os }}-composer-${{ hashFiles('**/composer.json') }} | ||
restore-keys: ${{ matrix.os }}-composer- | ||
- name: Install dependencies | ||
run: composer install --prefer-source | ||
- name: Run unit tests | ||
run: ./vendor/bin/phpunit --coverage-clover build/logs/clover.xml | ||
- name: Run Coverage | ||
run: ./vendor/bin/php-coveralls -v | ||
env: | ||
COVERALLS_RUN_LOCALLY: ${{ secrets.COVERALLS_RUN_LOCALLY }} | ||
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
continue-on-error: true | ||
- name: show coverage json | ||
run: cat build/logs/coveralls-upload.json | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
php: [8.1, 8.2, 8.3] | ||
stability: [prefer-stable] | ||
|
||
name: PHP ${{ matrix.php }} - ${{ matrix.stability }} | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup php | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: ${{ matrix.php }} | ||
tools: pecl | ||
extensions: xdebug | ||
|
||
- name: Show php version | ||
run: php -v && composer -V | ||
|
||
- name: Debug if needed | ||
run: if [[ "$DEBUG" == "true" ]]; then env; fi | ||
env: | ||
DEBUG: ${{secrets.DEBUG}} | ||
|
||
- name: Install dependencies | ||
run: composer install --prefer-source | ||
|
||
- name: PHP code standard | ||
run: php vendor/bin/phpcs --standard=phpcs.xml src/ tests/ | ||
|
||
- name: PHP static analysis | ||
run: php vendor/bin/phpstan analyse | ||
|
||
- name: Run unit tests | ||
run: ./vendor/bin/phpunit --coverage-clover build/logs/clover.xml | ||
|
||
- name: Run coverage | ||
run: ./vendor/bin/php-coveralls -v | ||
env: | ||
COVERALLS_RUN_LOCALLY: ${{ secrets.COVERALLS_RUN_LOCALLY }} | ||
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
continue-on-error: true | ||
|
||
- name: Show coverage json | ||
run: cat build/logs/coveralls-upload.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<?xml version="1.0"?> | ||
<ruleset name="CustomSupportPal"> | ||
<description>Custom PHPCS config based on the SupportPal coding standard.</description> | ||
<rule ref="vendor/supportpal/coding-standard" /> | ||
</ruleset> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
parameters: | ||
ignoreErrors: | ||
- | ||
message: "#^Parameter \\#1 \\$callback of function call_user_func_array expects callable\\(\\)\\: mixed, array\\{static\\(Jenssegers\\\\Model\\\\Model\\), string\\} given\\.$#" | ||
count: 1 | ||
path: src/Model.php | ||
|
||
- | ||
message: "#^Unsafe usage of new static\\(\\)\\.$#" | ||
count: 4 | ||
path: src/Model.php | ||
|
||
- | ||
message: "#^Access to an undefined property Jenssegers\\\\Model\\\\Model\\:\\:\\$name\\.$#" | ||
count: 1 | ||
path: tests/ModelTest.php | ||
|
||
- | ||
message: "#^Access to an undefined property ModelStub\\:\\:\\$active\\.$#" | ||
count: 1 | ||
path: tests/ModelTest.php | ||
|
||
- | ||
message: "#^Access to an undefined property ModelStub\\:\\:\\$age\\.$#" | ||
count: 1 | ||
path: tests/ModelTest.php | ||
|
||
- | ||
message: "#^Access to an undefined property ModelStub\\:\\:\\$bar\\.$#" | ||
count: 1 | ||
path: tests/ModelTest.php | ||
|
||
- | ||
message: "#^Access to an undefined property ModelStub\\:\\:\\$birthday\\.$#" | ||
count: 1 | ||
path: tests/ModelTest.php | ||
|
||
- | ||
message: "#^Access to an undefined property ModelStub\\:\\:\\$city\\.$#" | ||
count: 3 | ||
path: tests/ModelTest.php | ||
|
||
- | ||
message: "#^Access to an undefined property ModelStub\\:\\:\\$collection_data\\.$#" | ||
count: 1 | ||
path: tests/ModelTest.php | ||
|
||
- | ||
message: "#^Access to an undefined property ModelStub\\:\\:\\$count\\.$#" | ||
count: 1 | ||
path: tests/ModelTest.php | ||
|
||
- | ||
message: "#^Access to an undefined property ModelStub\\:\\:\\$data\\.$#" | ||
count: 1 | ||
path: tests/ModelTest.php | ||
|
||
- | ||
message: "#^Access to an undefined property ModelStub\\:\\:\\$default\\.$#" | ||
count: 1 | ||
path: tests/ModelTest.php | ||
|
||
- | ||
message: "#^Access to an undefined property ModelStub\\:\\:\\$foo\\.$#" | ||
count: 4 | ||
path: tests/ModelTest.php | ||
|
||
- | ||
message: "#^Access to an undefined property ModelStub\\:\\:\\$list_items\\.$#" | ||
count: 2 | ||
path: tests/ModelTest.php | ||
|
||
- | ||
message: "#^Access to an undefined property ModelStub\\:\\:\\$name\\.$#" | ||
count: 10 | ||
path: tests/ModelTest.php | ||
|
||
- | ||
message: "#^Access to an undefined property ModelStub\\:\\:\\$object_data\\.$#" | ||
count: 1 | ||
path: tests/ModelTest.php | ||
|
||
- | ||
message: "#^Access to an undefined property ModelStub\\:\\:\\$password\\.$#" | ||
count: 2 | ||
path: tests/ModelTest.php | ||
|
||
- | ||
message: "#^Access to an undefined property ModelStub\\:\\:\\$score\\.$#" | ||
count: 1 | ||
path: tests/ModelTest.php | ||
|
||
- | ||
message: "#^Access to an undefined property ModelStub\\:\\:\\$secret\\.$#" | ||
count: 2 | ||
path: tests/ModelTest.php | ||
|
||
- | ||
message: "#^Parameter \\#1 \\$callback of static method Jenssegers\\\\Model\\\\Model\\:\\:unguarded\\(\\) expects callable\\(\\)\\: mixed, array\\{PHPUnit\\\\Framework\\\\MockObject\\\\MockObject&stdClass, 'callback'\\} given\\.$#" | ||
count: 1 | ||
path: tests/ModelTest.php |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
includes: | ||
- phpstan-baseline.neon | ||
|
||
parameters: | ||
level: 8 | ||
paths: | ||
- src | ||
- tests | ||
parallel: | ||
processTimeout: 300.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.