Skip to content

Commit

Permalink
Merge pull request #28 from intaro/php81
Browse files Browse the repository at this point in the history
Misc
  • Loading branch information
muxx authored Jan 18, 2024
2 parents 4ce1969 + 374a8d8 commit e2e7c60
Show file tree
Hide file tree
Showing 6 changed files with 56 additions and 46 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,22 @@ jobs:
matrix:
php-version:
- '7.4'
- '8.0'
- '8.1'
- '8.2'
symfony-version:
- '4.4.*'
- '5.4.*'
- '6.2.*'
exclude:
- php-version: '8.1'
- php-version: '8.2'
symfony-version: '4.4.*'
- php-version: '8.1'
- php-version: '8.2'
symfony-version: '5.4.*'
- php-version: '8.1'
symfony-version: '4.4.*'
- php-version: '8.0'
symfony-version: '6.2.*'
- php-version: '7.4'
symfony-version: '6.2.*'
coverage: [ 'none' ]
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ vendor
.travis.yml

.php_cs.cache
.phpunit.result.cache
48 changes: 4 additions & 44 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,49 +1,9 @@
FROM scratch AS composer_install_requirements
ARG PHP_IMAGE_TAG
FROM php:${PHP_IMAGE_TAG}-cli-alpine

COPY composer.json /

FROM scratch AS test_source

COPY . .
COPY tests/ /tests/
COPY phpunit.xml.* phpstan*.neon .php_cs.* /

FROM alpine:3.9

ADD https://php.hernandev.com/key/php-alpine.rsa.pub /etc/apk/keys/php-alpine.rsa.pub

RUN apk --update-cache add ca-certificates && \
echo "https://php.hernandev.com/v3.11/php-7.4" >> /etc/apk/repositories

# alpine php package does not include default extensions, be explicit
RUN set -eu; \
apk add --no-cache \
php \
php-iconv \
php-json \
php-mbstring \
php-openssl \
php-phar \
php-xml \
php-dom \
php-pdo \
php-curl \
php-session \
; ln -s /usr/bin/php7 /usr/bin/php
RUN apk add autoconf gcc g++ make
RUN pecl install redis && docker-php-ext-enable redis

COPY --from=composer:latest /usr/bin/composer /usr/bin/composer
# install Symfony Flex globally to speed up download of Composer packages (parallelized prefetching)
RUN set -eux; \
composer global require "symfony/flex" --prefer-dist --no-progress --no-suggest --classmap-authoritative;

WORKDIR /opt/test

COPY --from=composer_install_requirements / .

RUN php7 /usr/bin/composer install

COPY --from=test_source / .

RUN echo "memory_limit=1G" > /etc/php7/conf.d/99-custom.ini

ENTRYPOINT ["composer"]
19 changes: 19 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
ifneq (,$(shell (type docker-compose 2>&1 >/dev/null && echo 1) || true))
PHP=docker-compose run --rm --no-deps php
else
PHP=php
endif

PHP_CONSOLE_DEPS=vendor

vendor: composer.json
@$(PHP) composer install -o -n --no-ansi
@touch vendor || true

phpcs: $(PHP_CONSOLE_DEPS)
@$(PHP) vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php --using-cache=no -v

phpunit: $(PHP_CONSOLE_DEPS)
@$(PHP) vendor/bin/phpunit --color=always

check: phpcs phpunit
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,17 @@ doctrine:
type: service
id: doctrine.result.memcache
```

## Development ##

### Run tests ###

Install vendors:
```shell
make vendor
```

Run php-cs-fixer and phpunit:
```shell
make check
```
10 changes: 10 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
version: '3.4'

services:
php:
build:
context: .
args:
PHP_IMAGE_TAG: ${PHP_IMAGE_TAG:-7.4}
volumes:
- "./:/opt/test"

0 comments on commit e2e7c60

Please sign in to comment.