Skip to content

Commit

Permalink
Local dev improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
deluxetom committed Dec 19, 2024
1 parent 142bd4e commit 41bdc09
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 2 deletions.
25 changes: 24 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,30 @@ We accept contributions via Pull Requests on [Github](https://github.com/thephpl
## Running Tests

``` bash
$ phpunit
## Local environment
$ ./vendor/bin/phpunit

## Docker
$ docker compose run --rm tests
```
## Statis Analysis

``` bash
## Local environment
$ ./vendor/bin/phpstan

## Docker
$ docker compose run --rm analysis
```

## Code standards

``` bash
## Local environment
$ ./vendor/bin/php-cs-fixer fix --allow-risky=yes

## Docker
$ docker compose run --rm cs
```

**Happy coding**!
20 changes: 20 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM php:8.1-cli

RUN mv "$PHP_INI_DIR/php.ini-development" "$PHP_INI_DIR/php.ini"

# install dependencies
RUN apt update && apt install -y --no-install-recommends \
libvips42 \
libffi-dev \
libexif-dev \
git \
unzip \
zip

COPY --from=ghcr.io/mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/

# install composer
COPY --from=composer /usr/bin/composer /usr/bin/composer

# Install PHP extensions
RUN install-php-extensions zip gd imagick exif ffi xdebug
8 changes: 7 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,17 @@
"require-dev": {
"mockery/mockery": "^1.6",
"phpunit/phpunit": "^10.5 || ^11.0",
"friendsofphp/php-cs-fixer": "^3.48"
"friendsofphp/php-cs-fixer": "^3.48",
"phpstan/phpstan": "^1.10 || ^2.0"
},
"autoload": {
"psr-4": {
"League\\Glide\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
"League\\Glide\\": "tests/"
}
}
}
19 changes: 19 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
services:
tests:
build: ./
working_dir: /project
command: bash -c "composer install && ./vendor/bin/phpunit"
volumes:
- ./:/project
analysis:
build: ./
working_dir: /project
command: bash -c "composer install && ./vendor/bin/phpstan analyze --memory-limit=512M"
volumes:
- ./:/project
cs:
build: ./
working_dir: /project
command: bash -c "composer install && ./vendor/bin/php-cs-fixer fix --allow-risky=yes"
volumes:
- ./:/project

0 comments on commit 41bdc09

Please sign in to comment.