Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: PHPUnit (php-actions)
name: PHPUnit blackwolf12333
description: Run your PHPUnit tests in your Github Actions.

inputs:
Expand All @@ -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
Expand Down Expand Up @@ -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 }}
Expand Down
24 changes: 17 additions & 7 deletions phpunit-action.bash
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down Expand Up @@ -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 \
Expand Down