Skip to content

Commit 16b9619

Browse files
Use vendored phpunit when provided
1 parent 7840cf8 commit 16b9619

File tree

2 files changed

+18
-8
lines changed

2 files changed

+18
-8
lines changed

action.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: PHPUnit (php-actions)
1+
name: PHPUnit blackwolf12333
22
description: Run your PHPUnit tests in your Github Actions.
33

44
inputs:

phpunit-action.bash

+17-7
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,23 @@ github_action_path=$(dirname "$0")
44
docker_tag=$(cat ./docker_tag)
55
echo "Docker tag: $docker_tag" >> output.log 2>&1
66

7-
phar_url="https://phar.phpunit.de/phpunit"
8-
if [ "$ACTION_VERSION" != "latest" ]
7+
if [ -n "$ACTION_PHPUNIT_PATH" ]
98
then
10-
phar_url="${phar_url}-${ACTION_VERSION}"
9+
echo "Using phar" >> output.log 2>&1
10+
phar_url="https://phar.phpunit.de/phpunit"
11+
if [ "$ACTION_VERSION" != "latest" ]
12+
then
13+
phar_url="${phar_url}-${ACTION_VERSION}"
14+
fi
15+
phar_url="${phar_url}.phar"
16+
curl --silent -H "User-agent: cURL (https://github.com/php-actions)" -L "$phar_url" > "${github_action_path}/phpunit.phar"
17+
chmod +x "${github_action_path}/phpunit.phar"
18+
19+
phar_path="${github_action_path}/phpunit.phar"
20+
else
21+
phar_path="${GITHUB_WORKSPACE}/$ACTION_PHPUNIT_PATH"
22+
echo "Using vendored phpunit: $phar_path" >> output.log 2>&1
1123
fi
12-
phar_url="${phar_url}.phar"
13-
curl --silent -H "User-agent: cURL (https://github.com/php-actions)" -L "$phar_url" > "${github_action_path}/phpunit.phar"
14-
chmod +x "${github_action_path}/phpunit.phar"
1524

1625
command_string=("phpunit")
1726

@@ -85,9 +94,10 @@ then
8594
command_string+=($ACTION_ARGS)
8695
fi
8796

97+
8898
echo "Command: " "${command_string[@]}" >> output.log 2>&1
8999
docker run --rm \
90-
--volume "${github_action_path}/phpunit.phar":/usr/local/bin/phpunit \
100+
--volume "${phar_path}":/usr/local/bin/phpunit \
91101
--volume "${GITHUB_WORKSPACE}":/app \
92102
--workdir /app \
93103
--network host \

0 commit comments

Comments
 (0)