|
| 1 | +--- |
| 2 | +name: PHP tests |
| 3 | +on: [push, pull_request] |
| 4 | +jobs: |
| 5 | + # Check there is no syntax errors in the project |
| 6 | + php-linter: |
| 7 | + name: PHP Syntax check 5.6 => 8.1 |
| 8 | + runs-on: ubuntu-latest |
| 9 | + steps: |
| 10 | + - name: Checkout |
| 11 | + uses: actions/checkout@v2.0.0 |
| 12 | + |
| 13 | + - name: PHP syntax checker 5.6 |
| 14 | + uses: prestashop/github-action-php-lint/5.6@master |
| 15 | + |
| 16 | + - name: PHP syntax checker 7.2 |
| 17 | + uses: prestashop/github-action-php-lint/7.2@master |
| 18 | + |
| 19 | + - name: PHP syntax checker 7.3 |
| 20 | + uses: prestashop/github-action-php-lint/7.3@master |
| 21 | + |
| 22 | + - name: PHP syntax checker 7.4 |
| 23 | + uses: prestashop/github-action-php-lint/7.4@master |
| 24 | + |
| 25 | + - name: PHP syntax checker 8.0 |
| 26 | + uses: prestashop/github-action-php-lint/8.0@master |
| 27 | + |
| 28 | + - name: PHP syntax checker 8.1 |
| 29 | + uses: prestashop/github-action-php-lint/8.1@master |
| 30 | + |
| 31 | + # Check the PHP code follow the coding standards |
| 32 | + php-cs-fixer: |
| 33 | + name: PHP-CS-Fixer |
| 34 | + runs-on: ubuntu-latest |
| 35 | + steps: |
| 36 | + - name: Setup PHP |
| 37 | + uses: shivammathur/setup-php@v2 |
| 38 | + with: |
| 39 | + php-version: '7.4' |
| 40 | + |
| 41 | + - name: Checkout |
| 42 | + uses: actions/checkout@v2.0.0 |
| 43 | + |
| 44 | + - name: Cache dependencies |
| 45 | + uses: actions/cache@v2 |
| 46 | + with: |
| 47 | + path: vendor |
| 48 | + key: php-${{ hashFiles('composer.lock') }} |
| 49 | + |
| 50 | + - name: Install dependencies |
| 51 | + run: composer install |
| 52 | + |
| 53 | + - name: Run PHP-CS-Fixer |
| 54 | + run: ./vendor/bin/php-cs-fixer fix --dry-run --diff --using-cache=no --diff-format udiff |
| 55 | + |
| 56 | + # Run PHPStan against the module and a PrestaShop release |
| 57 | + phpstan: |
| 58 | + name: PHPStan |
| 59 | + runs-on: ubuntu-latest |
| 60 | + strategy: |
| 61 | + matrix: |
| 62 | + 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'] |
| 63 | + steps: |
| 64 | + - name: Setup PHP |
| 65 | + uses: shivammathur/setup-php@v2 |
| 66 | + with: |
| 67 | + php-version: '7.4' |
| 68 | + |
| 69 | + - name: Checkout |
| 70 | + uses: actions/checkout@v2.0.0 |
| 71 | + |
| 72 | + # Add vendor folder in cache to make next builds faster |
| 73 | + - name: Cache vendor folder |
| 74 | + uses: actions/cache@v1 |
| 75 | + with: |
| 76 | + path: vendor |
| 77 | + key: php-${{ hashFiles('composer.lock') }} |
| 78 | + |
| 79 | + # Add composer local folder in cache to make next builds faster |
| 80 | + - name: Cache composer folder |
| 81 | + uses: actions/cache@v1 |
| 82 | + with: |
| 83 | + path: ~/.composer/cache |
| 84 | + key: php-composer-cache |
| 85 | + |
| 86 | + - run: composer install |
| 87 | + |
| 88 | + # Docker images prestashop/prestashop may be used, even if the shop remains uninstalled |
| 89 | + - name: Execute PHPStan on PrestaShop (Tag ${{ matrix.presta-versions }}) |
| 90 | + run: ./tests/phpstan.sh ${{ matrix.presta-versions }} |
0 commit comments