Skip to content

Commit a3f6a1d

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

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

phpunit-action.bash

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,21 @@ 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+
phar_url="https://phar.phpunit.de/phpunit"
10+
if [ "$ACTION_VERSION" != "latest" ]
11+
then
12+
phar_url="${phar_url}-${ACTION_VERSION}"
13+
fi
14+
phar_url="${phar_url}.phar"
15+
curl --silent -H "User-agent: cURL (https://github.com/php-actions)" -L "$phar_url" > "${github_action_path}/phpunit.phar"
16+
chmod +x "${github_action_path}/phpunit.phar"
17+
18+
phar_path="${github_action_path}/phpunit.phar"
19+
else
20+
phar_path="${GITHUB_WORKSPACE}/$ACTION_PHPUNIT_PATH"
1121
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"
1522

1623
command_string=("phpunit")
1724

@@ -85,9 +92,10 @@ then
8592
command_string+=($ACTION_ARGS)
8693
fi
8794

95+
8896
echo "Command: " "${command_string[@]}" >> output.log 2>&1
8997
docker run --rm \
90-
--volume "${github_action_path}/phpunit.phar":/usr/local/bin/phpunit \
98+
--volume "${phar_path}":/usr/local/bin/phpunit \
9199
--volume "${GITHUB_WORKSPACE}":/app \
92100
--workdir /app \
93101
--network host \

0 commit comments

Comments
 (0)