diff --git a/action.yml b/action.yml index 11c57db..be236ed 100644 --- a/action.yml +++ b/action.yml @@ -1,4 +1,4 @@ -name: PHPUnit (php-actions) +name: PHPUnit blackwolf12333 description: Run your PHPUnit tests in your Github Actions. inputs: @@ -16,6 +16,10 @@ inputs: description: Space separated list of extensions to configure with the PHP build required: false + vendored_phpunit_path: + description: Path to a vendored phpunit binary + required: false + configuration: description: Configuration file location required: false @@ -85,6 +89,7 @@ runs: ACTION_VERSION: ${{ inputs.version }} ACTION_PHP_VERSION: ${{ inputs.php_version }} ACTION_PHP_EXTENSIONS: ${{ inputs.php_extensions }} + ACTION_PHPUNIT_PATH: ${{ inputs.vendored_phpunit_path }} ACTION_CONFIGURATION: ${{ inputs.configuration }} ACTION_LOG_JUNIT: ${{ inputs.log_junit }} ACTION_TESTDOX_HTML: ${{ inputs.testdox_html }} diff --git a/phpunit-action.bash b/phpunit-action.bash index cdc9fb8..9849d6f 100755 --- a/phpunit-action.bash +++ b/phpunit-action.bash @@ -4,14 +4,23 @@ github_action_path=$(dirname "$0") docker_tag=$(cat ./docker_tag) echo "Docker tag: $docker_tag" >> output.log 2>&1 -phar_url="https://phar.phpunit.de/phpunit" -if [ "$ACTION_VERSION" != "latest" ] +if [ -n "$ACTION_PHPUNIT_PATH" ] then - phar_url="${phar_url}-${ACTION_VERSION}" + echo "Using phar" >> output.log 2>&1 + phar_url="https://phar.phpunit.de/phpunit" + if [ "$ACTION_VERSION" != "latest" ] + then + phar_url="${phar_url}-${ACTION_VERSION}" + fi + phar_url="${phar_url}.phar" + curl --silent -H "User-agent: cURL (https://github.com/php-actions)" -L "$phar_url" > "${github_action_path}/phpunit.phar" + chmod +x "${github_action_path}/phpunit.phar" + + phar_path="${github_action_path}/phpunit.phar" +else + phar_path="${GITHUB_WORKSPACE}/$ACTION_PHPUNIT_PATH" + echo "Using vendored phpunit: $phar_path" >> output.log 2>&1 fi -phar_url="${phar_url}.phar" -curl --silent -H "User-agent: cURL (https://github.com/php-actions)" -L "$phar_url" > "${github_action_path}/phpunit.phar" -chmod +x "${github_action_path}/phpunit.phar" command_string=("phpunit") @@ -85,9 +94,10 @@ then command_string+=($ACTION_ARGS) fi + echo "Command: " "${command_string[@]}" >> output.log 2>&1 docker run --rm \ - --volume "${github_action_path}/phpunit.phar":/usr/local/bin/phpunit \ + --volume "${phar_path}":/usr/local/bin/phpunit \ --volume "${GITHUB_WORKSPACE}":/app \ --workdir /app \ --network host \