|
| 1 | +name: Static Analysis |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - 1.x |
| 7 | + paths: |
| 8 | + - 'src/**' |
| 9 | + - 'tests/**' |
| 10 | + - phpmd.xml |
| 11 | + - phpstan.neon |
| 12 | + - psalm.xml |
| 13 | + pull_request: |
| 14 | + branches: |
| 15 | + - 1.x |
| 16 | + paths: |
| 17 | + - 'src/**' |
| 18 | + - 'tests/**' |
| 19 | + - phpmd.xml |
| 20 | + - phpstan.neon |
| 21 | + - psalm.xml |
| 22 | + workflow_dispatch: |
| 23 | + |
| 24 | +jobs: |
| 25 | + static-analysis-phpstan: |
| 26 | + name: Static Analysis with PHPStan |
| 27 | + runs-on: ubuntu-latest |
| 28 | + steps: |
| 29 | + - name: Checkout |
| 30 | + uses: actions/checkout@v2 |
| 31 | + |
| 32 | + - name: Setup PHP |
| 33 | + uses: shivammathur/setup-php@v2 |
| 34 | + with: |
| 35 | + php-version: 8.0 |
| 36 | + tools: cs2pr |
| 37 | + coverage: none |
| 38 | + |
| 39 | + - name: Get composer cache directory |
| 40 | + id: composer-cache |
| 41 | + run: echo "::set-output name=dir::$(composer config cache-files-dir)" |
| 42 | + |
| 43 | + - name: Cache dependencies |
| 44 | + uses: actions/cache@v2 |
| 45 | + with: |
| 46 | + path: ${{ steps.composer-cache.outputs.dir }} |
| 47 | + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} |
| 48 | + restore-keys: ${{ runner.os }}-composer- |
| 49 | + |
| 50 | + - name: Install dependencies |
| 51 | + run: composer install --no-interaction --no-progress --prefer-dist |
| 52 | + |
| 53 | + - name: Run PHPStan |
| 54 | + run: ./vendor/bin/phpstan analyse -c phpstan.neon --no-progress --no-interaction --error-format=checkstyle | cs2pr |
| 55 | + |
| 56 | + static-analysis-psalm: |
| 57 | + name: Static Analysis with Psalm |
| 58 | + runs-on: ubuntu-latest |
| 59 | + steps: |
| 60 | + - name: Checkout |
| 61 | + uses: actions/checkout@v2 |
| 62 | + |
| 63 | + - name: Setup PHP |
| 64 | + uses: shivammathur/setup-php@v2 |
| 65 | + with: |
| 66 | + php-version: 8.0 |
| 67 | + tools: cs2pr |
| 68 | + coverage: none |
| 69 | + |
| 70 | + - name: Get composer cache directory |
| 71 | + id: composer-cache |
| 72 | + run: echo "::set-output name=dir::$(composer config cache-files-dir)" |
| 73 | + |
| 74 | + - name: Install dependencies |
| 75 | + run: composer install --no-interaction --no-progress --prefer-dist |
| 76 | + |
| 77 | + - name: Run Psalm |
| 78 | + run: ./vendor/bin/psalm --show-info=false --output-format=checkstyle --shepherd | cs2pr |
| 79 | + |
| 80 | + static-analysis-phpmd: |
| 81 | + name: Static Analysis with PHPMD |
| 82 | + runs-on: ubuntu-latest |
| 83 | + steps: |
| 84 | + - name: Checkout |
| 85 | + uses: actions/checkout@v2 |
| 86 | + |
| 87 | + - name: Setup PHP |
| 88 | + uses: shivammathur/setup-php@v2 |
| 89 | + with: |
| 90 | + php-version: 7.4 |
| 91 | + |
| 92 | + - name: Get composer cache directory |
| 93 | + id: composer-cache |
| 94 | + run: echo "::set-output name=dir::$(composer config cache-files-dir)" |
| 95 | + |
| 96 | + - name: Cache dependencies |
| 97 | + uses: actions/cache@v2 |
| 98 | + with: |
| 99 | + path: ${{ steps.composer-cache.outputs.dir }} |
| 100 | + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} |
| 101 | + restore-keys: ${{ runner.os }}-composer- |
| 102 | + |
| 103 | + - name: Install dependencies |
| 104 | + run: composer install --no-interaction --no-progress --prefer-dist |
| 105 | + |
| 106 | + - name: Run PHP Mess Detector |
| 107 | + run: ./vendor/bin/phpmd src text --exclude src/Annotation ./phpmd.xml |
| 108 | + |
| 109 | + static-analysis-php-metrics: |
| 110 | + name: Static Analysis with PhpMetrics |
| 111 | + runs-on: ubuntu-latest |
| 112 | + steps: |
| 113 | + - name: Checkout |
| 114 | + uses: actions/checkout@v2 |
| 115 | + |
| 116 | + - name: Setup PHP |
| 117 | + uses: shivammathur/setup-php@v2 |
| 118 | + with: |
| 119 | + php-version: 8.0 |
| 120 | + coverage: none |
| 121 | + |
| 122 | + - name: Get composer cache directory |
| 123 | + id: composer-cache |
| 124 | + run: echo "::set-output name=dir::$(composer config cache-files-dir)" |
| 125 | + |
| 126 | + - name: Install dependencies |
| 127 | + run: composer install --no-interaction --no-progress --prefer-dist |
| 128 | + |
| 129 | + - name: Run PhpMetrics |
| 130 | + run: ./vendor/bin/phpmetrics --exclude=Exception src |
| 131 | + |
| 132 | + static-analysis-composer-require-checker: |
| 133 | + name: Static Analysis with ComposerRequireChecker |
| 134 | + runs-on: ubuntu-latest |
| 135 | + steps: |
| 136 | + - name: Checkout |
| 137 | + uses: actions/checkout@v2 |
| 138 | + |
| 139 | + - name: Setup PHP |
| 140 | + uses: shivammathur/setup-php@v2 |
| 141 | + with: |
| 142 | + php-version: 8.0 |
| 143 | + coverage: none |
| 144 | + |
| 145 | + - name: Get composer cache directory |
| 146 | + id: composer-cache |
| 147 | + run: echo "::set-output name=dir::$(composer config cache-files-dir)" |
| 148 | + |
| 149 | + - name: Install dependencies |
| 150 | + run: | |
| 151 | + composer install --no-interaction --no-progress --prefer-dist |
| 152 | + composer require --dev maglnet/composer-require-checker ^3.0 |
| 153 | +
|
| 154 | + - name: Run composer-require-checker |
| 155 | + run: ./vendor/bin/composer-require-checker |
0 commit comments