Skip to content

Commit

Permalink
Merge pull request #417 from deluxetom/3.x-local-dev
Browse files Browse the repository at this point in the history
Local dev improvements
  • Loading branch information
ADmad authored Jan 20, 2025
2 parents d6539da + 9b418f9 commit 35631a1
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 6 deletions.
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

0 comments on commit 35631a1

Please sign in to comment.