Skip to content

Commit d3ffd6a

Browse files
authored
Merge pull request #159 from movabletype/phpbuild
Use php-build
2 parents bfbd0cd + 2b84dad commit d3ffd6a

59 files changed

Lines changed: 828 additions & 487 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ Dockerfile to test MT.
99

1010
|image name|base image|Perl|PHP|MySQL|OpenSSL|End of Life|
1111
|-|-|-|-|-|-|-|
12-
|centos7|centos:7|5.16.3|*7.1.33*|*MariaDB 5.5.68*|1.0.2k|2024-06|
13-
|bullseye|debian:bullseye-slim|*5.32.1*|*7.4.33*|*MariaDB 10.5.28*|1.1.1w|2024-08|
12+
|centos7|centos:7|5.16.3|*7.3.33*|*MariaDB 5.5.68*|1.0.2k|2024-06|
13+
|bullseye|debian:bullseye-slim|*5.32.1*|*7.4.33*|*MariaDB 10.5.29*|1.1.1w|2024-08|
1414
|fedora35|fedora:35|*5.34.1*|*8.0.26*|8.0.31|1.1.1q|2022-12|
1515
|fedora37|fedora:37|*5.36.1*|*8.1.25*|*8.0.35*|3.0.9|2023-12|
16-
|fedora40|fedora:40|*5.38.4*|*8.2.29*|*MariaDB 10.11.11*|3.2.4|-|
16+
|fedora40|fedora:40|*5.38.4*|*8.2.30*|*MariaDB 10.11.11*|3.2.4|-|
1717
|fedora42|fedora:42|*5.40.3*|*8.4.16*|*9.5.0*|3.2.6|-|
1818
|fedora43|fedora:43|*5.42.0*|8.4.16|*8.4.7*|3.5.4|-|
19-
|cloud7 (\*1)|rockylinux/rockylinux:9|*5.38.2*|*8.3.29*|MariaDB 10.5.27|3.5.1|-|
19+
|cloud7 (\*1)|rockylinux/rockylinux:9|*5.38.2*|*8.3.29*|MariaDB 10.5.29|3.5.1|-|
2020

2121
\*1 This image is not used in the MT cloud, but the well-known modules should have the same versions (except for those used only in tests).
2222

@@ -26,18 +26,17 @@ Dockerfile to test MT.
2626
|-|-|-|-|-|-|-|
2727
|noble|ubuntu:noble|5.38.2|8.3.6|8.4.7|3.0.13|-|
2828
|plucky|ubuntu:plucky|5.40.1|8.4.5|8.4.7|3.4.1|-|
29-
|questing|ubuntu:questing|5.42.0|8.4.11|8.4.7|3.5.3|-|
29+
|questing|ubuntu:questing|5.42.0|8.4.16|8.4.7|3.5.3|-|
3030

3131
## Environment list (only for manual testing)
3232

3333
|image name|base image|Perl|PHP|MySQL|OpenSSL|End of Life|
3434
|-|-|-|-|-|-|-|
3535
|buster (\*2)|debian:buster-slim|*5.28.1*|*7.3.31*|*MariaDB 10.3.39*|1.1.1n|2022-01|
3636
|centos6 (\*2)|centos:6|*5.10.1*|*5.3.3*|*5.1.73*|1.0.1e|2020-11|
37-
|centos8|centos:8|5.26.3|8.0.30|8.0.26|1.1.1k|2021-12|
3837
|fedora39 (\*2)|fedora:39|5.38.2|8.2.25|8.0.39|3.1.4|2024-11|
3938
|fedora41 (\*2)|fedora:41|5.40.3|8.3.27|8.4.7|3.2.6|-|
40-
|rawhide|fedora:rawhide|5.42.0|8.5.1|8.4.7|3.5.4|-|
39+
|rawhide|fedora:rawhide|5.42.0|8.5.2|8.4.7|3.5.4|-|
4140
|rockylinux|rockylinux/rockylinux:9|5.32.1|8.1.34|8.0.44|3.5.1|-|
4241
|bookworm|debian:bookworm-slim|5.36.0|8.2.29|MariaDB 10.11.14|3.0.17|2028-06|
4342
|sid|debian:sid|5.40.1|8.4.16|MariaDB 11.8.5|3.5.4|-|

amazonlinux/Dockerfile

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ WORKDIR /root
55
COPY ./patch/ /root/patch/
66

