Skip to content

Commit

Permalink
Added new phpstan workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
L3RAZ committed Feb 3, 2025
1 parent 3a6c1b6 commit 8930556
Show file tree
Hide file tree
Showing 4 changed files with 112 additions and 11 deletions.
56 changes: 52 additions & 4 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ jobs:
- name: Run PHP-CS-Fixer
run: php vendor/bin/php-cs-fixer fix --dry-run --diff --using-cache=no

phpstan:
phpstan2:
name: PHPStan
runs-on: ubuntu-latest
strategy:
Expand All @@ -86,6 +86,50 @@ jobs:
- name: Checkout
uses: actions/checkout@v2.0.0

- name: Setup PHP 8.1
uses: shivammathur/setup-php@v2
with:
php-version: "8.1"
tools: composer:v2

- run: composer install

- name: Run PrestaShop Docker container
run: docker run -tid --rm --name prestashop-container prestashop/prestashop:${{ matrix.presta-versions }}

- name: Wait for PrestaShop to be ready
run: |
while ! docker exec prestashop-container curl -sSf http://localhost > /dev/null; do
echo "Waiting for PrestaShop to be ready..."
sleep 10
done
- name: Remove ps_checkout module from PrestaShop container
run: docker exec prestashop-container rm -rf /var/www/html/modules/ps_checkout

- name: Copy module to PrestaShop container
run: docker cp $PWD prestashop-container:/var/www/html/modules/ps_checkout/

- name: Run PHPStan
run: docker exec prestashop-container bash -c "cd /var/www/html/modules/ps_checkout && _PS_ROOT_DIR_=/var/www/html php vendor/bin/phpstan analyse -c ./tests/phpstan/phpstan-PS-9.neon --error-format=github"

phpstan:
name: PHPStan
runs-on: ubuntu-latest
strategy:
matrix:
presta-versions: [ "9.0.x-apache" ]
if: contains(github.event.pull_request.labels.*.name, 'ready to review')
steps:
- name: Checkout
uses: actions/checkout@v2.0.0

- name: Setup PHP 8.1
uses: shivammathur/setup-php@v2
with:
php-version: "8.1"
tools: composer:v2

- name: Cache vendor folder
uses: actions/cache@v1
with:
Expand All @@ -103,11 +147,15 @@ jobs:
- name: Pull PrestaShop files (Tag ${{ matrix.presta-versions }})
run: docker run -tid --rm -v ps-volume:/var/www/html --name temp-ps prestashop/prestashop:${{ matrix.presta-versions }}

- name: Wait for PrestaShop to be ready
run: |
while ! docker exec temp-ps curl -sSf http://localhost > /dev/null; do
echo "Waiting for PrestaShop to be ready..."
sleep 10
done
- name: Run PHPStan
run: docker run --rm --volumes-from temp-ps -v $PWD:/var/www/html/modules/ps_checkout -e _PS_ROOT_DIR_=/var/www/html/ --workdir=/var/www/html/modules/ps_checkout ghcr.io/phpstan/phpstan:latest-php8.1 analyse --configuration=/var/www/html/modules/ps_checkout/tests/phpstan/phpstan-PS-9.neon --error-format=github

- name: test
run: docker exec temp-ps ls -la /var/www/html/modules/ps_checkout
phpunit:
name: PHPUnit
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"friendsofphp/php-cs-fixer": "^3.68",
"monolog/monolog": "^1.27.1",
"nikic/php-parser": "^4.19.1",
"phpstan/phpstan": "^2.1",
"phpunit/php-code-coverage": "^9.2.31",
"phpunit/phpunit": "~9.6.7",
"prestashop/autoindex": "^2.1",
Expand Down
60 changes: 59 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions tests/phpstan/bootstrap.php

This file was deleted.

0 comments on commit 8930556

Please sign in to comment.