Skip to content

Commit 9cf0ca0

Browse files
committed
fix: scripts should also support php84.
fix: alpine version for php 8.1 and 84 fix: deptrac repo was moved fix: install-tools was not POSIX compliant even though it is not defined to use bash feat: update php-cs-fixer, add an env for php84 since it is unstable there feat: update swoole since it was failing to build for certain versions
1 parent 670dd2b commit 9cf0ca0

File tree

6 files changed

+86
-57
lines changed

6 files changed

+86
-57
lines changed

Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ default: build
33

44
.PHONY: build
55
build:
6-
@parallel --line-buffer PHP_VERSION={} ./bin/phpctl build ::: 81 82 83
6+
@parallel --line-buffer PHP_VERSION={} ./bin/phpctl build ::: 81 82 83 84
77

88
.PHONY: test
99
test:
10-
@parallel --line-buffer PHP_VERSION={} COMPOSER_AUTH= TERM= ./bin/notty ./lib/bashunit ./tests/ ::: 81 82 83
10+
@parallel --line-buffer PHP_VERSION={} COMPOSER_AUTH= TERM= ./bin/notty ./lib/bashunit ./tests/ ::: 81 82 83 84
1111
@[ -f phpctl.ini ] && rm phpctl.ini
1212

1313
.PHONY: install
@@ -16,4 +16,4 @@ install:
1616

1717
.PHONY: devcontainers
1818
devcontainers:
19-
@parallel --line-buffer PHP_VERSION={} ./src-devc/build.sh ::: 81 82 83
19+
@parallel --line-buffer PHP_VERSION={} ./src-devc/build.sh ::: 81 82 83 84

