Skip to content

Commit a8f5071

Browse files
authored
Release/2.3.0 (#15)
1 parent e9d28a2 commit a8f5071

File tree

9 files changed

+175
-99
lines changed

9 files changed

+175
-99
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/dependabot.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
version: 2
2+
3+
updates:
4+
- package-ecosystem: "composer"
5+
directory: "/"
6+
schedule:
7+
interval: "weekly"
8+
open-pull-requests-limit: 0
9+
labels:
10+
- "php"
11+
- "security"
12+
- "dependencies"
13+
groups:
14+
php-security:
15+
applies-to: security-updates
16+
patterns:
17+
- "*"
18+
19+
- package-ecosystem: "github-actions"
20+
directory: "/"
21+
schedule:
22+
interval: "weekly"
23+
commit-message:
24+
prefix: "build"
25+
labels:
26+
- "dependencies"
27+
- "github-actions"
28+
groups:
29+
github-actions:
30+
patterns:
31+
- "*"

.github/workflows/auto-assign.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- name: Assign issues and pull requests
1919
uses: gustavofreze/auto-assign@2.0.0
2020
with:
21-
assignees: '${{ secrets.ASSIGNEES }}'
21+
assignees: '${{ vars.ASSIGNEES }}'
2222
github_token: '${{ secrets.GITHUB_TOKEN }}'
2323
allow_self_assign: 'true'
2424
allow_no_assignees: 'true'

.github/workflows/ci.yml

Lines changed: 49 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,43 +7,84 @@ 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
19-
uses: actions/checkout@v4
49+
uses: actions/checkout@v6
2050

2151
- name: Configure PHP
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
38-
uses: actions/checkout@v4
74+
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

.github/workflows/codeql.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Security checks
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
schedule:
9+
- cron: "0 0 * * *"
10+
11+
permissions:
12+
actions: read
13+
contents: read
14+
security-events: write
15+
16+
jobs:
17+
analyze:
18+
name: Analyze
19+
runs-on: ubuntu-latest
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
language: [ "actions" ]
24+
25+
steps:
26+
- name: Checkout repository
27+
uses: actions/checkout@v6
28+
29+
- name: Initialize CodeQL
30+
uses: github/codeql-action/init@v4
31+
with:
32+
languages: ${{ matrix.language }}
33+
34+
- name: Perform CodeQL analysis
35+
uses: github/codeql-action/analyze@v4

.gitignore

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.idea
2+
23
vendor
34
report
4-
.phpunit.cache
5+
.phpunit.*
56

6-
composer.lock
7-
.phpunit.result.cache
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: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -42,26 +42,23 @@
4242
}
4343
},
4444
"require": {
45-
"php": "^8.3"
45+
"php": "^8.5"
4646
},
4747
"require-dev": {
48-
"phpmd/phpmd": "^2.15",
49-
"phpstan/phpstan": "^1",
50-
"phpunit/phpunit": "^11",
51-
"infection/infection": "^0",
52-
"squizlabs/php_codesniffer": "^3.11"
48+
"phpunit/phpunit": "^11.5",
49+
"phpstan/phpstan": "^2.1",
50+
"infection/infection": "^0.32",
51+
"squizlabs/php_codesniffer": "^4.0"
5352
},
5453
"scripts": {
55-
"test": "phpunit --configuration phpunit.xml tests",
56-
"phpcs": "phpcs --standard=PSR12 --extensions=php ./src",
57-
"phpmd": "phpmd ./src text phpmd.xml --suffixes php --ignore-violations-on-exit",
58-
"phpstan": "phpstan analyse -c phpstan.neon.dist --quiet --no-progress",
59-
"test-file": "phpunit --configuration phpunit.xml --no-coverage --filter",
60-
"mutation-test": "infection --only-covered --threads=max --logger-html=report/coverage/mutation-report.html --coverage=report/coverage",
61-
"test-no-coverage": "phpunit --configuration phpunit.xml --no-coverage tests",
54+
"test": "php -d memory_limit=2G ./vendor/bin/phpunit --configuration phpunit.xml tests",
55+
"phpcs": "php ./vendor/bin/phpcs --standard=PSR12 --extensions=php ./src",
56+
"phpstan": "php ./vendor/bin/phpstan analyse -c phpstan.neon.dist --quiet --no-progress",
57+
"test-file": "php ./vendor/bin/phpunit --configuration phpunit.xml --no-coverage --filter",
58+
"mutation-test": "php ./vendor/bin/infection --threads=max --logger-html=report/coverage/mutation-report.html --coverage=report/coverage",
59+
"test-no-coverage": "php ./vendor/bin/phpunit --configuration phpunit.xml --no-coverage tests",
6260
"review": [
6361
"@phpcs",
64-
"@phpmd",
6562
"@phpstan"
6663
],
6764
"tests": [

phpmd.xml

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

0 commit comments

Comments
 (0)