PHPStan #33
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: PHPStan | |
on: [workflow_dispatch, pull_request] | |
env: | |
PLUGIN_CODE: CustomerGroupRank42 | |
CUSTOMER_GROUP_CODE: CustomerGroup42 | |
WORKING_DIRECTORY: 'ec-cube' | |
APP_ENV: 'test' | |
APP_DEBUG: 0 | |
jobs: | |
phpstan: | |
name: PHPStan | |
runs-on: ubuntu-22.04 | |
strategy: | |
fail-fast: false | |
matrix: | |
eccube-versions: ['4.2', '4.3'] | |
php-versions: [ '8.1' ] | |
database: [ 'mysql' ] | |
include: | |
- database: mysql | |
database_url: mysql://root:password@127.0.0.1:3306/eccube_db | |
database_server_version: 5.7 | |
database_charset: utf8mb4 | |
services: | |
mysql: | |
image: mysql:5.7 | |
env: | |
MYSQL_ROOT_PASSWORD: password | |
ports: | |
- 3306:3306 | |
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Archive Plugin | |
run: | | |
tar cvzf ${GITHUB_WORKSPACE}/${{ env.PLUGIN_CODE }}.tar.gz ./* | |
- name: Checkout CustomerGroup Plugin | |
uses: actions/checkout@v4 | |
with: | |
repository: kurozumi/CustomerGroup | |
ref: '4.2' | |
path: 'plugin' | |
token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
- name: Archive Plugin | |
working-directory: 'plugin' | |
run: | | |
tar cvzf ${GITHUB_WORKSPACE}/${{ env.CUSTOMER_GROUP_CODE }}.tar.gz ./* | |
- name: Setup PHP, with composer and extensions | |
uses: shivammathur/setup-php@master #https://github.com/shivammathur/setup-php | |
with: | |
php-version: ${{ matrix.php-versions }} | |
extensions: mbstring, xml, ctype, iconv, mysql, intl, :xdebug | |
tools: composer:v2 | |
- name: Checkout EC-CUBE | |
uses: actions/checkout@v4 | |
with: | |
repository: EC-CUBE/ec-cube | |
ref: ${{ matrix.eccube-versions }} | |
path: ${{ env.WORKING_DIRECTORY }} | |
- name: Initialize Composer | |
uses: ./.github/actions/composer | |
- name: Setup EC-CUBE | |
working-directory: ${{ env.WORKING_DIRECTORY }} | |
run: | | |
bin/console doctrine:database:create | |
bin/console doctrine:schema:create | |
bin/console eccube:fixtures:load | |
env: | |
APP_ENV: ${{ env.APP_ENV }} | |
APP_DEBUG: ${{ env.APP_DEBUG }} | |
DATABASE_URL: ${{ matrix.database_url }} | |
DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }} | |
DATABASE_CHARSET: ${{ matrix.database_charset }} | |
- name: Setup Plugin | |
working-directory: ${{ env.WORKING_DIRECTORY }} | |
run: | | |
bin/console eccube:plugin:install --code=${{ env.CUSTOMER_GROUP_CODE }} --path=${GITHUB_WORKSPACE}/${{ env.CUSTOMER_GROUP_CODE }}.tar.gz | |
bin/console cache:clear --no-warmup | |
bin/console eccube:plugin:enable --code=${{ env.CUSTOMER_GROUP_CODE }} | |
bin/console cache:clear --no-warmup | |
bin/console eccube:plugin:install --code=${{ env.PLUGIN_CODE }} --path=${GITHUB_WORKSPACE}/${{ env.PLUGIN_CODE }}.tar.gz | |
bin/console cache:clear --no-warmup | |
bin/console eccube:plugin:enable --code=${{ env.PLUGIN_CODE }} | |
env: | |
APP_ENV: ${{ env.APP_ENV }} | |
APP_DEBUG: ${{ env.APP_DEBUG }} | |
DATABASE_URL: ${{ matrix.database_url }} | |
DATABASE_SERVER_VERSION: ${{ matrix.database_server_version }} | |
DATABASE_CHARSET: ${{ matrix.database_charset }} | |
- name: PHPStan | |
working-directory: ${{ env.WORKING_DIRECTORY }} | |
run: | | |
composer require phpstan/phpstan --dev | |
./vendor/bin/phpstan analyze app/Plugin/${{ env.PLUGIN_CODE }} -c "app/Plugin/${{ env.PLUGIN_CODE }}/phpstan.neon" --error-format=github |