2022-11-10 12:29:53 +03:00
|
|
|
name: "Static analysis code"
|
|
|
|
|
2022-11-10 13:54:44 +03:00
|
|
|
on: [push, pull_request]
|
2022-11-10 12:29:53 +03:00
|
|
|
|
|
|
|
env:
|
|
|
|
COMPOSER_FLAGS: "--ansi --prefer-dist --no-interaction --no-progress"
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
|
|
|
|
## PHP linter
|
|
|
|
linter:
|
|
|
|
name: "Check syntax errors"
|
|
|
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
php-version:
|
|
|
|
- "7.2"
|
|
|
|
- "7.3"
|
|
|
|
- "7.4"
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: "Checkout"
|
2022-11-10 13:03:09 +03:00
|
|
|
uses: "actions/checkout@v3"
|
2022-11-10 12:29:53 +03:00
|
|
|
|
|
|
|
- name: "Install PHP"
|
|
|
|
uses: "shivammathur/setup-php@v2"
|
|
|
|
with:
|
|
|
|
coverage: "none"
|
|
|
|
php-version: ${{ matrix.php-version }}
|
|
|
|
|
|
|
|
- name: "Lint PHP files"
|
|
|
|
run: find ./src -type f -name '*.php' -print0 | xargs -0 -L1 -P4 -- php -l -f
|
|
|
|
|
|
|
|
## PHPSTAN
|
|
|
|
phpstan:
|
|
|
|
name: "PHP Static Analysis"
|
|
|
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
php-version:
|
|
|
|
- "7.2"
|
|
|
|
- "7.3"
|
|
|
|
- "7.4"
|
|
|
|
steps:
|
|
|
|
- name: "Cancel Previous Runs"
|
2022-11-10 13:30:01 +03:00
|
|
|
uses: styfle/cancel-workflow-action@0.11.0
|
2022-11-10 12:29:53 +03:00
|
|
|
with:
|
|
|
|
all_but_latest: true
|
|
|
|
access_token: ${{ github.token }}
|
|
|
|
|
|
|
|
- name: "Checkout"
|
2022-11-10 13:03:09 +03:00
|
|
|
uses: "actions/checkout@v3"
|
2022-11-10 12:29:53 +03:00
|
|
|
|
|
|
|
- name: "Install PHP"
|
|
|
|
uses: "shivammathur/setup-php@v2"
|
|
|
|
with:
|
|
|
|
coverage: "none"
|
|
|
|
php-version: ${{ matrix.php-version }}
|
|
|
|
|
|
|
|
- name: "Setup github auth token for composer"
|
|
|
|
run: composer config github-oauth.github.com ${{ github.token }}
|
|
|
|
|
|
|
|
- name: "Get composer cache directory"
|
|
|
|
id: composer-cache
|
2022-11-10 13:44:39 +03:00
|
|
|
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
|
2022-11-10 12:29:53 +03:00
|
|
|
|
|
|
|
- name: "Cache Composer Directory"
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: ${{ steps.composer-cache.outputs.dir }}
|
|
|
|
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
|
|
|
|
restore-keys: ${{ runner.os }}-composer-
|
|
|
|
|
|
|
|
- name: "Composer Install"
|
|
|
|
run: |
|
|
|
|
composer install ${{ env.COMPOSER_FLAGS }}
|
|
|
|
rm composer.lock
|
2022-11-10 12:52:38 +03:00
|
|
|
composer config platform.php ${{ matrix.php-version }}
|
2022-11-10 12:29:53 +03:00
|
|
|
|
|
|
|
- name: Run phpstan
|
|
|
|
run: composer phpstan
|