From d719d9f0854047e60b51b966c7c7db4f411055b6 Mon Sep 17 00:00:00 2001 From: Michael Vasseur <14887731+vmcj@users.noreply.github.com> Date: Sat, 7 Dec 2024 15:29:09 +0100 Subject: [PATCH] We need PHPversion in both scripts Displaying the PHPconfig makes more sense in the shared setup script. --- .github/jobs/baseinstall.sh | 15 +++++++-------- .github/jobs/unit-tests.sh | 2 -- .github/workflows/unit-tests.yml | 2 +- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/.github/jobs/baseinstall.sh b/.github/jobs/baseinstall.sh index fb2f3bb123..fd474725c7 100755 --- a/.github/jobs/baseinstall.sh +++ b/.github/jobs/baseinstall.sh @@ -4,23 +4,22 @@ export version="$1" db=${2:-install} -phpversion="${3}" +phpversion="${3:-8.4}" +# If this script is called from unit-tests.sh, we use the test environment +export APP_ENV="${4:-prod}" MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:-root} -# If this script is called from unit-tests.sh, we use the test environment -export APP_ENV="${3:-prod}" - # In the test environment, we need to use a different database [ "$APP_ENV" = "prod" ] && DATABASE_NAME=domjudge || DATABASE_NAME=domjudge_test set -eux if [ -z "$phpversion" ]; then -PHPVERSION=$(php -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION."\n";') +phpversion=$(php -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION."\n";') fi -show_phpinfo "$PHPVERSION" +show_phpinfo "$phpversion" section_start "Run composer" export APP_ENV="dev" @@ -108,7 +107,7 @@ cp /proc/cmdline "$ARTIFACTS"/cmdline.txt section_end section_start "Setup webserver" -cp /opt/domjudge/domserver/etc/domjudge-fpm.conf /etc/php/"$PHPVERSION"/fpm/pool.d/domjudge.conf +cp /opt/domjudge/domserver/etc/domjudge-fpm.conf /etc/php/"$phpversion"/fpm/pool.d/domjudge.conf rm -f /etc/nginx/sites-enabled/* cp /opt/domjudge/domserver/etc/nginx-conf /etc/nginx/sites-enabled/domjudge @@ -122,7 +121,7 @@ nginx -t section_end section_start "Show webserver is up" -for service in nginx php${PHPVERSION}-fpm; do +for service in nginx php${phpversion}-fpm; do service "$service" restart service "$service" status done diff --git a/.github/jobs/unit-tests.sh b/.github/jobs/unit-tests.sh index 3da151eb79..b55fb86ce3 100755 --- a/.github/jobs/unit-tests.sh +++ b/.github/jobs/unit-tests.sh @@ -8,8 +8,6 @@ export version=$1 unittest=$2 [ "$version" = "8.1" ] && CODECOVERAGE=1 || CODECOVERAGE=0 -show_phpinfo $version - # Set up export unit=1 diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 2fa9f80d92..7455125a7f 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -50,7 +50,7 @@ jobs: - name: pstree run: pstree -p - name: Install DOMjudge - run: .github/jobs/baseinstall.sh unit install test + run: .github/jobs/baseinstall.sh unit install ${{ matrix.PHPVERSION }} test - name: Check nginx run: curl -v https://localhost/domjudge/ - name: Run the unit-tests