Skip to content

Commit

Permalink
We need PHPversion in both scripts
Browse files Browse the repository at this point in the history
Displaying the PHPconfig makes more sense in the shared setup script.
  • Loading branch information
vmcj committed Dec 7, 2024
1 parent 49d4452 commit 1e35844
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 11 deletions.
17 changes: 9 additions & 8 deletions .github/jobs/baseinstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,24 @@

export version="$1"
db=${2:-install}
phpversion="${3}"
phpversion="${3:-8.1}"
# 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}
show_phpinfo $phpversion

# If this script is called from unit-tests.sh, we use the test environment
export APP_ENV="${3:-prod}"
MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD:-root}

# 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"
Expand Down Expand Up @@ -105,7 +106,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
Expand All @@ -119,7 +120,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
Expand Down
2 changes: 0 additions & 2 deletions .github/jobs/unit-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ export version=$1
unittest=$2
[ "$version" = "8.1" ] && CODECOVERAGE=1 || CODECOVERAGE=0

show_phpinfo $version

# Set up
export unit=1

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,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
Expand Down

0 comments on commit 1e35844

Please sign in to comment.