Skip to content

Commit

Permalink
Create reusable PHP test workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
admdly committed Nov 26, 2023
1 parent 0db3f69 commit c04e4c2
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/php-test.yml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit c04e4c2

Please sign in to comment.