77
RUN yum -y install\
8-
which hostname glibc-langpack-ja git make cmake gcc clang curl perl perl-core tar zip unzip bzip2 which procps postfix cyrus-sasl-devel cyrus-sasl-plain\
8+
which hostname glibc-langpack-ja git make cmake gcc clang curl perl perl-core tar zip unzip bzip2 which procps postfix\
9+
cyrus-sasl-devel cyrus-sasl-plain\
910
mariadb-devel mariadb-server mariadb\
1011
vim nano\
11-
ImageMagick-perl perl-GD netpbm-progs ImageMagick giflib-devel libpng-devel libjpeg-devel gd-devel libwebp-devel icc-profiles-openicc\
12+
ImageMagick-perl perl-GD netpbm-progs ImageMagick giflib-devel libpng-devel libjpeg-devel gd-devel libwebp-devel\
13+
icc-profiles-openicc\
1214
libxml2-devel expat-devel openssl-devel openssl gmp-devel\
1315
libyaml-devel libffi-devel\
1416
httpd mod_ssl vsftpd ftp memcached\
@@ -24,7 +26,8 @@ RUN yum -y install\
2426
yum -y update --skip-broken &&\
2527
yum clean all && rm -rf /var/cache/yum &&\
2628
mkdir src && cd src &&\
27-
curl -LO https://cache.ruby-lang.org/pub/ruby/3.4/ruby-3.4.8.tar.gz && tar xf ruby-3.4.8.tar.gz &&\
29+
curl -LO https://cache.ruby-lang.org/pub/ruby/3.4/ruby-3.4.8.tar.gz &&\
30+
tar xf ruby-3.4.8.tar.gz &&\
2831
cd ruby-3.4.8 && ./configure --enable-shared --disable-install-doc && make -j4 && make install && cd .. &&\
2932
cd .. && rm -rf src && ldconfig /usr/local/lib &&\
3033
curl -sL https://phar.phpunit.de/phpunit-9.phar > phpunit && chmod +x phpunit &&\
@@ -33,7 +36,10 @@ RUN yum -y install\
3336
gem install \
3437
fluentd:1.18.0\
3538
&&\
36-
curl -sL https://cpanmin.us > cpanm && chmod +x cpanm && perl -pi -E 's{http://(www\.cpan\.org|backpan\.perl\.org|cpan\.metacpan\.org|fastapi\.metacpan\.org|cpanmetadb\.plackperl\.org)}{https://$1}g' cpanm && mv cpanm /usr/local/bin &&\
39+
curl -sL https://cpanmin.us > cpanm && chmod +x cpanm &&\
40+
perl -pi -E \
41+
's{http://(www\.cpan\.org|backpan\.perl\.org|cpan\.metacpan\.org|fastapi\.metacpan\.org|cpanmetadb\.plackperl\.org)}{https://$1}g' cpanm &&\
42+
mv cpanm /usr/local/bin &&\
3743
curl -sL --compressed https://git.io/cpm > cpm &&\
3844
chmod +x cpm &&\
3945
mv cpm /usr/local/bin/ &&\

amazonlinux/docker-entrypoint.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#!/bin/bash
22
set -e
33

4-
54
mysql_install_db --user=mysql --skip-name-resolve --force >/dev/null
65

76
bash -c "cd /usr; mysqld_safe --user=mysql --datadir=/var/lib/mysql &"
@@ -21,5 +20,4 @@ if [ -f t/cpanfile ]; then
2120
cpanm --installdeps -n . --cpanfile=t/cpanfile
2221
fi
2322

24-
2523
exec "$@"

amazonlinux2023/Dockerfile

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,29 @@ WORKDIR /root
55
COPY ./patch/ /root/patch/
66

