Reusable GitHub workflow for PHP Laravel projects.
Use ronasit/github-actions/.github/workflows/tests.yml@main from your project workflow.
name: CI
on:
push:
branches: ["master"]
pull_request:
branches: ["master"]
jobs:
tests:
uses: ronasit/github-actions/.github/workflows/tests.yml@mainjobs:
tests:
uses: ronasit/github-actions/.github/workflows/tests.yml@main
with:
use-database: trueIn database mode the reusable workflow enables PostgreSQL service and DB variables internally.
You can add one more composer package axis to the matrix, for example phpunit/phpunit.
The workflow reads the package constraint from your composer.json require section,
detects the latest stable major series from Packagist, and runs the matrix across that range.
jobs:
tests:
uses: ronasit/github-actions/.github/workflows/tests.yml@main
with:
additional-package: phpunit/phpunitFor phpunit/phpunit: >=11.0, the generated matrix will include package versions like 11.*, 12.*, 13.*, etc.
You can add extra exclusions on top of the built-in latest versions exclusion by passing custom-exclude as a JSON array.
jobs:
tests:
uses: ronasit/github-actions/.github/workflows/tests.yml@main
with:
additional-package: phpunit/phpunit
custom-exclude: '[{"php-version":"8.3","additional-package-version":"13.*"},{"laravel-version":"11.*","additional-package-version":"13.*"}]'custom-exclude is merged with auto-exclude and duplicate exclude objects are removed.
You can override test commands with:
phpunit-commandphpunit-coverage-command
jobs:
tests:
uses: ronasit/github-actions/.github/workflows/tests.yml@main
with:
phpunit-command: vendor/bin/phpunit
phpunit-coverage-command: vendor/bin/phpunit --coverage-clover build/logs/clover.xml