Skip to content

Commit 74aaee3

Browse files
authored
Release/4.2.0 (#44)
1 parent fbb496a commit 74aaee3

File tree

6 files changed

+113
-101
lines changed

6 files changed

+113
-101
lines changed

.gitattributes

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
/LICENSE export-ignore
55
/Makefile export-ignore
66
/README.md export-ignore
7-
/phpmd.xml export-ignore
87
/phpunit.xml export-ignore
98
/phpstan.neon.dist export-ignore
109
/infection.json.dist export-ignore

.github/workflows/ci.yml

Lines changed: 47 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,42 @@ permissions:
77
contents: read
88

99
env:
10-
PHP_VERSION: '8.3'
10+
PHP_VERSION: '8.5'
1111

1212
jobs:
13+
build:
14+
name: Build
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v6
20+
21+
- name: Configure PHP
22+
uses: shivammathur/setup-php@v2
23+
with:
24+
php-version: ${{ env.PHP_VERSION }}
25+
extensions: bcmath
26+
tools: composer:2
27+
28+
- name: Validate composer.json
29+
run: composer validate --no-interaction
30+
31+
- name: Install dependencies
32+
run: composer install --no-progress --optimize-autoloader --prefer-dist --no-interaction
33+
34+
- name: Upload vendor and composer.lock as artifact
35+
uses: actions/upload-artifact@v6
36+
with:
37+
name: vendor-artifact
38+
path: |
39+
vendor
40+
composer.lock
41+
1342
auto-review:
1443
name: Auto review
1544
runs-on: ubuntu-latest
45+
needs: build
1646

1747
steps:
1848
- name: Checkout
@@ -22,28 +52,39 @@ jobs:
2252
uses: shivammathur/setup-php@v2
2353
with:
2454
php-version: ${{ env.PHP_VERSION }}
55+
extensions: bcmath
56+
tools: composer:2
2557

26-
- name: Install dependencies
27-
run: composer update --no-progress --optimize-autoloader
58+
- name: Download vendor artifact from build
59+
uses: actions/download-artifact@v7
60+
with:
61+
name: vendor-artifact
62+
path: .
2863

2964
- name: Run review
3065
run: composer review
3166

3267
tests:
3368
name: Tests
3469
runs-on: ubuntu-latest
70+
needs: auto-review
3571

3672
steps:
3773
- name: Checkout
3874
uses: actions/checkout@v6
3975

40-
- name: Use PHP ${{ env.PHP_VERSION }}
76+
- name: Configure PHP
4177
uses: shivammathur/setup-php@v2
4278
with:
4379
php-version: ${{ env.PHP_VERSION }}
80+
extensions: bcmath
81+
tools: composer:2
4482

45-
- name: Install dependencies
46-
run: composer update --no-progress --optimize-autoloader
83+
- name: Download vendor artifact from build
84+
uses: actions/download-artifact@v7
85+
with:
86+
name: vendor-artifact
87+
path: .
4788

4889
- name: Run tests
4990
run: composer tests

.gitignore

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
.idea
22

3-
/vendor/
4-
/report
5-
*.lock
3+
vendor
4+
report
65
.phpunit.*
6+
7+
*.lock

Makefile

Lines changed: 45 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,68 @@
1-
ifeq ($(OS),Windows_NT)
2-
PWD := $(shell cd)
3-
else
4-
PWD := $(shell pwd -L)
5-
endif
6-
1+
PWD := $(CURDIR)
72
ARCH := $(shell uname -m)
83
PLATFORM :=
94

105
ifeq ($(ARCH),arm64)
116
PLATFORM := --platform=linux/amd64
127
endif
138

14-
DOCKER_RUN = docker run ${PLATFORM} --rm -it --net=host -v ${PWD}:/app -w /app gustavofreze/php:8.3
9+
DOCKER_RUN = docker run ${PLATFORM} --rm -it --net=host -v ${PWD}:/app -w /app gustavofreze/php:8.5-alpine
1510

16-
.PHONY: configure test test-file test-no-coverage review show-reports clean
11+
RESET := \033[0m
12+
GREEN := \033[0;32m
13+
YELLOW := \033[0;33m
1714

18-
configure:
15+
.DEFAULT_GOAL := help
16+
17+
.PHONY: configure
18+
configure: ## Configure development environment
1919
@${DOCKER_RUN} composer update --optimize-autoloader
2020

21-
test:
21+
.PHONY: test
22+
test: ## Run all tests with coverage
2223
@${DOCKER_RUN} composer tests
2324

24-
test-file:
25+
.PHONY: test-file
26+
test-file: ## Run tests for a specific file (usage: make test-file FILE=path/to/file)
2527
@${DOCKER_RUN} composer test-file ${FILE}
2628

27-
test-no-coverage:
29+
.PHONY: test-no-coverage
30+
test-no-coverage: ## Run all tests without coverage
2831
@${DOCKER_RUN} composer tests-no-coverage
2932

30-
review:
33+
.PHONY: review
34+
review: ## Run static code analysis
3135
@${DOCKER_RUN} composer review
3236

33-
show-reports:
37+
.PHONY: show-reports
38+
show-reports: ## Open static analysis reports (e.g., coverage, lints) in the browser
3439
@sensible-browser report/coverage/coverage-html/index.html report/coverage/mutation-report.html
3540

36-
clean:
41+
.PHONY: clean
42+
clean: ## Remove dependencies and generated artifacts
3743
@sudo chown -R ${USER}:${USER} ${PWD}
3844
@rm -rf report vendor .phpunit.cache *.lock
45+
46+
.PHONY: help
47+
help: ## Display this help message
48+
@echo "Usage: make [target]"
49+
@echo ""
50+
@echo "$$(printf '$(GREEN)')Setup$$(printf '$(RESET)')"
51+
@grep -E '^(configure):.*?## .*$$' $(MAKEFILE_LIST) \
52+
| awk 'BEGIN {FS = ":.*? ## "}; {printf "$(YELLOW)%-25s$(RESET) %s\n", $$1, $$2}'
53+
@echo ""
54+
@echo "$$(printf '$(GREEN)')Testing$$(printf '$(RESET)')"
55+
@grep -E '^(test|test-file|test-no-coverage):.*?## .*$$' $(MAKEFILE_LIST) \
56+
| awk 'BEGIN {FS = ":.*?## "}; {printf "$(YELLOW)%-25s$(RESET) %s\n", $$1, $$2}'
57+
@echo ""
58+
@echo "$$(printf '$(GREEN)')Quality$$(printf '$(RESET)')"
59+
@grep -E '^(review):.*?## .*$$' $(MAKEFILE_LIST) \
60+
| awk 'BEGIN {FS = ":.*?## "}; {printf "$(YELLOW)%-25s$(RESET) %s\n", $$1, $$2}'
61+
@echo ""
62+
@echo "$$(printf '$(GREEN)')Reports$$(printf '$(RESET)')"
63+
@grep -E '^(show-reports):.*?## .*$$' $(MAKEFILE_LIST) \
64+
| awk 'BEGIN {FS = ":.*?## "}; {printf "$(YELLOW)%-25s$(RESET) %s\n", $$1, $$2}'
65+
@echo ""
66+
@echo "$$(printf '$(GREEN)')Cleanup$$(printf '$(RESET)')"
67+
@grep -E '^(clean):.*?## .*$$' $(MAKEFILE_LIST) \
68+
| awk 'BEGIN {FS = ":.*?## "}; {printf "$(YELLOW)%-25s$(RESET) %s\n", $$1, $$2}'

composer.json

Lines changed: 17 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -45,35 +45,32 @@
4545
}
4646
},
4747
"require": {
48-
"php": "^8.3",
49-
"psr/http-message": "^1.1",
50-
"tiny-blocks/mapper": "^1",
51-
"ext-mbstring": "*"
48+
"php": "^8.5",
49+
"ext-mbstring": "*",
50+
"psr/http-message": "^2.0",
51+
"tiny-blocks/mapper": "^1.4"
5252
},
5353
"require-dev": {
54-
"slim/psr7": "^1",
55-
"slim/slim": "^4",
56-
"phpmd/phpmd": "^2.15",
57-
"phpstan/phpstan": "^1",
58-
"phpunit/phpunit": "^11",
59-
"infection/infection": "^0",
60-
"squizlabs/php_codesniffer": "^3.11",
61-
"laminas/laminas-httphandlerrunner": "^2"
54+
"slim/psr7": "^1.8",
55+
"slim/slim": "^4.15",
56+
"phpunit/phpunit": "^11.5",
57+
"phpstan/phpstan": "^2.1",
58+
"infection/infection": "^0.32",
59+
"squizlabs/php_codesniffer": "^4.0",
60+
"laminas/laminas-httphandlerrunner": "^2.13"
6261
},
6362
"suggest": {
6463
"ext-mbstring": "Provides multibyte-specific string functions that help us deal with multibyte encodings in PHP."
6564
},
6665
"scripts": {
67-
"test": "phpunit --configuration phpunit.xml tests",
68-
"phpcs": "phpcs --standard=PSR12 --extensions=php ./src",
69-
"phpmd": "phpmd ./src text phpmd.xml --suffixes php --ignore-violations-on-exit",
70-
"phpstan": "phpstan analyse -c phpstan.neon.dist --quiet --no-progress",
71-
"test-file": "phpunit --configuration phpunit.xml --no-coverage --filter",
72-
"mutation-test": "infection --threads=max --logger-html=report/coverage/mutation-report.html --coverage=report/coverage",
73-
"test-no-coverage": "phpunit --configuration phpunit.xml --no-coverage tests",
66+
"test": "php -d memory_limit=2G ./vendor/bin/phpunit --configuration phpunit.xml tests",
67+
"phpcs": "php ./vendor/bin/phpcs --standard=PSR12 --extensions=php ./src",
68+
"phpstan": "php ./vendor/bin/phpstan analyse -c phpstan.neon.dist --quiet --no-progress",
69+
"test-file": "php ./vendor/bin/phpunit --configuration phpunit.xml --no-coverage --filter",
70+
"mutation-test": "php ./vendor/bin/infection --threads=max --logger-html=report/coverage/mutation-report.html --coverage=report/coverage",
71+
"test-no-coverage": "php ./vendor/bin/phpunit --configuration phpunit.xml --no-coverage tests",
7472
"review": [
7573
"@phpcs",
76-
"@phpmd",
7774
"@phpstan"
7875
],
7976
"tests": [

phpmd.xml

Lines changed: 0 additions & 56 deletions
This file was deleted.

0 commit comments

Comments
 (0)