Skip to content

Merge pull request #6 from ray-di/v1-no-jit #68

Merge pull request #6 from ray-di/v1-no-jit

Merge pull request #6 from ray-di/v1-no-jit #68

name: Static Analysis
on:
push:
paths-ignore:
- '**.md'
pull_request:
workflow_dispatch:
workflow_call:
inputs:
php_version:
required: true
type: string
has_crc_config:
required: false
default: false
type: boolean
description: True if the project has composer_require_checker.json
jobs:
static-analysis-phpstan:
name: PHPStan
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ inputs.php_version }}
tools: cs2pr
coverage: none
- name: Get composer cache directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies
run: composer install --no-interaction --no-progress --prefer-dist
- name: Run PHPStan
run: ./vendor/bin/phpstan analyse -c phpstan.neon --no-progress --no-interaction --error-format=checkstyle | cs2pr
static-analysis-psalm:
name: Psalm
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ inputs.php_version }}
tools: cs2pr
coverage: none
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Install dependencies
run: composer install --no-interaction --no-progress --prefer-dist
- name: Run Psalm
run: ./vendor/bin/psalm --show-info=false --output-format=checkstyle --shepherd | cs2pr
static-analysis-phpmd:
name: PHPMD
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ inputs.php_version }}
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache dependencies
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- name: Install dependencies
run: composer install --no-interaction --no-progress --prefer-dist
- name: Run PHP Mess Detector
run: ./vendor/bin/phpmd src text ./phpmd.xml
static-analysis-composer-require-checker:
name: ComposerRequireChecker
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ inputs.php_version }}
coverage: none
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Install dependencies
run: |
composer install --no-interaction --no-progress --prefer-dist
composer require maglnet/composer-require-checker --dev --with-all-dependencies
- name: Run composer-require-checker without config
if: ${{ !inputs.has_crc_config }}
run: ./vendor/bin/composer-require-checker check ./composer.json
- name: Run composer-require-checker with config
if: ${{ inputs.has_crc_config }}
run: ./vendor/bin/composer-require-checker check ./composer.json --config-file=./composer-require-checker.json