diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 6b7aa35..4b5bcc3 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -1,13 +1,13 @@ 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 => 8.1 + name: PHP Syntax check 5.6|7.2|7.3|7.4|8.0|8.1 runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2.0.0 + uses: actions/checkout@v5 - name: PHP syntax checker 5.6 uses: prestashop/github-action-php-lint/5.6@master @@ -27,63 +27,32 @@ jobs: - 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 + - uses: PrestaShop/.github/.github/actions/php-ci/php-cs@master 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.6', '1.7.7', '1.7.8', 'latest'] + presta-version: ['1.7.6.0', '1.7.7.x', '1.7.8.x'] 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 + - name: Checkout repository + uses: actions/checkout@v3 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 + path: ${{ github.event.repository.name }} + + - uses: Quetzacoalt91/.github/.github/actions/php-ci/phpstan@cache 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 }} + php-version: '7.4' + presta-version: ${{ matrix.presta-version }} + module-name: ${{ github.event.repository.name }} + phpstan-level: '5' + phpstan-config: 'tests/phpstan/phpstan-${{ matrix.presta-version }}.neon' + phpstan-version: '^0.12' + composer-version: '1' diff --git a/tests/phpstan/phpstan-1.7.6.neon b/tests/phpstan/phpstan-1.7.6.0.neon similarity index 100% rename from tests/phpstan/phpstan-1.7.6.neon rename to tests/phpstan/phpstan-1.7.6.0.neon diff --git a/tests/phpstan/phpstan-1.7.7.neon b/tests/phpstan/phpstan-1.7.7.x.neon similarity index 100% rename from tests/phpstan/phpstan-1.7.7.neon rename to tests/phpstan/phpstan-1.7.7.x.neon diff --git a/tests/phpstan/phpstan-1.7.8.neon b/tests/phpstan/phpstan-1.7.8.x.neon similarity index 100% rename from tests/phpstan/phpstan-1.7.8.neon rename to tests/phpstan/phpstan-1.7.8.x.neon diff --git a/tests/phpstan/phpstan-latest.neon b/tests/phpstan/phpstan-latest.neon deleted file mode 100644 index c604f7c..0000000 --- a/tests/phpstan/phpstan-latest.neon +++ /dev/null @@ -1,2 +0,0 @@ -includes: - - %currentWorkingDirectory%/tests/phpstan/phpstan.neon diff --git a/tests/phpstan/phpstan.neon b/tests/phpstan/phpstan.neon index f1758a1..3cc9736 100644 --- a/tests/phpstan/phpstan.neon +++ b/tests/phpstan/phpstan.neon @@ -1,12 +1,3 @@ -includes: - - %currentWorkingDirectory%/vendor/prestashop/php-dev-tools/phpstan/ps-module-extension.neon - parameters: - paths: - # From PHPStan 0.12, paths to check are relative to the neon file - - ../../ps_wirepayment.php - - ../../controllers/ - - ../../translations/ - - ../../upgrade/ - - ../../views/ - level: 5 + # Base PHPStan configuration for the module + # This file is included by version-specific configs