Merge pull request #292 from PrestaShop/dependabot/composer/develop/s… #919
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: PHP | |
on: | |
push: | |
pull_request: | |
permissions: | |
contents: read | |
jobs: | |
php-cs-fixer: | |
permissions: | |
contents: read # for actions/checkout to fetch code | |
name: PHP CS Fixer | |
runs-on: ubuntu-latest | |
env: | |
APP_ENV: ci | |
steps: | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.3 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- uses: actions/checkout@v3 | |
- name: Config | |
run: cp .env.dist .env | |
- name: Validate composer config | |
run: composer validate --strict | |
- name: Composer Install | |
run: composer install --ansi --prefer-dist --no-interaction --no-progress | |
- name: Run PHPCSFixer | |
run: ./vendor/bin/php-cs-fixer fix --dry-run --diff | |
- name: Run ergebnis/composer-normalize | |
run: composer normalize --dry-run --no-check-lock | |
phpstan: | |
permissions: | |
contents: read # for actions/checkout to fetch code | |
name: PHP Static Analysis | |
runs-on: ubuntu-latest | |
env: | |
APP_ENV: ci | |
steps: | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.3 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- uses: actions/checkout@v3 | |
- name: Config | |
run: cp .env.dist .env | |
- name: Composer Install | |
run: composer install --ansi --prefer-dist --no-interaction --no-progress | |
- name: Run phpstan | |
run: ./vendor/bin/phpstan analyse | |
phpunit: | |
permissions: | |
contents: read # for actions/checkout to fetch code | |
name: PHPUnit | |
runs-on: ubuntu-latest | |
env: | |
APP_ENV: test | |
steps: | |
- name: Setup PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: 8.3 | |
coverage: 'xdebug' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Setup MySQL | |
uses: mirromutth/[email protected] | |
with: | |
mysql version: '8.0' | |
mysql database: 'qanightlyresults' | |
mysql root password: 'root' | |
- uses: actions/checkout@v3 | |
- name: Config | |
run: cp .env.dist .env | |
- name: Composer Install | |
run: composer install --ansi --prefer-dist --no-interaction --no-progress | |
- name: Change MySQL authentication method | |
run: sleep 15 && mysql -h127.0.0.1 -uroot -proot -e "ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY 'root'; FLUSH PRIVILEGES;" | |
- name: Setup database | |
run: php bin/console doctrine:schema:update --dump-sql --force --env=test | |
- name: Run phpunit | |
run: XDEBUG_MODE=coverage ./vendor/bin/phpunit --coverage-clover build/clover.xml | |
- name: Upload coverage results to Coveralls | |
env: | |
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
wget https://github.com/php-coveralls/php-coveralls/releases/download/v2.4.3/php-coveralls.phar | |
chmod +x php-coveralls.phar | |
php php-coveralls.phar --coverage_clover=build/clover.xml --json_path=build/coveralls-upload.json -vvv |