Skip to content

Commit d5423cf

Browse files
committed
Rework binaries
1 parent adf2eb8 commit d5423cf

34 files changed

+370
-349
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,9 @@
99
# php-parallel-process
1010

1111
Work in progress ;)
12+
13+
# Installation
14+
15+
```
16+
composer require steevanb/php-parallel-processes ^0.1
17+
```

bin/ci/composer-require-checker

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,8 @@
22

33
set -eu
44

5-
readonly rootDir="$(realpath "$(dirname "$(realpath "$0")")/../..")"
6-
. "${rootDir}/bin/common.inc.sh"
5+
readonly ROOT_DIR="$(realpath "$(dirname "$(realpath "$0")")/../..")"
6+
. "${ROOT_DIR}"/bin/common.inc.sh
7+
. "${ROOT_DIR}"/bin/dockerise.inc.bash
78

8-
if ! ${IS_IN_DOCKER}; then
9-
docker \
10-
run \
11-
--rm \
12-
--tty \
13-
${DOCKER_INTERACTIVE_PARAMETER} \
14-
--volume "${rootDir}":/app:ro \
15-
--entrypoint bin/ci/"$(basename "${0}")" \
16-
--workdir /app \
17-
steevanb/php-parallel-process:ci
18-
exit 0
19-
fi
20-
21-
composer-require-checker --ansi
9+
composer-require-checker --ansi "${@}"

bin/ci/composer-validate

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,8 @@
22

33
set -eu
44

5-
readonly rootDir="$(realpath "$(dirname "$(realpath "$0")")/../..")"
6-
. "${rootDir}/bin/common.inc.sh"
7-
8-
if ! ${IS_IN_DOCKER}; then
9-
docker \
10-
run \
11-
--rm \
12-
--tty \
13-
${DOCKER_INTERACTIVE_PARAMETER} \
14-
--volume "${rootDir}":/app \
15-
--user "$(id -u)":"$(id -g)" \
16-
--entrypoint bin/ci/"$(basename "${0}")" \
17-
--workdir /app \
18-
--env COMPOSER_HOME=/app/var/composer \
19-
steevanb/php-parallel-process:ci
20-
exit 0
21-
fi
5+
readonly ROOT_DIR="$(realpath "$(dirname "$(realpath "$0")")/../..")"
6+
. "${ROOT_DIR}"/bin/common.inc.sh
7+
. "${ROOT_DIR}"/bin/dockerise.inc.bash
228

239
composer validate --ansi --strict

bin/ci/docker

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
set -eu
44

55
readonly ROOT_DIR="$(realpath "$(dirname "$(realpath "$0")")/../..")"
6-
readonly DOCKER_IMAGE_NAME="steevanb/php-parallel-process:ci"
7-
readonly DOCKER_FILE_PATH="${ROOT_DIR}/docker/ci"
6+
source "${ROOT_DIR}"/bin/common.inc.sh
87

9-
source "${ROOT_DIR}/bin/docker.inc.bash"
8+
DOCKER_IMAGE_NAME="${CI_DOCKER_IMAGE_NAME}" \
9+
DOCKER_FILE_PATH="${ROOT_DIR}"/docker/ci/Dockerfile \
10+
source "${ROOT_DIR}"/bin/docker-build.inc.bash

bin/ci/env

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
#!/usr/bin/env bash
1+
#!/usr/bin/env sh
22

33
set -eu
44

5-
readonly rootDir="$(realpath "$(dirname "$(realpath "$0")")/../..")"
5+
readonly ROOT_DIR="$(realpath "$(dirname "$(realpath "$0")")/../..")"
6+
. "${ROOT_DIR}"/bin/common.inc.sh
7+
. "${ROOT_DIR}"/bin/dockerise.inc.bash
68

7-
"${rootDir}"/bin/composer install
9+
"${ROOT_DIR}"/bin/composer install

bin/ci/infection

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,14 @@
22

33
set -eu
44

5-
readonly rootDir="$(realpath "$(dirname "$(realpath "$0")")/../..")"
6-
. "${rootDir}/bin/common.inc.sh"
5+
readonly ROOT_DIR="$(realpath "$(dirname "$(realpath "$0")")/../..")"
6+
. "${ROOT_DIR}"/bin/common.inc.sh
7+
. "${ROOT_DIR}"/bin/dockerise.inc.bash
78

8-
if ! ${IS_IN_DOCKER}; then
9-
docker \
10-
run \
11-
--tty \
12-
${DOCKER_INTERACTIVE_PARAMETER} \
13-
--volume "${rootDir}":/app \
14-
--user "$(id -u)":"$(id -g)" \
15-
--entrypoint bin/ci/"$(basename "${0}")" \
16-
--workdir /app \
17-
steevanb/php-parallel-process:ci \
18-
"${@}"
19-
exit 0
20-
fi
219

2210
XDEBUG_MODE=coverage \
2311
infection \
24-
--configuration=config/ci/infection.json \
12+
--configuration=config/release/infection.json \
2513
--threads=10 \
2614
--only-covered \
2715
--ansi \

bin/ci/phpcs

Lines changed: 6 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,41 +2,21 @@
22

33
set -eu
44

5-
readonly rootDir="$(realpath "$(dirname "$(realpath "$0")")/../..")"
6-
. "${rootDir}/bin/common.inc.sh"
5+
readonly ROOT_DIR="$(realpath "$(dirname "$(realpath "$0")")/../..")"
6+
. "${ROOT_DIR}"/bin/common.inc.sh
7+
. "${ROOT_DIR}"/bin/dockerise.inc.bash
78

