Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to PHP 8.3 and PHPUnit 10 #100

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
@@ -1,5 +1,6 @@
# Ignore PHPUnit bin download and run cache artifact
bin/phpunit-9.phar
bin/phpunit-10.phar
.phpunit*.cache

# Ignore run artifacts
Expand Down
12 changes: 6 additions & 6 deletions Dockerfile
@@ -1,4 +1,4 @@
FROM php:8.2.7-cli-alpine3.18 AS build
FROM php:8.3.3-cli-alpine3.18 AS build
Copy link
Author

@tomasnorre tomasnorre Mar 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would even opt for using php:8.3-cli-alpine3.18 instead so that we would not need to maintain on ever minor PHP update. Used full version as it was like that already.


RUN apk update && \
apk add --no-cache ca-certificates curl jo zip unzip
Expand All @@ -7,21 +7,21 @@ WORKDIR /usr/local/bin

RUN curl -L -o install-php-extensions https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions && \
chmod +x install-php-extensions && \
install-php-extensions ds-1.4.0 intl
install-php-extensions ds-1.5.0 intl

RUN curl -L -o phpunit-9.phar https://phar.phpunit.de/phpunit-9.phar && \
chmod +x phpunit-9.phar
RUN curl -L -o phpunit-10.phar https://phar.phpunit.de/phpunit-10.phar && \
chmod +x phpunit-10.phar

WORKDIR /usr/local/bin/junit-handler/
COPY --from=composer:2.5.8 /usr/bin/composer /usr/local/bin/composer
COPY junit-handler/ .
RUN composer install --no-interaction

FROM php:8.2.7-cli-alpine3.18 AS runtime
FROM php:8.3.3-cli-alpine3.18 AS runtime

COPY --from=build /usr/bin/jo /usr/bin/jo
COPY --from=build /usr/local/lib/php/extensions /usr/local/lib/php/extensions
COPY --from=build /usr/local/bin/phpunit-9.phar /opt/test-runner/bin/phpunit-9.phar
COPY --from=build /usr/local/bin/phpunit-10.phar /opt/test-runner/bin/phpunit-10.phar
COPY --from=build /usr/local/bin/junit-handler /opt/test-runner/junit-handler

# Use the default production configuration
Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -8,7 +8,7 @@ This is a minimal test runner for Exercism's v3 platform. It meets the minimal

### Dockerimage

The website uses isolated docker images to run untrusted code in a sandbox. Image consists of PHP 8.2.7 (PHPUnit 9/10). All final assets are built into the image, because the image does not have network access once in use.
The website uses isolated docker images to run untrusted code in a sandbox. Image consists of PHP 8.3.3 (PHPUnit 9/10). All final assets are built into the image, because the image does not have network access once in use.

Includes php extensions: ds, intl

Expand Down
4 changes: 2 additions & 2 deletions bin/run.sh
Expand Up @@ -2,9 +2,10 @@

set -euo pipefail

PHPUNIT_BIN="./bin/phpunit-9.phar"
PHPUNIT_BIN="./bin/phpunit-10.phar"
XML_RESULTS='results.xml'
JSON_RESULTS='results.json'
XDEBUG_MODE='off'

function main {
exercise_slug="${1}"
Expand All @@ -16,7 +17,6 @@ function main {
phpunit_output=$(eval "${PHPUNIT_BIN}" \
-d memory_limit=300M \
--log-junit "${output_dir%/}/${XML_RESULTS}" \
--verbose \
--no-configuration \
--do-not-cache-result \
"${test_files%%*( )}" 2>&1)
Expand Down