From 0068ca2702b09daa7bf3c8cc175733cbb42d67a6 Mon Sep 17 00:00:00 2001 From: Olivier Laviale Date: Fri, 20 Sep 2024 08:28:24 +0200 Subject: [PATCH] Test against PHP 8.3 --- .github/workflows/code-style.yml | 4 +-- .github/workflows/static-analysis.yml | 6 ++-- .github/workflows/test.yml | 7 ++-- MIGRATION.md => CHANGELOG.md | 2 +- Dockerfile | 52 ++++++++++++++++----------- LICENSE | 2 +- Makefile | 5 +++ README.md | 4 +-- composer.json | 4 +-- docker-compose.yaml | 12 ++++++- phpunit.xml | 4 ++- 11 files changed, 65 insertions(+), 37 deletions(-) rename MIGRATION.md => CHANGELOG.md (98%) diff --git a/.github/workflows/code-style.yml b/.github/workflows/code-style.yml index d2b81c1..33888b6 100644 --- a/.github/workflows/code-style.yml +++ b/.github/workflows/code-style.yml @@ -6,10 +6,10 @@ on: jobs: phpcs: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Install PHP uses: shivammathur/setup-php@v2 with: diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 3b5da94..37f6f81 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -7,10 +7,10 @@ on: jobs: phpstan: name: phpstan - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Install PHP uses: shivammathur/setup-php@v2 with: @@ -18,7 +18,7 @@ jobs: ini-values: memory_limit=-1 tools: composer:v2 - name: Cache dependencies - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: | ~/.composer/cache diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fa2121a..f2f14a8 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,15 +7,16 @@ on: jobs: phpunit: name: phpunit - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest strategy: matrix: php-version: - "8.1" - "8.2" + - "8.3" steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Install PHP uses: shivammathur/setup-php@v2 with: @@ -24,7 +25,7 @@ jobs: ini-values: memory_limit=-1 tools: composer:v2 - name: Cache dependencies - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: | ~/.composer/cache diff --git a/MIGRATION.md b/CHANGELOG.md similarity index 98% rename from MIGRATION.md rename to CHANGELOG.md index acb5486..915e8e0 100644 --- a/MIGRATION.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -# Migration +# Changelog ## v2.x to v6.0 diff --git a/Dockerfile b/Dockerfile index 0bc3e82..b485860 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,30 +1,40 @@ ARG PHP_VERSION -FROM php:${PHP_VERSION}-cli-buster +FROM php:${PHP_VERSION}-cli-bookworm -RUN apt-get update && \ - apt-get install -y autoconf pkg-config && \ - pecl channel-update pecl.php.net && \ - pecl install xdebug && \ +RUN <<-EOF + apt-get update + apt-get install -y autoconf pkg-config + pecl channel-update pecl.php.net + pecl install xdebug docker-php-ext-enable opcache xdebug +EOF -RUN echo '\ -xdebug.client_host=host.docker.internal\n\ -xdebug.mode=develop\n\ -xdebug.start_with_request=yes\n\ -' >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini +RUN <<-EOF + cat <<-SHELL >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini + xdebug.client_host=host.docker.internal + xdebug.mode=develop + xdebug.start_with_request=yes + SHELL -RUN echo '\ -display_errors=On\n\ -error_reporting=E_ALL\n\ -date.timezone=UTC\n\ -' >> /usr/local/etc/php/conf.d/php.ini + cat <<-SHELL >> /usr/local/etc/php/conf.d/php.ini + display_errors=On + error_reporting=E_ALL + date.timezone=UTC + SHELL +EOF ENV COMPOSER_ALLOW_SUPERUSER 1 -RUN apt-get update && \ - apt-get install unzip && \ - curl -s https://raw.githubusercontent.com/composer/getcomposer.org/76a7060ccb93902cd7576b67264ad91c8a2700e2/web/installer | php -- --quiet && \ - mv composer.phar /usr/local/bin/composer && \ - echo 'export PATH="$HOME/.composer/vendor/bin:$PATH"\n' >> /root/.bashrc +RUN <<-EOF + apt-get update + apt-get install unzip + curl -s https://raw.githubusercontent.com/composer/getcomposer.org/76a7060ccb93902cd7576b67264ad91c8a2700e2/web/installer | php -- --quiet + mv composer.phar /usr/local/bin/composer + cat <<-SHELL >> /root/.bashrc + export PATH="$HOME/.composer/vendor/bin:$PATH" + SHELL +EOF -RUN composer global require -n squizlabs/php_codesniffer +RUN composer global require squizlabs/php_codesniffer + +ENV COMPOSER_ROOT_VERSION 6.0.0 diff --git a/LICENSE b/LICENSE index 3decb8c..9d30719 100755 --- a/LICENSE +++ b/LICENSE @@ -1,7 +1,7 @@ The icanboogie/common package is free software. It is released under the terms of the following BSD License. -Copyright (c) 2007-2023 by Olivier Laviale +Copyright (c) 2007-present by Olivier Laviale All rights reserved. Redistribution and use in source and binary forms, with or without modification, diff --git a/Makefile b/Makefile index c57ab52..0fc5335 100755 --- a/Makefile +++ b/Makefile @@ -44,6 +44,11 @@ test-container-82: @-docker-compose run --rm app82 bash @docker-compose down -v +.PHONY: test-container-83 +test-container-83: + @-docker-compose run --rm app83 bash + @docker-compose down -v + .PHONY: lint lint: @XDEBUG_MODE=off phpcs -s diff --git a/README.md b/README.md index f04ebeb..e1bc9bc 100755 --- a/README.md +++ b/README.md @@ -131,13 +131,13 @@ The project is continuously tested by [GitHub actions](https://github.com/ICanBo ## Code of Conduct This project adheres to a [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By participating in -this project and its community, you are expected to uphold this code. +this project and its community, you're expected to uphold this code. ## Contributing -Please see [CONTRIBUTING](CONTRIBUTING.md) for details. +See [CONTRIBUTING](CONTRIBUTING.md) for details. diff --git a/composer.json b/composer.json index fe3f617..00ad504 100755 --- a/composer.json +++ b/composer.json @@ -29,8 +29,8 @@ "ext-mbstring": "*" }, "require-dev": { - "phpstan/phpstan": "^1.10", - "phpunit/phpunit": "^10.0" + "phpstan/phpstan": "^1.12", + "phpunit/phpunit": "^10.0|^11.0" }, "autoload": { "psr-4": { diff --git a/docker-compose.yaml b/docker-compose.yaml index c5fcd8f..6026526 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,5 +1,4 @@ --- -version: "3.2" services: app81: build: @@ -23,3 +22,14 @@ services: - .:/app:delegated - ~/.composer:/root/.composer:delegated working_dir: /app + app83: + build: + context: . + args: + PHP_VERSION: "8.3" + environment: + PHP_IDE_CONFIG: 'serverName=icanboogie-common' + volumes: + - .:/app:delegated + - ~/.composer:/root/.composer:delegated + working_dir: /app diff --git a/phpunit.xml b/phpunit.xml index 9d31fd6..cb3471a 100755 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,4 +1,4 @@ - +