Skip to content

Commit

Permalink
bump php to 8.3 and add docker infra (#13)
Browse files Browse the repository at this point in the history
  • Loading branch information
akondas authored Jun 3, 2024
1 parent 700df5b commit e77b6f6
Show file tree
Hide file tree
Showing 12 changed files with 324 additions and 256 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: "Installing PHP"
uses: "shivammathur/setup-php@v2"
with:
php-version: "8.2"
php-version: "8.3"
ini-values: memory_limit=-1

- name: "Install composer dependencies"
Expand Down
1 change: 1 addition & 0 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
$config = new PhpCsFixer\Config();

return $config
->setParallelConfig(PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect())
->setRiskyAllowed(true)
->setRules([
'@PHP71Migration' => true,
Expand Down
8 changes: 8 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
FROM php:8.3
RUN apt-get update -yqq
RUN apt-get install -y libzip-dev zip wget git procps
COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/
RUN install-php-extensions decimal
RUN curl -sS https://getcomposer.org/installer | php
RUN mv composer.phar /usr/local/bin/composer
RUN echo "memory_limit=-1" > $PHP_INI_DIR/conf.d/memory-limit.ini
41 changes: 41 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
.PHONY: $(MAKECMDGOALS)

DOCKER_COMPOSE = docker compose \
--project-directory ./ \
-p library_php

up:
$(DOCKER_COMPOSE) up -d

down:
$(DOCKER_COMPOSE) down -v --remove-orphans

start:
$(DOCKER_COMPOSE) start

stop:
$(DOCKER_COMPOSE) stop

restart:
$(DOCKER_COMPOSE) restart

config:
$(DOCKER_COMPOSE) config

ps:
$(DOCKER_COMPOSE) ps

bash:
$(DOCKER_COMPOSE) exec -w /app php /bin/bash

build:
DOCKER_BUILDKIT=1 $(DOCKER_COMPOSE) build --ssh default

clean:
@$(DOCKER_COMPOSE) down -v --rmi local

setup:
$(DOCKER_COMPOSE) exec -w /app php /bin/bash -c "composer install"

ci: setup
$(DOCKER_COMPOSE) exec -w /app php /bin/bash -c "composer ci"
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Library (PHP)

[![Minimum PHP Version](https://img.shields.io/badge/php-%5E8.2-8892BF.svg)](https://php.net/)
[![Minimum PHP Version](https://img.shields.io/badge/php-%5E8.3-8892BF.svg)](https://php.net/)
[![ci](https://github.com/ddd-by-examples/library-php/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/ddd-by-examples/library-php/actions/workflows/ci.yml)
![GitHub](https://img.shields.io/github/license/ddd-by-examples/library-php)

Expand Down Expand Up @@ -45,6 +45,22 @@ we decide whether it will be Circulating or Restricted. This enables
us to have book with same ISBN as circulated and restricted at the same time (for instance,
there is a book signed by the author that we want to keep as Restricted)

## How to build and run

The code below will boot the project, install all dependencies and run the build script (code style check, static analysis and all tests):

```shell
make up
make ci
```

### Interactive shell

```shell
make bash
```


## References

1. [Introducing EventStorming](https://leanpub.com/introducing_eventstorming) by Alberto Brandolini
Expand Down
9 changes: 4 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@
}
],
"require": {
"php": "^8.2",
"php": "^8.3",
"fale/isbn": "^3.1",
"munusphp/munus": "^0.16",
"symfony/uid": "^7.1"
},
"require-dev": {
"behat/behat": "^3.5",
"behat/behat": "^3.14",
"friendsofphp/php-cs-fixer": "^3.58",
"phpstan/phpstan": "^1.11",
"phpunit/phpunit": "^10.5"
"phpunit/phpunit": "^11.1"
},
"autoload": {
"psr-4": {
Expand All @@ -31,8 +31,7 @@
"Akondas\\Library\\Tests\\": "tests/"
},
"files": [
"tests/Fixture/Fixtures.php",
"vendor/phpunit/phpunit/src/Framework/Assert/Functions.php"
"tests/Fixture/Fixtures.php"
]
},
"scripts": {
Expand Down
Loading

0 comments on commit e77b6f6

Please sign in to comment.