Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Local dev improvements #417

Open
wants to merge 3 commits into
base: 3.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
/.gitignore export-ignore
/.editorconfig export-ignore
/.php-cs-fixer.dist.php export-ignore
/CHANGELOG.md export-ignore
/CONTRIBUTING.md export-ignore
/Dockerfile export-ignore
/docker-compose.yml export-ignore
/docs export-ignore
/phpstan.neon export-ignore
/phpunit.xml.dist export-ignore
/psalm.xml export-ignore
/psalm-baseline.xml export-ignore
/psalm.xml export-ignore
/tests export-ignore
/CHANGELOG.md export-ignore
/CONTRIBUTING.md export-ignore
/phpstan.neon export-ignore
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**!
18 changes: 18 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
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 \
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 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": "^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