docs/commands.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ nav_order: 2
2323
| `co-phpunit` | [co-phpunit](https://github.com/hyperf/testing) is a Coroutine-aware PHPUnit for testing Hyperf projects. |
2424
| `composer-require-checker` | [ComposerRequireChecker](https://github.com/maglnet/ComposerRequireChecker): A CLI tool to analyze composer dependencies and verify that no unknown symbols are used in the sources of a package. |
2525
| `couscous` | [Couscous](https://github.com/CouscousPHP/Couscous): Couscous generates a GitHub pages website from your markdown documentation. |
26-
| `deptrac` | [Deptrac](https://github.com/qossmic/deptrac): Deptrac is a static code analysis tool for PHP that helps you communicate, visualize and enforce architectural decisions in your projects. |
26+
| `deptrac` | [Deptrac](https://github.com/deptrac/deptrac): Deptrac is a static code analysis tool for PHP that helps you communicate, visualize and enforce architectural decisions in your projects. |
2727
| `exakat` | [Exakat](https://www.exakat.io) is a real time customizable static analyzer engine that analyse and fix code. |
2828
| `frankenphp` | [FrankenPHP](https://frankenphp.dev): the Modern PHP App Server, written in Go. |
2929
| `infection` | [Infection](https://infection.github.io) is a Mutation Testing Framework. |

rootfs/usr/local/bin/install-swoole

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/usr/bin/env sh
22
set -e
33

4-
SWOOLE_VERSION="5.1.4"
4+
SWOOLE_VERSION="6.0.2"
55
echo "Installing Swoole $SWOOLE_VERSION"
66

77
# Download

rootfs/usr/local/bin/install-tools

Lines changed: 53 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -2,117 +2,119 @@
22
set -e
33

44
box() {
5-
local version="4.6.1"
5+
_version="4.6.1"
66
if [ "$PHP_VERSION" = "81" ]; then
7-
version="4.5.1"
7+
_version="4.5.1"
88
fi
9-
echo "Installing Box $version"
10-
wget -q "https://github.com/box-project/box/releases/download/$version/box.phar" -O /usr/local/bin/box
9+
echo "Installing Box $_version"
10+
wget -q "https://github.com/box-project/box/releases/download/$_version/box.phar" -O /usr/local/bin/box
1111
chmod a+x /usr/local/bin/box
1212
}
1313

1414
co_phpunit() {
15-
local version="3.1.3"
16-
echo "Installing co-phpunit $version"
17-
wget -q "https://raw.githubusercontent.com/hyperf/testing/v$version/co-phpunit" -O /usr/local/bin/co-phpunit
15+
_version="3.1.3"
16+
echo "Installing co-phpunit $_version"
17+
wget -q "https://raw.githubusercontent.com/hyperf/testing/v$_version/co-phpunit" -O /usr/local/bin/co-phpunit
1818
chmod a+x /usr/local/bin/co-phpunit
1919
}
2020

2121
composer() {
22-
local version="993f9fec74930f32f7015e71543243bf6d9b9e93"
23-
echo "Installing Composer $version"
24-
wget "https://raw.githubusercontent.com/composer/getcomposer.org/$version/web/installer" -O - -q | php -- --quiet
22+
_version="993f9fec74930f32f7015e71543243bf6d9b9e93"
23+
echo "Installing Composer $_version"
24+
wget "https://raw.githubusercontent.com/composer/getcomposer.org/$_version/web/installer" -O - -q | php -- --quiet
2525
mv composer.phar /usr/local/bin/composer
2626
chmod a+x /usr/local/bin/composer
2727
}
2828

2929
composer_require_checker() {
30-
local version="4.10.0"
30+
_version="4.10.0"
3131
if [ "$PHP_VERSION" = "81" ]; then
32-
version="4.7.1"
32+
_version="4.7.1"
3333
fi
34-
echo "Installing ComposerRequireChecker $version"
35-
wget -q "https://github.com/maglnet/ComposerRequireChecker/releases/download/$version/composer-require-checker.phar" -O /usr/local/bin/composer-require-checker
34+
echo "Installing ComposerRequireChecker $_version"
35+
wget -q "https://github.com/maglnet/ComposerRequireChecker/releases/download/$_version/composer-require-checker.phar" -O /usr/local/bin/composer-require-checker
3636
chmod a+x /usr/local/bin/composer-require-checker
3737
}
3838

3939
couscous() {
40-
local version="1.10.0"
41-
echo "Installing Couscous $version"
42-
wget -q "https://github.com/CouscousPHP/Couscous/releases/download/$version/couscous.phar" -O /usr/local/bin/couscous
40+
_version="1.10.0"
41+
echo "Installing Couscous $_version"
42+
wget -q "https://github.com/CouscousPHP/Couscous/releases/download/$_version/couscous.phar" -O /usr/local/bin/couscous
4343
chmod a+x /usr/local/bin/couscous
4444
}
4545

4646
deptrac() {
47-
local version="1.0.2"
48-
echo "Installing Deptrac $version"
49-
wget -q "https://github.com/qossmic/deptrac/releases/download/$version/deptrac.phar" -O /usr/local/bin/deptrac
47+
_version="1.0.2"
48+
echo "Installing Deptrac $_version"
49+
wget -q "https://github.com/deptrac/deptrac/releases/download/$_version/deptrac.phar" -O /usr/local/bin/deptrac
5050
chmod a+x /usr/local/bin/deptrac
5151
}
5252

5353
exakat() {
54-
local version="2.6.2"
55-
echo "Installing Exakat $version"
56-
wget -q "https://www.exakat.io/versions/index.php?file=exakat-$version.phar" -O /usr/local/bin/exakat
54+
_version="2.6.2"
55+
echo "Installing Exakat $_version"
56+
wget -q "https://www.exakat.io/versions/index.php?file=exakat-$_version.phar" -O /usr/local/bin/exakat
5757
chmod a+x /usr/local/bin/exakat
5858
}
5959

6060
infection() {
61-
local version="0.27.10"
62-
echo "Installing Infection $version"
63-
wget -q "https://github.com/infection/infection/releases/download/$version/infection.phar" -O /usr/local/bin/infection
61+
_version="0.27.10"
62+
echo "Installing Infection $_version"
63+
wget -q "https://github.com/infection/infection/releases/download/$_version/infection.phar" -O /usr/local/bin/infection
6464
chmod a+x /usr/local/bin/infection
6565
}
6666

6767
php_cs_fixer() {
68-
local version="3.51.0"
69-
echo "Installing PHP CS Fixer $version"
70-
wget -q "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/releases/download/v$version/php-cs-fixer.phar" -O /usr/local/bin/php-cs-fixer
68+
_version="3.75.0"
69+
echo "Installing PHP CS Fixer $_version"
70+
wget -q "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/releases/download/v$_version/php-cs-fixer.phar" -O /usr/local/bin/php-cs-fixer
7171
chmod a+x /usr/local/bin/php-cs-fixer
7272
}
7373

7474
phpcbf() {
75-
local version="3.7.2"
76-
echo "Installing PHP CodeSniffer $version (phpcbf)"
77-
wget -q "https://github.com/squizlabs/PHP_CodeSniffer/releases/download/$version/phpcbf.phar" -O /usr/local/bin/phpcbf
75+
_version="3.7.2"
76+
echo "Installing PHP CodeSniffer $_version (phpcbf)"
77+
wget -q "https://github.com/squizlabs/PHP_CodeSniffer/releases/download/$_version/phpcbf.phar" -O /usr/local/bin/phpcbf
7878
chmod a+x /usr/local/bin/phpcbf
7979
}
8080

8181
phpcs() {
82-
local version="3.7.2"
83-
echo "Installing PHP CodeSniffer $version (phpcs)"
84-
wget -q "https://github.com/squizlabs/PHP_CodeSniffer/releases/download/$version/phpcs.phar" -O /usr/local/bin/phpcs
82+
_version="3.7.2"
83+
echo "Installing PHP CodeSniffer $_version (phpcs)"
84+
wget -q "https://github.com/squizlabs/PHP_CodeSniffer/releases/download/$_version/phpcs.phar" -O /usr/local/bin/phpcs
8585
chmod a+x /usr/local/bin/phpcs
8686
}
8787

8888
phpmd() {
89-
local version="2.15.0"
90-
echo "Installing PHP Mess Detector $version"
91-
wget -q "https://github.com/phpmd/phpmd/releases/download/$version/phpmd.phar" -O /usr/local/bin/phpmd
89+
_version="2.15.0"
90+
echo "Installing PHP Mess Detector $_version"
91+
wget -q "https://github.com/phpmd/phpmd/releases/download/$_version/phpmd.phar" -O /usr/local/bin/phpmd
9292
chmod a+x /usr/local/bin/phpmd
9393
}
9494

9595
phpstan() {
96-
local version="1.10.59"
97-
echo "Installing PHPStan $version"
98-
wget -q "https://github.com/phpstan/phpstan/releases/download/$version/phpstan.phar" -O /usr/local/bin/phpstan
96+
_version="1.10.59"
97+
echo "Installing PHPStan $_version"
98+
wget -q "https://github.com/phpstan/phpstan/releases/download/$_version/phpstan.phar" -O /usr/local/bin/phpstan
9999
chmod a+x /usr/local/bin/phpstan
100100
}
101101

102102
phpunit() {
103-
local version="11"
103+
_version="11"
104104
if [ "$PHP_VERSION" = "81" ]; then
105-
version="10"
105+
_version="10"
106+
elif [ "$PHP_VERSION" = "84" ]; then
107+
_version="12"
106108
fi
107-
echo "Installing PHPUnit $version"
108-
wget -q "https://phar.phpunit.de/phpunit-$version.phar" -O /usr/local/bin/phpunit
109+
echo "Installing PHPUnit $_version"
110+
wget -q "https://phar.phpunit.de/phpunit-$_version.phar" -O /usr/local/bin/phpunit
109111
chmod a+x /usr/local/bin/phpunit
110112
}
111113

112114
pint() {
113-
local version="1.14.0"
114-
echo "Installing Pint $version"
115-
wget -q "https://github.com/laravel/pint/releases/download/v$version/pint.phar" -O /usr/local/bin/pint
115+
_version="1.14.0"
116+
echo "Installing Pint $_version"
117+
wget -q "https://github.com/laravel/pint/releases/download/v$_version/pint.phar" -O /usr/local/bin/pint
116118
chmod a+x /usr/local/bin/pint
117119
}
118120

@@ -123,9 +125,9 @@ psysh() {
123125
}
124126

125127
watchr() {
126-
local version="0.5.3"
127-
echo "Installing watchr $version"
128-
wget -q "https://github.com/flavioheleno/watchr/releases/download/v$version/watchr.phar" -O /usr/local/bin/watchr
128+
_version="0.5.3"
129+
echo "Installing watchr $_version"
130+
wget -q "https://github.com/flavioheleno/watchr/releases/download/v$_version/watchr.phar" -O /usr/local/bin/watchr
129131
chmod a+x /usr/local/bin/watchr
130132
}
131133

src/docker.sh

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,34 @@ build() {
99
without_watchr="--build-arg WITHOUT_WATCHR=1"
1010
fi
1111

12+
if [[ -z $ALPINE ]]; then
13+
case $PHP_VERSION in
14+
"81")
15+
ALPINE=3.19
16+
;;
17+
"82")
18+
ALPINE=3.20
19+
;;
20+
"83")
21+
ALPINE=3.20
22+
;;
23+
"84")
24+
ALPINE=3.21
25+
;;
26+
*)
27+
ALPINE=3.21
28+
;;
29+
esac
30+
fi
31+
1232
echo -e "Building \033[0;32m$PHPCTL_IMAGE\033[0m"
1333
# shellcheck disable=SC2068
1434
# shellcheck disable=SC2154
1535
$PHPCTL_RUNTIME buildx build \
1636
--build-arg PHP="$PHP_VERSION" \
1737
--build-arg COMPOSER_AUTH="$COMPOSER_AUTH" \
1838
--build-arg HOST_USER="$(whoami)" \
39+
--build-arg ALPINE="$ALPINE" \
1940
$with_exakat \
2041
$without_watchr \
2142
${build[@]} -t "$PHPCTL_IMAGE" .
@@ -59,7 +80,7 @@ run() {
5980
if [ -n "$GIT_EXEC_PATH" ]; then
6081
# In a Git hook environment, we need to disable TTY allocation
6182
PHPCTL_TTY="--label=no-tty"
62-
fi
83+
fi
6384

6485
# shellcheck disable=SC2046
6586
# shellcheck disable=SC2068

tests/tools_test.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ function test_infection() {
2929
}
3030

3131
function test_php_cs_fixer() {
32+
if [[ $PHP_VERSION = "84" ]]; then
33+
# TODO: remove this when php-cs-fixer becomes stable with php 8.4
34+
export PHP_CS_FIXER_IGNORE_ENV=yes
35+
fi
3236
assert_matches "PHP CS Fixer 3\." "$(./bin/phpctl php-cs-fixer --version)"
3337
}
3438

@@ -51,6 +55,8 @@ function test_phpstan() {
5155
function test_phpunit() {
5256
if [ "$PHP_VERSION" = "81" ]; then
5357
assert_matches "PHPUnit 10\." "$(./bin/phpctl phpunit --version)"
58+
elif [ "$PHP_VERSION" = "84" ]; then
59+
assert_matches "PHPUnit 12\." "$(./bin/phpctl phpunit --version)"
5460
else
5561
assert_matches "PHPUnit 11\." "$(./bin/phpctl phpunit --version)"
5662
fi

0 commit comments

Comments
 (0)