Skip to content

Commit d03c73f

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
1 parent 670dd2b commit d03c73f

File tree

5 files changed

+51
-22
lines changed

5 files changed

+51
-22
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-tools

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
set -e
33

44
box() {
5-
local version="4.6.1"
5+
_version="4.6.1"
66
if [ "$PHP_VERSION" = "81" ]; then
77
version="4.5.1"
88
fi
@@ -12,22 +12,22 @@ box() {
1212
}
1313

1414
co_phpunit() {
15-
local version="3.1.3"
15+
_version="3.1.3"
1616
echo "Installing co-phpunit $version"
1717
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"
22+
_version="993f9fec74930f32f7015e71543243bf6d9b9e93"
2323
echo "Installing Composer $version"
2424
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
3232
version="4.7.1"
3333
fi
@@ -37,80 +37,82 @@ composer_require_checker() {
3737
}
3838

3939
couscous() {
40-
local version="1.10.0"
40+
_version="1.10.0"
4141
echo "Installing Couscous $version"
4242
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"
47+
_version="1.0.2"
4848
echo "Installing Deptrac $version"
49-
wget -q "https://github.com/qossmic/deptrac/releases/download/$version/deptrac.phar" -O /usr/local/bin/deptrac
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"
54+
_version="2.6.2"
5555
echo "Installing Exakat $version"
5656
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"
61+
_version="0.27.10"
6262
echo "Installing Infection $version"
6363
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"
68+
_version="3.75.0"
6969
echo "Installing PHP CS Fixer $version"
7070
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"
75+
_version="3.7.2"
7676
echo "Installing PHP CodeSniffer $version (phpcbf)"
7777
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"
82+
_version="3.7.2"
8383
echo "Installing PHP CodeSniffer $version (phpcs)"
8484
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"
89+
_version="2.15.0"
9090
echo "Installing PHP Mess Detector $version"
9191
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"
96+
_version="1.10.59"
9797
echo "Installing PHPStan $version"
9898
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
105105
version="10"
106+
elif [ "$PHP_VERSION" = "84" ]; then
107+
version="12"
106108
fi
107109
echo "Installing PHPUnit $version"
108110
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"
115+
_version="1.14.0"
114116
echo "Installing Pint $version"
115117
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
@@ -123,7 +125,7 @@ psysh() {
123125
}
124126

125127
watchr() {
126-
local version="0.5.3"
128+
_version="0.5.3"
127129
echo "Installing watchr $version"
128130
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

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)