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

Improved Github Action (Support PHP 5.6 => 8.1) #60

Merged
merged 1 commit into from
Feb 11, 2022
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
Improved Github Action PHP
  • Loading branch information
Progi1984 committed Feb 11, 2022
commit 21fa3988c461ba2da3f7286d2c2e789915751680
163 changes: 86 additions & 77 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
@@ -1,80 +1,89 @@
name: PHP tests
on: [push, pull_request]
jobs:
# Check there is no syntax errors in the project
php-linter:
name: PHP Syntax check 5.6|7.2|7.3
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2.0.0

- name: PHP syntax checker 5.6
uses: prestashop/github-action-php-lint/5.6@master

- name: PHP syntax checker 7.2
uses: prestashop/github-action-php-lint/7.2@master

- name: PHP syntax checker 7.3
uses: prestashop/github-action-php-lint/7.3@master

# Check the PHP code follow the coding standards
php-cs-fixer:
name: PHP-CS-Fixer
runs-on: ubuntu-latest
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'

- name: Checkout
uses: actions/checkout@v2.0.0

- name: Cache dependencies
uses: actions/cache@v2
with:
path: vendor
key: php-${{ hashFiles('composer.lock') }}

- name: Install dependencies
run: composer install

- name: Run PHP-CS-Fixer
run: ./vendor/bin/php-cs-fixer fix --dry-run --diff --using-cache=no --diff-format udiff

# Run PHPStan against the module and a PrestaShop release
phpstan:
name: PHPStan
runs-on: ubuntu-latest
strategy:
matrix:
presta-versions: ['1.7.1.2', '1.7.2.5', '1.7.3.4', '1.7.4.4', '1.7.5.1', '1.7.6.9', '1.7.7.4', 'latest']
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'

- name: Checkout
uses: actions/checkout@v2.0.0

# Add vendor folder in cache to make next builds faster
- name: Cache vendor folder
uses: actions/cache@v1
with:
path: vendor
key: php-${{ hashFiles('composer.lock') }}

# Add composer local folder in cache to make next builds faster
- name: Cache composer folder
uses: actions/cache@v1
with:
path: ~/.composer/cache
key: php-composer-cache

- run: composer install

# Docker images prestashop/prestashop may be used, even if the shop remains uninstalled
- name: Execute PHPStan on PrestaShop (Tag ${{ matrix.presta-versions }})
run: ./tests/phpstan.sh ${{ matrix.presta-versions }}
# Check there is no syntax errors in the project
php-linter:
name: PHP Syntax check 5.6 => 8.1
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2.0.0

- name: PHP syntax checker 5.6
uses: prestashop/github-action-php-lint/5.6@master

- name: PHP syntax checker 7.2
uses: prestashop/github-action-php-lint/7.2@master

- name: PHP syntax checker 7.3
uses: prestashop/github-action-php-lint/7.3@master

- name: PHP syntax checker 7.4
uses: prestashop/github-action-php-lint/7.4@master

- name: PHP syntax checker 8.0
uses: prestashop/github-action-php-lint/8.0@master

- name: PHP syntax checker 8.1
uses: prestashop/github-action-php-lint/8.1@master

# Check the PHP code follow the coding standards
php-cs-fixer:
name: PHP-CS-Fixer
runs-on: ubuntu-latest
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'

- name: Checkout
uses: actions/checkout@v2.0.0

- name: Cache dependencies
uses: actions/cache@v2
with:
path: vendor
key: php-${{ hashFiles('composer.lock') }}

- name: Install dependencies
run: composer install

- name: Run PHP-CS-Fixer
run: ./vendor/bin/php-cs-fixer fix --dry-run --diff --using-cache=no --diff-format udiff

# Run PHPStan against the module and a PrestaShop release
phpstan:
name: PHPStan
runs-on: ubuntu-latest
strategy:
matrix:
presta-versions: ['1.7.1.2', '1.7.2.5', '1.7.3.4', '1.7.4.4', '1.7.5.1', '1.7.6', '1.7.7', '1.7.8', 'latest']
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'

- name: Checkout
uses: actions/checkout@v2.0.0

# Add vendor folder in cache to make next builds faster
- name: Cache vendor folder
uses: actions/cache@v1
with:
path: vendor
key: php-${{ hashFiles('composer.lock') }}

# Add composer local folder in cache to make next builds faster
- name: Cache composer folder
uses: actions/cache@v1
with:
path: ~/.composer/cache
key: php-composer-cache

- run: composer install