8-
createCacheDir() {
9-
if [ ! -d "${rootDir}"/var/ci/phpcs ]; then
10-
mkdir -p "${rootDir}"/var/ci/phpcs
11-
fi
12-
}
13-
14-
if ! ${IS_IN_DOCKER}; then
15-
createCacheDir
16-
17-
docker \
18-
run \
19-
--tty \
20-
${DOCKER_INTERACTIVE_PARAMETER} \
21-
--volume "${rootDir}":/app:ro \
22-
--volume "${rootDir}"/var/ci/phpcs:/app/var/ci/phpcs \
23-
--user "$(id -u)":"$(id -g)" \
24-
--entrypoint bin/ci/"$(basename "${0}")" \
25-
--workdir /app \
26-
steevanb/php-parallel-process:ci \
27-
"${@}"
28-
exit 0
9+
if [ ! -d "${ROOT_DIR}"/var/ci/phpcs ]; then
10+
mkdir -p "${ROOT_DIR}"/var/ci/phpcs
2911
fi
3012

31-
createCacheDir
32-
3313
phpcs \
3414
-p \
3515
--warning-severity=0 \
3616
--ignore=/vendor/,/var/ \
3717
--bootstrap=config/ci/phpcs.php \
3818
--standard="${COMPOSER_HOME}"/vendor/steevanb/php-code-sniffs/src/Steevanb/ruleset.xml \
3919
--report=steevanb\\PhpCodeSniffs\\Reports\\Steevanb \
40-
--cache=var/ci/phpcs/cache \
20+
--cache="${ROOT_DIR}"/var/ci/phpcs/cache \
4121
. \
4222
"${@}"

bin/ci/phpdd

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,8 @@
22

33
set -eu
44

5-
readonly rootDir="$(realpath "$(dirname "$(realpath "$0")")/../..")"
6-
. "${rootDir}/bin/common.inc.sh"
5+
readonly ROOT_DIR="$(realpath "$(dirname "$(realpath "$0")")/../..")"
6+
. "${ROOT_DIR}"/bin/common.inc.sh
7+
. "${ROOT_DIR}"/bin/dockerise.inc.bash
78

8-
if ! ${IS_IN_DOCKER}; then
9-
docker \
10-
run \
11-
--rm \
12-
--tty \
13-
${DOCKER_INTERACTIVE_PARAMETER} \
14-
--volume "${rootDir}":/app:ro \
15-
--entrypoint bin/ci/"$(basename "${0}")" \
16-
--workdir /app \
17-
steevanb/php-parallel-process:ci
18-
exit 0
19-
fi
20-
21-
phpdd --ansi src
9+
phpdd --ansi --exclude=vendor,var "${@}" .

bin/ci/phpstan

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,11 @@
22

33
set -eu
44

5-
readonly rootDir="$(realpath "$(dirname "$(realpath "$0")")/../..")"
6-
. "${rootDir}/bin/common.inc.sh"
7-
8-
if ! ${IS_IN_DOCKER}; then
9-
docker \
10-
run \
11-
--rm \
12-
--tty \
13-
${DOCKER_INTERACTIVE_PARAMETER} \
14-
--volume "${rootDir}":/app \
15-
--user "$(id -u)":"$(id -g)" \
16-
--entrypoint bin/ci/"$(basename "${0}")" \
17-
--workdir /app \
18-
steevanb/php-parallel-process:ci
19-
exit 0
20-
fi
21-
22-
phpstan analyse --ansi -c config/ci/phpstan.neon
5+
readonly ROOT_DIR="$(realpath "$(dirname "$(realpath "$0")")/../..")"
6+
. "${ROOT_DIR}"/bin/common.inc.sh
7+
. "${ROOT_DIR}"/bin/dockerise.inc.bash
8+
9+
phpstan \
10+
analyse \
11+
--ansi \
12+
--configuration config/ci/phpstan.neon

bin/ci/phpunit

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,9 @@
22

33
set -eu
44

5-
readonly rootDir="$(realpath "$(dirname "$(realpath "$0")")/../..")"
6-
. "${rootDir}/bin/common.inc.sh"
7-
8-
if ! ${IS_IN_DOCKER}; then
9-
docker \
10-
run \
11-
--rm \
12-
--tty \
13-
${DOCKER_INTERACTIVE_PARAMETER} \
14-
--volume "${rootDir}":/app \
15-
--user "$(id -u)":"$(id -g)" \
16-
--entrypoint bin/ci/"$(basename "${0}")" \
17-
--workdir /app \
18-
steevanb/php-parallel-process:ci \
19-
"${@}"
20-
exit 0
21-
fi
5+
readonly ROOT_DIR="$(realpath "$(dirname "$(realpath "$0")")/../..")"
6+
. "${ROOT_DIR}"/bin/common.inc.sh
7+
. "${ROOT_DIR}"/bin/dockerise.inc.bash
228

239
phpVersion=
2410
symfonyVersion=
@@ -34,13 +20,15 @@ for arg in "${@}"; do
3420
done
3521

3622
if [ "${phpVersion}" == "" ] || [ "${symfonyVersion}" == "" ]; then
37-
php8.0 "${rootDir}"/bin/ci/phpunit.php "${@}"
23+
php8.0 "${ROOT_DIR}"/bin/ci/phpunit.php "${@}"
3824
else
3925
echo "PHP ${phpVersion} - Symfony ${symfonyVersion}"
4026

27+
readonly composerHomeVarName="COMPOSER_HOME_SYMFONY_${symfonyVersion/./_}"
28+
4129
"php${phpVersion}" \
4230
vendor/bin/phpunit \
43-
--bootstrap "${COMPOSER_HOME_SYMFONY_5_0}"/vendor/autoload.php \
4431
--configuration config/ci/phpunit.xml \
32+
--bootstrap ${!composerHomeVarName}/vendor/autoload.php \
4533
${phpunitParameters}
4634
fi

0 commit comments

Comments
 (0)