|
| 1 | +name: "Code coverage" |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + php-version: |
| 7 | + description: "The PHP version to use when running the job" |
| 8 | + default: "8.0" |
| 9 | + required: false |
| 10 | + type: "string" |
| 11 | + php-extensions: |
| 12 | + description: "The php extensions to install, allowing composer to pass" |
| 13 | + default: "none, ctype, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter, fileinfo" |
| 14 | + required: false |
| 15 | + type: "string" |
| 16 | + composer-root-version: |
| 17 | + description: "The version of the package being tested, in case of circular dependencies." |
| 18 | + required: false |
| 19 | + type: "string" |
| 20 | + composer-options: |
| 21 | + description: "Additional flags for the composer install command." |
| 22 | + default: "--prefer-dist" |
| 23 | + required: false |
| 24 | + type: "string" |
| 25 | + composer-dependencies: |
| 26 | + description: "Composer dependency level to install" |
| 27 | + default: "locked" |
| 28 | + required: false |
| 29 | + type: "string" |
| 30 | + |
| 31 | +jobs: |
| 32 | + static-code-analysis: |
| 33 | + name: "Static Code Analysis" |
| 34 | + |
| 35 | + runs-on: "ubuntu-latest" |
| 36 | + |
| 37 | + strategy: |
| 38 | + matrix: |
| 39 | + php-version: |
| 40 | + - "${{ inputs.php-version }}" |
| 41 | + |
| 42 | + steps: |
| 43 | + - name: "Checkout" |
| 44 | + uses: "actions/checkout@v3" |
| 45 | + |
| 46 | + - name: "Install PHP" |
| 47 | + uses: "shivammathur/setup-php@v2" |
| 48 | + with: |
| 49 | + coverage: "none" |
| 50 | + php-version: "${{ matrix.php-version }}" |
| 51 | + extensions: "${{ inputs.php-extensions }}" |
| 52 | + |
| 53 | + - name: "Set COMPOSER_ROOT_VERSION" |
| 54 | + run: | |
| 55 | + echo "COMPOSER_ROOT_VERSION=${{ inputs.composer-root-version }}" >> $GITHUB_ENV |
| 56 | + if: "${{ inputs.composer-root-version }}" |
| 57 | + |
| 58 | + - name: "Install dependencies with Composer" |
| 59 | + uses: "ramsey/composer-install@v1" |
| 60 | + with: |
| 61 | + dependency-versions: "${{ inputs.composer-dependencies }}" |
| 62 | + composer-options: "${{ inputs.composer-options }}" |
| 63 | + |
| 64 | + - name: "Create cache directory for phpstan/phpstan" |
| 65 | + run: "mkdir -p .build/phpstan" |
| 66 | + |
| 67 | + - name: "Run phpstan/phpstan" |
| 68 | + run: "vendor/bin/phpstan --configuration=phpstan.neon --memory-limit=-1" |
| 69 | + |
| 70 | + - name: "Create cache directory for vimeo/psalm" |
| 71 | + run: "mkdir -p .build/psalm" |
| 72 | + |
| 73 | + - name: "Run vimeo/psalm" |
| 74 | + run: "vendor/bin/psalm --config=psalm.xml --output-format=github --shepherd --show-info=false --stats --threads=4" |
0 commit comments