# Docker images prestashop/prestashop may be used, even if the shop remains uninstalled
- name: Execute PHPStan on PrestaShop (Tag ${{ matrix.presta-versions }})
run: ./tests/phpstan.sh ${{ matrix.presta-versions }}
2 changes: 0 additions & 2 deletions tests/phpstan/phpstan-1.7.1.2.neon
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ includes:
parameters:
ignoreErrors:
- '#Access to an undefined property HelperList\:\:\$shopLinkType.#'
- '#Access to protected property HelperForm\:\:\$fields_form.#'
- '#Call to method assign\(\) on an unknown class Smarty_Data.#'
- '#Parameter \#1 \$id of class Supplier constructor expects null, int given.#'
- '#Parameter \#1 \$idCategory of class Category constructor expects null, int given.#'
- '#Parameter \#2 \$idLang of class Category constructor expects null, int given.#'
- '#Parameter \#2 \$idLang of class Supplier constructor expects null, int given.#'
- '#Parameter \#2 \$selection of static method CMSCore\:\:getLinks\(\) expects null, array<int, int> given.#'
- '#Parameter \#2 \$value of static method CacheCore\:\:store\(\) expects string, array<int\|string, mixed> given.#'
2 changes: 0 additions & 2 deletions tests/phpstan/phpstan-1.7.2.5.neon
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ includes:
parameters:
ignoreErrors:
- '#Access to an undefined property HelperList\:\:\$shopLinkType.#'
- '#Access to protected property HelperForm\:\:\$fields_form.#'
- '#Call to method assign\(\) on an unknown class Smarty_Data.#'
- '#Parameter \#1 \$id of class Supplier constructor expects null, int given.#'
- '#Parameter \#1 \$idCategory of class Category constructor expects null, int given.#'
- '#Parameter \#2 \$idLang of class Category constructor expects null, int given.#'
- '#Parameter \#2 \$idLang of class Supplier constructor expects null, int given.#'
- '#Parameter \#2 \$selection of static method CMSCore\:\:getLinks\(\) expects null, array<int, int> given.#'
- '#Parameter \#2 \$value of static method CacheCore\:\:store\(\) expects string, array<int\|string, mixed> given.#'
1 change: 0 additions & 1 deletion tests/phpstan/phpstan-1.7.3.4.neon
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ includes:
parameters:
ignoreErrors:
- '#Access to an undefined property HelperList\:\:\$shopLinkType.#'
- '#Access to protected property HelperForm\:\:\$fields_form.#'
- '#Call to method assign\(\) on an unknown class Smarty_Data.#'
- '#Parameter \#1 \$id of class Supplier constructor expects null, int given.#'
- '#Parameter \#1 \$idCategory of class Category constructor expects null, int given.#'
Expand Down
2 changes: 0 additions & 2 deletions tests/phpstan/phpstan-1.7.4.4.neon
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ includes:
parameters:
ignoreErrors:
- '#Access to an undefined property HelperList\:\:\$shopLinkType.#'
- '#Access to protected property HelperForm\:\:\$fields_form.#'
- '#Call to method assign\(\) on an unknown class Smarty_Data.#'
- '#Parameter \#1 \$id of class Supplier constructor expects null, int given.#'
- '#Parameter \#1 \$idCategory of class Category constructor expects null, int given.#'
- '#Parameter \#2 \$idLang of class Category constructor expects null, int given.#'
Expand Down
1 change: 0 additions & 1 deletion tests/phpstan/phpstan-1.7.5.1.neon
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ includes:
parameters:
ignoreErrors:
- '#Access to an undefined property HelperList\:\:\$shopLinkType.#'
- '#Access to protected property HelperForm\:\:\$fields_form.#'
- '#Parameter \#1 \$id of class Supplier constructor expects null, int given.#'
- '#Parameter \#1 \$idCategory of class Category constructor expects null, int given.#'
- '#Parameter \#2 \$idLang of class Category constructor expects null, int given.#'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ includes:
parameters:
ignoreErrors:
- '#Access to an undefined property HelperList\:\:\$shopLinkType.#'
- '#Access to protected property HelperForm\:\:\$fields_form.#'
- '#Parameter \#1 \$id of class Supplier constructor expects null, int given.#'
- '#Parameter \#1 \$idCategory of class Category constructor expects null, int given.#'
- '#Parameter \#2 \$idLang of class Category constructor expects null, int given.#'
- '#Parameter \#2 \$idLang of class Supplier constructor expects null, int given.#'
- '#Parameter \#2 \$selection of static method CMSCore\:\:getLinks\(\) expects null, array<int, int> given.#'
- '#Parameter \#2 \$value of static method CacheCore\:\:store\(\) expects string, array<int\|string, mixed> given.#'
- '#Parameter \#2 \$value of static method CacheCore\:\:store\(\) expects string, array<int\|string, mixed> given.#'
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ includes:
parameters:
ignoreErrors:
- '#Access to an undefined property HelperList\:\:\$shopLinkType.#'
- '#Access to protected property HelperForm\:\:\$fields_form.#'
- '#Parameter \#1 \$id of class Supplier constructor expects null, int given.#'
- '#Parameter \#2 \$idLang of class Supplier constructor expects null, int given.#'
- '#Parameter \#2 \$selection of static method CMSCore\:\:getLinks\(\) expects null, array<int, int> given.#'
10 changes: 10 additions & 0 deletions tests/phpstan/phpstan-1.7.8.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
includes:
- %currentWorkingDirectory%/tests/phpstan/phpstan.neon

parameters:
ignoreErrors:
- '#Access to an undefined property HelperList\:\:\$shopLinkType.#'
- '#Binary operation "\." between string and array<string> results in an error.#'
- '#Parameter \#1 \$id of class Supplier constructor expects null, int given.#'
- '#Parameter \#2 \$idLang of class Supplier constructor expects null, int given.#'
- '#Parameter \#2 \$selection of static method CMSCore\:\:getLinks\(\) expects null, array<int, int> given.#'
3 changes: 1 addition & 2 deletions tests/phpstan/phpstan-latest.neon
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ includes:
parameters:
ignoreErrors:
- '#Access to an undefined property HelperList\:\:\$shopLinkType.#'
- '#Access to protected property HelperForm\:\:\$fields_form.#'
- '#Binary operation "\." between string and array<string> results in an error.#'
- '#Parameter \#1 \$id of class Supplier constructor expects null, int given.#'
- '#Parameter \#2 \$idLang of class Supplier constructor expects null, int given.#'
- '#Parameter \#2 \$selection of static method CMSCore\:\:getLinks\(\) expects null, array<int, int> given.#'
- '~^Binary operation "\." between string and array<string> results in an error\.$~'
2 changes: 0 additions & 2 deletions tests/phpstan/phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,4 @@ parameters:
- ../../ps_menutoplinks.class.php
- ../../translations/
- ../../views/
reportUnmatchedIgnoredErrors: false
level: 5