diff --git a/.docker/base/php74/Dockerfile b/.docker/base/php74/Dockerfile index a80b566..45e9789 100644 --- a/.docker/base/php74/Dockerfile +++ b/.docker/base/php74/Dockerfile @@ -1,4 +1,4 @@ -FROM circleci/php:7.4-fpm-browsers +FROM php:7.4-fpm USER root diff --git a/.docker/base/php80/Dockerfile b/.docker/base/php80/Dockerfile index 692d520..4c7274b 100644 --- a/.docker/base/php80/Dockerfile +++ b/.docker/base/php80/Dockerfile @@ -1,4 +1,4 @@ -FROM circleci/php:8.0-fpm-browsers +FROM php:8.0-fpm USER root diff --git a/.docker/base/php81/Dockerfile b/.docker/base/php81/Dockerfile new file mode 100644 index 0000000..a109b3d --- /dev/null +++ b/.docker/base/php81/Dockerfile @@ -0,0 +1,17 @@ +FROM php:8.1-fpm + +USER root + +# install system packages +RUN apt-get update \ + && apt-get -y install git wget \ + && apt-get install -qqy libzip-dev libpng-dev libjpeg-dev libfreetype6-dev \ + && apt-get clean; rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/* + +# configure php packages +RUN docker-php-ext-configure gd --with-freetype=/usr/include/ --with-jpeg=/usr/include/ + +# install php requirements +RUN docker-php-ext-install zip iconv gd + +COPY --from=composer:2 /usr/bin/composer /usr/local/bin/composer diff --git a/.docker/base/php82/Dockerfile b/.docker/base/php82/Dockerfile new file mode 100644 index 0000000..daa1a6b --- /dev/null +++ b/.docker/base/php82/Dockerfile @@ -0,0 +1,17 @@ +FROM php:8.2-fpm + +USER root + +# install system packages +RUN apt-get update \ + && apt-get -y install git wget \ + && apt-get install -qqy libzip-dev libpng-dev libjpeg-dev libfreetype6-dev \ + && apt-get clean; rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* /usr/share/doc/* + +# configure php packages +RUN docker-php-ext-configure gd --with-freetype=/usr/include/ --with-jpeg=/usr/include/ + +# install php requirements +RUN docker-php-ext-install zip iconv gd + +COPY --from=composer:2 /usr/bin/composer /usr/local/bin/composer diff --git a/.docker/development/php81/Dockerfile b/.docker/development/php81/Dockerfile new file mode 100644 index 0000000..e0b7efa --- /dev/null +++ b/.docker/development/php81/Dockerfile @@ -0,0 +1,5 @@ +FROM pugx/poser:php81 + +USER root + +WORKDIR "/application" diff --git a/.docker/development/php82/Dockerfile b/.docker/development/php82/Dockerfile new file mode 100644 index 0000000..cdd85a4 --- /dev/null +++ b/.docker/development/php82/Dockerfile @@ -0,0 +1,5 @@ +FROM pugx/poser:php82 + +USER root + +WORKDIR "/application" diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index 4d156bc..dc3580d 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -2,7 +2,9 @@ name: Build on: push: + branches: [ "master" ] pull_request: + branches: [ "master" ] jobs: cs-fix: @@ -10,7 +12,7 @@ jobs: name: PHP-CS-Fixer steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Fix CS uses: docker://oskarstark/php-cs-fixer-ga @@ -18,19 +20,19 @@ jobs: strategy: matrix: - container: [ "php74", "php80" ] + container: [ "php74", "php80", "php81", "php82" ] runs-on: ubuntu-latest container: pugx/poser:${{ matrix.container }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Validate composer.json run: composer validate - name: Cache Composer packages id: composer-cache - uses: actions/cache@v2 + uses: actions/cache@v3 with: path: vendor key: ${{ runner.os }}-php-${{ matrix.container }}-${{ hashFiles('**/composer.lock') }} @@ -38,7 +40,7 @@ jobs: ${{ runner.os }}-php-${{ matrix.container }} - name: Install dependencies - run: composer install -n --no-progress --no-suggest + run: composer install --prefer-dist --no-progress - name: Coding Standard Checks run: PHP_CS_FIXER_IGNORE_ENV=1 bin/php-cs-fixer fix --verbose --diff --dry-run diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 8445b52..7e89066 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -55,5 +55,18 @@ $ composer phpspec $ composer behat ``` +## How build new images on M1 +```shell +$ docker run --privileged --rm tonistiigi/binfmt --install all +$ docker buildx create --name mybuilder +$ docker buildx use mybuilder +$ docker buildx build \ + --platform linux/amd64,linux/arm64 \ + --build-arg BUILDKIT_INLINE_CACHE=1 \ + --push \ + -t pugx/poser:php81 \ + -f .docker/base/php81/Dockerfile \ + . +``` ## ENJOY diff --git a/docker-compose.yml b/docker-compose.yml index 561127d..cd27901 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -16,3 +16,19 @@ services: stdin_open: true volumes: - .:/application:cached + + php81: + build: + context: .docker/development/php81 + working_dir: /application + stdin_open: true + volumes: + - .:/application:cached + + php82: + build: + context: .docker/development/php82 + working_dir: /application + stdin_open: true + volumes: + - .:/application:cached diff --git a/src/Render/LocalSvgRenderer.php b/src/Render/LocalSvgRenderer.php index b2e4012..fed9e36 100644 --- a/src/Render/LocalSvgRenderer.php +++ b/src/Render/LocalSvgRenderer.php @@ -29,7 +29,7 @@ abstract class LocalSvgRenderer implements RenderInterface private TextSizeCalculatorInterface $textSizeCalculator; private string $templatesDirectory; - public function __construct(?TextSizeCalculatorInterface $textSizeCalculator = null, ?string $templatesDirectory = null) + public function __construct(TextSizeCalculatorInterface $textSizeCalculator = null, string $templatesDirectory = null) { $this->textSizeCalculator = $textSizeCalculator ?? new GDTextSizeCalculator(); $this->templatesDirectory = $templatesDirectory ?? (__DIR__ . '/../Resources/templates'); diff --git a/src/Render/SvgForTheBadgeRenderer.php b/src/Render/SvgForTheBadgeRenderer.php index f8e2458..1bacf81 100644 --- a/src/Render/SvgForTheBadgeRenderer.php +++ b/src/Render/SvgForTheBadgeRenderer.php @@ -26,9 +26,9 @@ class SvgForTheBadgeRenderer extends LocalSvgRenderer private \EasySVG $easy; public function __construct( - ?\EasySVG $easySVG = null, - ?TextSizeCalculatorInterface $textSizeCalculator = null, - ?string $templatesDirectory = null + \EasySVG $easySVG = null, + TextSizeCalculatorInterface $textSizeCalculator = null, + string $templatesDirectory = null ) { parent::__construct($textSizeCalculator, $templatesDirectory); diff --git a/src/UI/SingleCommandApplication.php b/src/UI/SingleCommandApplication.php index e0e90c3..23f8182 100644 --- a/src/UI/SingleCommandApplication.php +++ b/src/UI/SingleCommandApplication.php @@ -58,9 +58,6 @@ public function __construct(Command $command, string $version = 'UNKNOWN') $this->getDefinition()->setArguments(); } - /** - * {@inheritdoc} - */ protected function getCommandName(InputInterface $input): ?string { return $this->commandName;