diff --git a/.github/actions/run-tests/tests/Dockerfile b/.github/actions/run-tests/tests/Dockerfile index 871ccd66..6384a196 100644 --- a/.github/actions/run-tests/tests/Dockerfile +++ b/.github/actions/run-tests/tests/Dockerfile @@ -2,19 +2,8 @@ ARG PHPVERSION FROM php:${PHPVERSION}-cli -RUN apt-get update && \ - apt-get install -y --no-install-recommends npm make default-mysql-client postgresql-client \ - unzip git libfreetype6-dev libpng-dev libjpeg-dev libzip-dev cmake libpq-dev libsqlite3-dev && \ - if [ ${PHPVERSION} = "7.2" ]; then \ - docker-php-ext-configure gd; \ - else \ - docker-php-ext-configure gd --with-freetype --with-jpeg; \ - fi && \ - docker-php-ext-install -j $(nproc) gd && \ - docker-php-ext-configure zip && \ - docker-php-ext-install -j$(nproc) zip && \ - docker-php-ext-install -j$(nproc) pdo pdo_mysql pdo_pgsql pdo_sqlite && \ - apt-get clean +COPY install.sh /install.sh +RUN /install.sh RUN mkdir /workdir WORKDIR /workdir diff --git a/.github/actions/run-tests/tests/install.sh b/.github/actions/run-tests/tests/install.sh new file mode 100755 index 00000000..4339cceb --- /dev/null +++ b/.github/actions/run-tests/tests/install.sh @@ -0,0 +1,41 @@ +#!/bin/bash -e + +set -x + +function configure_gd_normal () +{ + docker-php-ext-configure gd --with-freetype --with-jpeg + return $? +} + +function configure_gd_without () +{ + docker-php-ext-configure gd + return $? +} + +function configure_gd() +{ + if [ "$1" = "7.2" ]; then + configure_gd_without + return $? + else + configure_gd_normal + return $? + fi +} + + +apt-get update +apt-get install -y --no-install-recommends \ + npm make default-mysql-client postgresql-client \ + unzip git libfreetype6-dev libpng-dev libjpeg-dev libzip-dev cmake libpq-dev libsqlite3-dev +apt-get clean + +configure_gd "$1" +docker-php-ext-install -j$(nproc) gd + +docker-php-ext-configure zip +docker-php-ext-install -j$(nproc) zip + +docker-php-ext-install -j$(nproc) pdo pdo_mysql pdo_pgsql pdo_sqlite