Skip to content

Commit

Permalink
Enhance CI
Browse files Browse the repository at this point in the history
  • Loading branch information
trasher committed Feb 11, 2024
1 parent 54d5874 commit 1a4ef71
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 8 deletions.
1 change: 1 addition & 0 deletions .composer-require-checker.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"GALETTE_IMPORTS_PATH",
"GALETTE_LOGS_PATH",
"GALETTE_MODE",
"GALETTE_DEBUG",
"GALETTE_NIGHTLY",
"GALETTE_PHOTOS_PATH",
"GALETTE_PLUGINS_PATH",
Expand Down
24 changes: 17 additions & 7 deletions .github/workflows/ci-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,16 @@ on:
pull_request:

jobs:
ubuntu-latest:
lint:
runs-on: ubuntu-latest
name: "Lint on PHP ${{ matrix.php-versions }}"

strategy:
matrix:
php-versions: [ '8.1', '8.2' ]
php-versions: [ '8.1', '8.3' ]
coverage: [none]
fail-fast: false

name: PHP ${{ matrix.php-versions }} on ubuntu-latest

steps:
- name: PHP
uses: shivammathur/setup-php@v2
Expand All @@ -31,15 +30,15 @@ jobs:
coverage: ${{ matrix.coverage }}

- name: Checkout Galette core
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
repository: galette/galette
path: galette-core
fetch-depth: 1
ref: develop

- name: Checkout plugin
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
path: galette-core/galette/plugins/plugin-paypal

Expand All @@ -49,7 +48,7 @@ jobs:
echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
Expand All @@ -65,11 +64,22 @@ jobs:
cd galette-core/galette/plugins/plugin-paypal
../../vendor/bin/phpcs lib/ ./*.php
- name: Twig CS
run: |
cd galette-core/galette/plugins/plugin-paypal
../../vendor/bin/twigcs templates/default --severity error --display blocking
- name: Check missing symbols
run: |
cd galette-core/galette/plugins/plugin-paypal
composer require maglnet/composer-require-checker -W
vendor/bin/composer-require-checker check --config-file=.composer-require-checker.config.json ../../composer.json
if: matrix.php-versions == '8.3'

- name: PHPStan checks
run: |
cd galette-core/galette/plugins/plugin-paypal
../../vendor/bin/phpstan analyze --ansi --memory-limit=2G --no-interaction --no-progress
- name: Headers checks
run: |
Expand Down
4 changes: 3 additions & 1 deletion lib/GalettePaypal/Paypal.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ public function load(): void
try {
$results = $this->zdb->selectAll(PAYPAL_PREFIX . self::PREFS_TABLE);

/** @var \ArrayObject<string, mixed> $row */
foreach ($results as $row) {
switch ($row->nom_pref) {
case 'paypal_id':
Expand Down Expand Up @@ -272,7 +273,7 @@ public function storeAmounts(): bool
/**
* Add missing types in paypal table
*
* @param array<string, string> $queries Array of items to insert
* @param array<int, array<string, mixed>> $queries Array of items to insert
*
* @return void
*/
Expand All @@ -299,6 +300,7 @@ private function newEntries(array $queries): void
} catch (\Exception $e) {
Analog::log(
'Unable to store missing types in paypal table.' .
//@phpstan-ignore-next-line
$stmt->getMessage() . '(' . $stmt->getDebugInfo() . ')',
Analog::WARNING
);
Expand Down
18 changes: 18 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
parameters:
parallel:
maximumNumberOfProcesses: 2
level: 5
paths:
- lib/
scanFiles:
- _config.inc.php
- ../../config/paths.inc.php
- ../../config/config.inc.php.dist
- ../../config/galette_tcpdf_config.php
scanDirectories:
- ../../includes/
- ../../lib/
universalObjectCratesClasses:
- RKA\Session
ignoreErrors:
- '/Access to an undefined property ArrayObject.*/'

0 comments on commit 1a4ef71

Please sign in to comment.