77
RUN dnf -y --allowerasing install\
8-
which hostname glibc-langpack-ja glibc-locale-source git make cmake gcc clang curl perl perl-core tar zip unzip bzip2 which procps postfix cyrus-sasl-devel cyrus-sasl-plain\
8+
which hostname glibc-langpack-ja glibc-locale-source git make cmake gcc clang curl perl perl-core tar zip unzip bzip2\
9+
which procps postfix cyrus-sasl-devel cyrus-sasl-plain\
910
mariadb1011-pam mariadb1011-devel mariadb1011-server mariadb1011\
1011
vim nano\
11-
ImageMagick-perl perl-GD GraphicsMagick-perl netpbm-progs ImageMagick GraphicsMagick giflib-devel libpng-devel libjpeg-devel gd-devel libwebp-devel icc-profiles-openicc\
12+
ImageMagick-perl perl-GD GraphicsMagick-perl netpbm-progs ImageMagick GraphicsMagick giflib-devel libpng-devel\
13+
libjpeg-devel gd-devel libwebp-devel icc-profiles-openicc\
1214
libxml2-devel expat-devel openssl-devel openssl gmp-devel\
1315
php-cli php-xml php-json php php-mysqlnd php-gd php-mbstring\
1416
ruby ruby-devel libyaml-devel libffi-devel\
1517
httpd mod_ssl vsftpd memcached\
1618
&&\
1719
dnf -y update --skip-broken &&\
1820
dnf clean all && rm -rf /var/cache/dnf &&\
19-
curl -sL https://phar.phpunit.de/phpunit-11.phar > phpunit && chmod +x phpunit &&\
21+
curl -sL https://phar.phpunit.de/phpunit-12.phar > phpunit && chmod +x phpunit &&\
2022
mv phpunit /usr/local/bin/ &&\
2123
(curl -sL https://raw.githubusercontent.com/axllent/mailpit/develop/install.sh | bash) &&\
2224
gem install \
2325
json fluentd:1.18.0\
2426
&&\
25-
curl -sL https://cpanmin.us > cpanm && chmod +x cpanm && perl -pi -E 's{http://(www\.cpan\.org|backpan\.perl\.org|cpan\.metacpan\.org|fastapi\.metacpan\.org|cpanmetadb\.plackperl\.org)}{https://$1}g' cpanm && mv cpanm /usr/local/bin &&\
27+
curl -sL https://cpanmin.us > cpanm && chmod +x cpanm &&\
28+
perl -pi -E \
29+
's{http://(www\.cpan\.org|backpan\.perl\.org|cpan\.metacpan\.org|fastapi\.metacpan\.org|cpanmetadb\.plackperl\.org)}{https://$1}g' cpanm &&\
30+
mv cpanm /usr/local/bin &&\
2631
curl -sL --compressed https://git.io/cpm > cpm &&\
2732
chmod +x cpm &&\
2833
mv cpm /usr/local/bin/ &&\

amazonlinux2023/docker-entrypoint.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#!/bin/bash
22
set -e
33

4-
54
mysql_install_db --user=mysql --skip-name-resolve --force >/dev/null
65

76
bash -c "cd /usr; mysqld_safe --user=mysql --datadir=/var/lib/mysql &"
@@ -21,5 +20,4 @@ if [ -f t/cpanfile ]; then
2120
cpanm --installdeps -n . --cpanfile=t/cpanfile
2221
fi
2322

24-
2523
exec "$@"

bin/build_all.pl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
);
3232
my %aliases_rev;
3333

34-
my %multi_platform = map {$_ => 1} qw( noble plucky questing );
34+
my %multi_platform = map { $_ => 1 } qw( noble plucky questing );
3535

