Skip to content
Merged
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
18 changes: 10 additions & 8 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
/.github export-ignore
/tests export-ignore
.gitattributes export-ignore
.gitignore export-ignore
.php-cs-fixer.php export-ignore
Makefile export-ignore
composer-require-checker.json export-ignore
phpunit.xml export-ignore
/.github/ export-ignore
/tests/ export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.php-cs-fixer.php export-ignore
/Makefile export-ignore
/Dockerfile export-ignore
/docker-compose.yml export-ignore
/composer-require-checker.json export-ignore
/phpunit.xml export-ignore
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
strategy:
matrix:
php-version:
- "8.3"
- "8.4"

steps:
- uses: "actions/checkout@v5"
Expand All @@ -40,11 +40,11 @@ jobs:
strategy:
matrix:
php-version:
- "8.4"
- "8.5"
code-coverage:
- "none"
include:
- php-version: "8.3"
- php-version: "8.4"
code-coverage: "pcov"

steps:
Expand Down Expand Up @@ -78,7 +78,7 @@ jobs:
strategy:
matrix:
php-version:
- "8.3"
- "8.4"

steps:
- uses: "actions/checkout@v5"
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/.phpunit.cache/
/vendor/
/coverage/
/.env
/.php-cs-fixer.cache
/.phpunit.result.cache
/composer.lock
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM php:8.4

ADD --chmod=0755 https://github.com/mlocati/docker-php-extension-installer/releases/latest/download/install-php-extensions /usr/local/bin/

RUN install-php-extensions @composer pcov

ARG USER_ID
ARG GROUP_ID

RUN groupadd --gid ${GROUP_ID} code \
&& useradd --create-home --shell /bin/bash --uid ${USER_ID} --gid code code

USER code
24 changes: 15 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
CSFIX_PHP_BIN=PHP_CS_FIXER_IGNORE_ENV=1 php8.2
PHP_BIN=php8.2 -d zend.assertions=1 -d error_reporting=-1
COMPOSER_BIN=$(shell command -v composer)
ifdef CI
DOCKER_PHP_EXEC :=
else
DOCKER_PHP_EXEC := docker compose run --rm php
endif

all: csfix test
@echo "Done."

vendor: composer.json
$(PHP_BIN) $(COMPOSER_BIN) update
$(PHP_BIN) $(COMPOSER_BIN) bump
touch vendor
.env: /etc/passwd /etc/group Makefile
printf "USER_ID=%s\nGROUP_ID=%s\n" `id --user "${USER}"` `id --group "${USER}"` > .env

vendor: .env docker-compose.yml Dockerfile composer.json
docker compose build --pull
$(DOCKER_PHP_EXEC) composer update
$(DOCKER_PHP_EXEC) composer bump
touch --no-create $@

.PHONY: csfix
csfix: vendor
$(CSFIX_PHP_BIN) vendor/bin/php-cs-fixer fix -v
$(DOCKER_PHP_EXEC) vendor/bin/php-cs-fixer fix -v $(arg)

.PHONY: test
test: vendor
$(PHP_BIN) vendor/bin/phpunit $(PHPUNIT_ARGS)
$(DOCKER_PHP_EXEC) php -d zend.assertions=1 vendor/bin/phpunit $(PHPUNIT_ARGS)
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
}
],
"require": {
"php": "~8.3.0 || ~8.4.0"
"php": "~8.4.0 || ~8.5.0"
},
"require-dev": {
"phpunit/phpunit": "^12.4.1",
"slam/php-cs-fixer-extensions": "^3.13.0"
"slam/php-cs-fixer-extensions": "^3.14.0"
},
"autoload": {
"files": [
Expand Down
10 changes: 10 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
services:
php:
build:
context: .
args:
USER_ID: ${USER_ID}
GROUP_ID: ${GROUP_ID}
volumes:
- .:${PWD}
working_dir: ${PWD}
Loading