diff --git a/.github/workflows/php-test.yml b/.github/workflows/php-test.yml new file mode 100644 index 0000000..61e5c88 --- /dev/null +++ b/.github/workflows/php-test.yml @@ -0,0 +1,50 @@ +name: PHP Tests + +on: + workflow_call: + inputs: + enable_phpstan: + description: 'Whether to enable PHPStan tests' + default: true + required: false + type: boolean + enable_phpunit: + description: 'Whether to enable PHPUnit tests' + default: true + required: false + type: boolean + php_versions: + description: 'The PHP versions to create builds for (as JSON string array)' + default: '["latest"]' + required: false + type: string + +jobs: + php-test: + runs-on: ubuntu-latest + strategy: + matrix: + php: ${{ fromJSON(inputs.php_versions) }} + + name: Run PHP Tests + steps: + - name: PHPStan (PHP ${{ matrix.php }}) + if: ${{ inputs.enable_phpstan }} + id: phpstan + uses: php-actions/phpstan@v3 + with: + configuration: phpstan.neon + memory_limit: 512M + php_version: ${{ matrix.php }} + version: composer + + - name: PHPUnit (PHP ${{ matrix.php }}) + if: ${{ inputs.enable_phpunit }} + id: phpunit + uses: php-actions/phpstan@v3 + with: + version: composer + php_version: ${{ matrix.php }} + configuration: phpunit.xml.dist + env: + APP_ENV: test \ No newline at end of file