mirror of
https://github.com/ivuorinen/actions.git
synced 2026-01-26 11:34:00 +00:00
Replace language-version-detect dependency with inline version detection for the Laravel PHPUnit testing action. Detection logic checks (in priority order): - .tool-versions file (php key) - Dockerfile (FROM php: image) - devcontainer.json (php: image) - .php-version file - composer.json (require.php or config.platform.php fields) Implementation details: - POSIX sh compliant with `set -eu` - Validates version format: X.Y or X.Y.Z - Normalizes versions: strips 'v' prefix, whitespace, line endings - Uses `sed -E` for portable extended regex (Dockerfile/devcontainer) - Uses basic sed for composer.json (POSIX-compatible backslash escapes) - Conditional jq usage with diagnostic messages - Maintains output contract (detected-version) Changes: - php-laravel-phpunit: ~115 lines of inline detection + jq diagnostics - README regenerated with action-docs Benefits: - Eliminates external dependency for PHP version detection - Reduces action initialization time - Improved debugging (diagnostic messages, all logic in one file) - Consistent with go-build, csharp, and python-lint-fix pattern
ivuorinen/actions/php-laravel-phpunit
Laravel Setup and Composer test
Description
Setup PHP, install dependencies, generate key, create database and run composer test
Inputs
| name | description | required | default |
|---|---|---|---|
php-version |
PHP Version to use, see https://github.com/marketplace/actions/setup-php-action#php-version-optional |
false |
latest |
php-version-file |
PHP Version file to use, see https://github.com/marketplace/actions/setup-php-action#php-version-file-optional |
false |
.php-version |
extensions |
PHP extensions to install, see https://github.com/marketplace/actions/setup-php-action#extensions-optional |
false |
mbstring, intl, json, pdo_sqlite, sqlite3 |
coverage |
Specify code-coverage driver, see https://github.com/marketplace/actions/setup-php-action#coverage-optional |
false |
none |
token |
GitHub token for authentication |
false |
"" |
Outputs
| name | description |
|---|---|
php-version |
The PHP version that was setup |
php-version-file |
The PHP version file that was used |
extensions |
The PHP extensions that were installed |
coverage |
The code-coverage driver that was setup |
Runs
This action is a composite action.
Usage
- uses: ivuorinen/actions/php-laravel-phpunit@main
with:
php-version:
# PHP Version to use, see https://github.com/marketplace/actions/setup-php-action#php-version-optional
#
# Required: false
# Default: latest
php-version-file:
# PHP Version file to use, see https://github.com/marketplace/actions/setup-php-action#php-version-file-optional
#
# Required: false
# Default: .php-version
extensions:
# PHP extensions to install, see https://github.com/marketplace/actions/setup-php-action#extensions-optional
#
# Required: false
# Default: mbstring, intl, json, pdo_sqlite, sqlite3
coverage:
# Specify code-coverage driver, see https://github.com/marketplace/actions/setup-php-action#coverage-optional
#
# Required: false
# Default: none
token:
# GitHub token for authentication
#
# Required: false
# Default: ""