3636
while (my ($alias, $name) = each %aliases) {
3737
$aliases_rev{$name} ||= [];
@@ -51,7 +51,7 @@
5151
$tags .= " --tag movabletype/test:$t";
5252
}
5353
my $dockerfile = path("$name/Dockerfile")->slurp;
54-
my ($from) = $dockerfile =~ /^FROM (\S+)/;
54+
my ($from) = $dockerfile =~ /^FROM (\S+)/;
5555
system("docker pull $from") if $no_cache;
5656
if ($builder && $multi_platform{$name}) {
5757
system("docker buildx build --builder $builder --platform linux/amd64,linux/arm64 $name $tags --output=type=image" . ($no_cache ? " --no-cache" : "") . ($push ? " --push" : "") . " 2>&1 | tee log/build_$name.log");

bin/checker.t

Lines changed: 58 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ diag "\nChecking $image_name";
99

1010
my %prereqs = (
1111
'Archive::Tar' => '',
12-
'Archive::Zip' => '<= 1.65?(cloud6|cloud7|addons)',
12+
'Archive::Zip' => '<= 1.65?(cloud7|addons)',
1313
'DBI' => '1.633',
1414
'GD' => 0,
1515
'Graphics::Magick' => 0,
@@ -79,6 +79,8 @@ for my $module (sort keys %prereqs) {
7979
my ($perl_version) = `perl -v` =~ /v(5\.\d+\.\d+)/;
8080
ok $perl_version, "$image_name: Perl exists ($perl_version)";
8181

82+
my @image_files = glob("./t/images/*");
83+
8284
my $gd_version = eval { GD::LIBGD_VERSION() } || 0;
8385
my $gd_version_str = eval { GD::VERSION_STRING() } || 'unknown';
8486
note "$image_name: GD version $gd_version ($gd_version_str)";
@@ -88,11 +90,23 @@ if ($gd_version >= 2.0101) {
8890
ok eval { GD::supportsFileType('test.jpg') }, "$image_name: GD supports JPEG";
8991
ok eval { GD::supportsFileType('test.bmp') }, "$image_name: GD supports BMP";
9092
ok eval { GD::supportsFileType('test.webp') }, "$image_name: GD supports WEBP";
91-
SKIP: {
93+
SKIP: {
9294
local $TODO = 'AVIF may not be supported';
9395
ok eval { GD::supportsFileType('test.avif') }, "$image_name: GD supports AVIF";
9496
}
9597
}
98+
require GD::Image;
99+
for my $file (@image_files) {
100+
my $gd = GD::Image->new($file);
101+
if (!$gd) {
102+
# bmp support is broken on all the known images
103+
local $TODO = 'GD does not support BMP?' if $file =~ /\.bmp$/ or ($file =~ /\.webp$/ && $image_name =~ /^(?:addons8|amazonlinux|centos|cloud7|fedora3[579]|fedora40|oracle|rockylinux)/);
104+
fail "$image_name: GD failed to read $file";
105+
next;
106+
}
107+
my ($w, $h) = $gd->getBounds();
108+
ok $w && $h, "$image_name: GD can get size of $file";
109+
}
96110

97111
my $has_imager_webp = eval { require Imager::File::WEBP };
98112
my $has_imager_avif = eval { require Imager::File::AVIF };
@@ -109,6 +123,16 @@ SKIP: {
109123
local $TODO = 'AVIF may not be supported' unless $has_imager_avif;
110124
ok $imager_supports{avif}, "$image_name: Imager supports AVIF";
111125
}
126+
for my $file (@image_files) {
127+
next if $file =~ /\.webp$/ and !$has_imager_webp;
128+
my $imager = Imager->new;
129+
if (!$imager->read(file => $file)) {
130+
fail "$image_name: Imager failed to read $file";
131+
next;
132+
}
133+
my ($w, $h) = ($imager->getwidth, $imager->getheight);
134+
ok $w && $h, "$image_name: Imager can get size of $file";
135+
}
112136

113137
my %imagemagick_supports = map { $_ => 1 } Image::Magick->QueryFormat;
114138
ok $imagemagick_supports{gif}, "$image_name: ImageMagick supports GIF";
@@ -126,6 +150,17 @@ SKIP: {
126150
my $imagemagick_depth = Image::Magick->new->Get('depth');
127151
is $imagemagick_depth => '16', "$image_name: ImageMagick Quantum Depth: Q$imagemagick_depth";
128152

153+
for my $file (@image_files) {
154+
next if $file =~ /\.webp$/ and $image_name =~ /^(?:amazonlinux|centos7|oracle)$/;
155+
my $magick = Image::Magick->new;
156+
if (my $error = $magick->Read($file)) {
157+
fail "$image_name: ImageMagick failed to read $file: $error";
158+
next;
159+
}
160+
my ($w, $h) = $magick->Get('width', 'height');
161+
ok $w && $h, "$image_name: ImageMagick can get sizes of $file";
162+
}
163+
129164
my %graphicsmagick_supports = map { $_ => 1 } Graphics::Magick->QueryFormat;
130165
ok $graphicsmagick_supports{gif}, "$image_name: GraphicsMagick supports GIF";
131166
ok $graphicsmagick_supports{png}, "$image_name: GraphicsMagick supports PNG";
@@ -138,12 +173,23 @@ SKIP: {
138173
}
139174
my $graphicsmagick_depth = Graphics::Magick->new->Get('depth');
140175
is $graphicsmagick_depth => '16', "$image_name: GraphicsMagick Quantum Depth: Q$graphicsmagick_depth";
176+
177+
for my $file (@image_files) {
178+
my $magick = Graphics::Magick->new;
179+
if (my $error = $magick->Read($file)) {
180+
fail "$image_name: GraphicsMagick failed to read $file: $error";
181+
next;
182+
}
183+
my ($w, $h) = $magick->Get('width', 'height');
184+
ok $w && $h, "$image_name: GraphicsMagick can get sizes of $file";
185+
}
186+
141187
my ($has_identify) = `which identify`;
142-
ok $has_identify, "has identify";
188+
ok $has_identify, "$image_name: has identify";
143189
my ($has_convert) = `which convert`;
144-
ok $has_convert, "has convert";
190+
ok $has_convert, "$image_name: has convert";
145191
my ($has_gm) = `which gm`;
146-
ok $has_gm, "has gm";
192+
ok $has_gm, "$image_name: has gm";
147193

148194
my ($php_version) = `php --version` =~ /PHP (\d\.\d+\.\d+)/;
149195
ok $php_version, "$image_name: PHP exists ($php_version)";
@@ -160,15 +206,15 @@ if ($image_name eq 'postgresql') {
160206
} else {
161207
ok $phpinfo =~ /PDO drivers => .*?mysql/, "$image_name: PHP has PDO mysql driver";
162208
}
163-
ok $phpinfo =~ /GD Support => enabled/, "$image_name: PHP has GD";
164-
ok $phpinfo =~ /DOM.XML => enabled/, "$image_name: PHP has DOM/XML";
209+
ok $phpinfo =~ /GD Support => enabled/, "$image_name: PHP has GD";
210+
ok $phpinfo =~ /DOM.XML => enabled/, "$image_name: PHP has DOM/XML";
165211
ok $phpinfo =~ /GIF Read Support => enabled/, "$image_name: PHP supports GIF read";
166212
ok $phpinfo =~ /GIF Create Support => enabled/, "$image_name: PHP supports GIF create";
167213
ok $phpinfo =~ /JPEG Support => enabled/, "$image_name: PHP supports JPEG";
168214
ok $phpinfo =~ /PNG Support => enabled/, "$image_name: PHP supports PNG";
169-
ok $phpinfo =~ /WebP Support => enabled/, "$image_name: PHP supports WebP";
215+
ok $phpinfo =~ /WebP Support => enabled/, "$image_name: PHP supports WebP";
170216
SKIP: {
171-
local $TODO = 'Memcache may not be supported' if $image_name =~ /amazonlinux|oracle|centos8/;
217+
local $TODO = 'Memcache may not be supported' if $image_name =~ /amazonlinux|oracle/;
172218
ok $phpinfo =~ /memcache support => enabled/, "$image_name: PHP supports memcache";
173219
}
174220
if ($image_name =~ /oracle/) {
@@ -205,7 +251,9 @@ for my $line (@wanted_lines) {
205251
SKIP: {
206252
my ($phpunit) = (`phpunit --version` // '') =~ /PHPUnit (\d+\.\d+\.\d+)/;
207253
ok $phpunit, "$image_name: phpunit exists ($phpunit)";
208-
if ($php_version_number >= 8.2) {
254+
if ($php_version_number >= 8.3) {
255+
is substr($phpunit, 0, 2) => 12, "$image_name: phpunit 12 (12.x.x) for php >= 8.3 ($php_version)";
256+
} elsif ($php_version_number >= 8.2) {
209257
is substr($phpunit, 0, 2) => 11, "$image_name: phpunit 11 (11.x.x) for php >= 8.2 ($php_version)";
210258
} elsif ($php_version_number >= 8.1) {
211259
is substr($phpunit, 0, 2) => 10, "$image_name: phpunit 10 (10.x.x) for php >= 8.1 ($php_version)";

bin/test_readme.pl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
$line =~ s/(?:MariaDB|Postgres) //;
2727
my ($image, $base, @rest) = split '\|', $line;
2828
next if $image =~ /(?:openldap|chromedriver)/;
29+
2930
if ($image =~ /(?:addons|chromiumdriver|playwright)/) {
3031
my @extra = split /,\s*/, $rest[0];
3132
$mapping{$image} = { map { split / /, $_ } @extra };

bin/test_workflows.pl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
use File::Path;
66

77
my $local = YAML::LoadFile('./.github/workflows/mirror.yml');
8-
my %tags = map {$_ => 1} @{$local->{jobs}{'pull-and-push'}{strategy}{matrix}{tag} // []};
9-
$tags{centos6} = 1; # special case
8+
my %tags = map { $_ => 1 } @{ $local->{jobs}{'pull-and-push'}{strategy}{matrix}{tag} // [] };
9+
$tags{centos6} = 1; # special case
1010

1111
my @branches = qw(develop support-8.8.x support-8.4.x support-8.0.x);
1212
my @repos = qw(movabletype movabletype-addons movabletype-plugins);
@@ -23,7 +23,7 @@
2323
next;
2424
}
2525
my $workflow = YAML::LoadFile($yml);
26-
for my $key (keys %{$workflow->{jobs}}) {
26+
for my $key (keys %{ $workflow->{jobs} }) {
2727
if (my $image = $workflow->{jobs}{$key}{env}{TEST_IMAGE_NAME}) {
2828
ok $tags{$image}, "$image is used in $repo/$branch (by env)";
2929
$used{$image}{$branch} = 1;

0 commit comments

Comments
 (0)