Skip to content

Commit 82b9b1d

Browse files
authored
Merge pull request #2 from MammatusPHP/next-gen
Next Gen
2 parents aa63de9 + f2d9622 commit 82b9b1d

22 files changed

+10745
-110
lines changed

.editorconfig

+6
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,11 @@ trim_trailing_whitespace = true
1010
[*.json]
1111
indent_size = 2
1212

13+
[*.yml]
14+
indent_size = 2
15+
16+
[*.yaml]
17+
indent_size = 2
18+
1319
[Makefile]
1420
indent_style = tab

.gitattributes

+10-8
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
# Ignoring files for distribution archieves
2-
examples/ export-ignore
2+
.github/ export-ignore
3+
etc/ export-ignore
34
tests/ export-ignore
4-
.dunitconfig export-ignore
5-
.travis.yml export-ignore
6-
.gitignore export-ignore
5+
var/ export-ignore
6+
.devcontainer.json export-ignore
7+
.editorconfig export-ignore
78
.gitattributes export-ignore
8-
.scrutinizer.yml export-ignore
9-
.styleci.yml export-ignore
10-
appveyor.yml export-ignore
11-
phpunit.xml.dist export-ignore
9+
.gitignore export-ignore
10+
CONTRIBUTING.md export-ignore
11+
infection.json.dist export-ignore
12+
Makefile export-ignore
13+
README.md export-ignore

.github/CODEOWNERS

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* @WyriHaximus

.github/FUNDING.yml

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
github: WyriHaximus

.github/boring-cyborg.yml

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
labelPRBasedOnFilePath:
2+
"Documentation 📚":
3+
- README.md
4+
- CONTRIBUTING.md
5+
"Dependencies 📦":
6+
- Dockerfile*
7+
- composer.*
8+
- package.json
9+
- package-lock.json
10+
- yarn.lock
11+
"Docker 🐳":
12+
- Dockerfile*
13+
- .docker/**/*
14+
"Image 🖼":
15+
- "**/*.gif"
16+
- "**/*.jpg"
17+
- "**/*.jpeg"
18+
- "**/*.png"
19+
- "**/*.webp"
20+
"CSS 👩‍🎨":
21+
- "**/*.css"
22+
"HTML 👷‍♀️":
23+
- "**/*.htm"
24+
- "**/*.html"
25+
"NEON 🦹‍♂️":
26+
- "**/*.neon"
27+
"MarkDown 📝":
28+
- "**/*.md"
29+
"YAML 🍄":
30+
- "**/*.yml"
31+
- "**/*.yaml"
32+
"JSON 👨‍💼":
33+
- "**/*.json"
34+
"Go 🐹":
35+
- "**/*.go"
36+
"JavaScript 🦏":
37+
- "**/*.js"
38+
- package.json
39+
- package-lock.json
40+
- yarn.lock
41+
"PHP 🐘":
42+
- "**/*.php"
43+
- composer.*
44+
"Configuration ⚙":
45+
- .github/*
46+
"CI 🚧":
47+
- .github/workflows/*
48+
- .scrutinizer.yml
49+
"Templates 🌲":
50+
- "**/*.twig"
51+
- "**/*.tpl"
52+
"Helm ☸":
53+
- .helm/**/*
54+
"Tests 🧪":
55+
- tests/**/*
56+
"Source 🔮":
57+
- src/**/*
58+
59+
labelerFlags:
60+
labelOnPRUpdates: true

.github/renovate.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3+
"extends": [
4+
"github>WyriHaximus/renovate-config:php-package"
5+
]
6+
}

.github/settings.yml

+115
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
repository:
2+
private: false
3+
has_issues: true
4+
has_wiki: false
5+
has_downloads: true
6+
default_branch: master
7+
allow_squash_merge: false
8+
allow_merge_commit: true
9+
allow_rebase_merge: false
10+
11+
# Labels: define labels for Issues and Pull Requests
12+
labels:
13+
- name: "Dependencies 📦"
14+
color: 0025ff
15+
description: "Pull requests that update a dependency file"
16+
- name: "Image 🖼"
17+
color: 00ffff
18+
- name: "HTML 👷‍♀️"
19+
color: ffffff
20+
- name: "CSS 👩‍🎨"
21+
color: b3b3b3
22+
- name: "JavaScript 🦏"
23+
color: ffff00
24+
- name: "Go 🐹"
25+
color: 00ADD8
26+
- name: "JSON 👨‍💼"
27+
color: 00ADD8
28+
- name: "NEON 🦹‍♂️"
29+
color: CE3262
30+
- name: "MarkDown 📝"
31+
color: 000000
32+
- name: "YAML 🍄"
33+
color: ff1aff
34+
- name: "Templates 🌲"
35+
color: 009933
36+
- name: "Helm ☸"
37+
color: 091C84
38+
- name: "Tests 🧪"
39+
color: ffe6e6
40+
- name: "Source 🔮"
41+
color: e6ffe6
42+
- name: "Configuration ⚙"
43+
color: b3b3cc
44+
- name: "PHP 🐘"
45+
color: 8892BF
46+
description: "Hypertext Pre Processor"
47+
- name: "Docker 🐳"
48+
color: 0db7ed
49+
description: "Pull requests that relate to Docker"
50+
- name: "CI 🚧"
51+
color: ffff00
52+
- name: "Feature 🏗"
53+
color: 66ff99
54+
- name: "Documentation 📚"
55+
color: 6666ff
56+
- name: "Security 🕵️‍♀️"
57+
color: ff0000
58+
- name: "Hacktoberfest 🎃"
59+
color: 152347
60+
- name: "Bug 🐞"
61+
color: d73a4a
62+
description: "Something isn't working"
63+
oldname: bug
64+
- name: "Duplicate ♊"
65+
color: cfd3d7
66+
description: "This issue or pull request already exists"
67+
oldname: duplicate
68+
- name: "Enhancement ✨"
69+
color: a2eeef
70+
description: "New feature or request"
71+
oldname: enhancement
72+
- name: "Good First Issue"
73+
color: 7057ff
74+
description: "Good for newcomers"
75+
oldname: "good first issue"
76+
- name: "Help Wanted"
77+
color: 008672
78+
description: "Extra attention is needed"
79+
oldname: "help wanted"
80+
- name: Invalid
81+
color: e4e669
82+
description: "This doesn't seem right"
83+
oldname: invalid
84+
- name: "Question ❓"
85+
color: d876e3
86+
description: "Further information is requested"
87+
oldname: question
88+
- name: "Will not be fixed 🛑"
89+
color: ffffff
90+
description: "This will not be worked on"
91+
oldname: wontfix
92+
- name: "Sponsor Request ❤️"
93+
color: fedbf0
94+
description: "Issue/PR opened by sponsor"
95+
96+
branches:
97+
- name: master
98+
protection:
99+
required_pull_request_reviews:
100+
required_approving_review_count: 1
101+
dismiss_stale_reviews: true
102+
require_code_owner_reviews: true
103+
# Required. Require status checks to pass before merging. Set to null to disable
104+
required_status_checks:
105+
# Required. Require branches to be up to date before merging.
106+
strict: true
107+
# Required. The list of status checks to require in order to merge into this branch
108+
contexts: []
109+
# Required. Enforce all configured restrictions for administrators. Set to true to enforce required status checks for repository administrators. Set to null to disable.
110+
enforce_admins: true
111+
# Required. Restrict who can push to this branch. Team and user restrictions are only available for organization-owned repositories. Set to null to disable.
112+
restrictions:
113+
apps: []
114+
users: []
115+
teams: []

.github/workflows/ci.yml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Continuous Integration
2+
on:
3+
push:
4+
branches:
5+
- 'main'
6+
- 'master'
7+
- 'refs/heads/v[0-9]+.[0-9]+.[0-9]+'
8+
pull_request:
9+
## This workflow needs the `pull-request` permissions to work for the package diffing
10+
## Refs: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#permissions
11+
permissions:
12+
pull-requests: write
13+
contents: read
14+
jobs:
15+
ci:
16+
name: Continuous Integration
17+
uses: WyriHaximus/github-workflows/.github/workflows/package.yaml@main
18+
with:
19+
env: "{\"REDIS_DSN\":\"redis://redis:6379/6\"}"
20+
services: "{\"redis\":{\"image\":\"redis\",\"options\":\"--health-cmd \\\"redis-cli ping\\\" --health-interval 1s --health-timeout 5s --health-retries 50\"}}"
+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Release Management
2+
on:
3+
pull_request:
4+
types:
5+
- opened
6+
- labeled
7+
- unlabeled
8+
- synchronize
9+
- reopened
10+
milestone:
11+
types:
12+
- closed
13+
permissions:
14+
contents: write
15+
issues: write
16+
pull-requests: write
17+
jobs:
18+
release-managment:
19+
name: Create Release
20+
uses: WyriHaximus/github-workflows/.github/workflows/package-release-managment.yaml@main
21+
with:
22+
milestone: ${{ github.event.milestone.title }}
23+
description: ${{ github.event.milestone.title }}

.gitignore

+3-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
build
2-
vendor
3-
.env
4-
/src/Generated/
1+
var/
2+
vendor/
3+
etc/qa/.phpunit.result.cache

Makefile

+54-30
Original file line numberDiff line numberDiff line change
@@ -3,43 +3,67 @@ SHELL=bash
33

44
.PHONY: *
55

6-
#ifneq ("$(wildcard /.dockerenv)","")
7-
DOCKER_RUN=
8-
#else
9-
# DOCKER_RUN=docker run --rm -it \
10-
# -v `pwd`:`pwd` \
11-
# -w `pwd` \
12-
# "wyrihaximusnet/php:7.4-zts-alpine3.11-dev"
13-
#endif
14-
15-
all: lint cs-fix cs stan psalm unit infection composer-require-checker composer-unused
16-
17-
lint:
6+
COMPOSER_SHOW_EXTENSION_LIST=$(shell composer show -t | grep -o "\-\-\(ext-\).\+" | sort | uniq | cut -d- -f4- | tr -d '\n' | grep . | sed '/^$$/d' | xargs | sed -e 's/ /, /g' | tr -cd '[:alnum:],' | sed 's/.$$//')
7+
SLIM_DOCKER_IMAGE=$(shell php -r 'echo count(array_intersect(["gd", "vips"], explode(",", "${COMPOSER_SHOW_EXTENSION_LIST}"))) > 0 ? "" : "-slim";')
8+
COMPOSER_CACHE_DIR=$(shell composer config --global cache-dir -q || echo ${HOME}/.composer-php/cache)
9+
PHP_VERSION:=$(shell docker run --rm -v "`pwd`:`pwd`" jess/jq jq -r -c '.config.platform.php' "`pwd`/composer.json" | php -r "echo str_replace('|', '.', explode('.', implode('|', explode('.', stream_get_contents(STDIN), 2)), 2)[0]);")
10+
COMPOSER_CONTAINER_CACHE_DIR=$(shell docker run --rm -it "ghcr.io/wyrihaximusnet/php:${PHP_VERSION}-nts-alpine${SLIM_DOCKER_IMAGE}-dev" composer config --global cache-dir -q || echo ${HOME}/.composer-php/cache)
11+
12+
ifneq ("$(wildcard /.you-are-in-a-wyrihaximus.net-php-docker-image)","")
13+
IN_DOCKER=TRUE
14+
else
15+
IN_DOCKER=FALSE
16+
endif
17+
18+
ifeq ("$(IN_DOCKER)","TRUE")
19+
DOCKER_RUN:=
20+
else
21+
DOCKER_RUN:=docker run --rm -it \
22+
-v "`pwd`:`pwd`" \
23+
-v "${COMPOSER_CACHE_DIR}:${COMPOSER_CONTAINER_CACHE_DIR}" \
24+
-w "`pwd`" \
25+
"ghcr.io/wyrihaximusnet/php:${PHP_VERSION}-nts-alpine${SLIM_DOCKER_IMAGE}-dev"
26+
endif
27+
28+
ifneq (,$(findstring icrosoft,$(shell cat /proc/version)))
29+
THREADS=1
30+
else
31+
THREADS=$(shell nproc)
32+
endif
33+
34+
all: ## Runs everything ###
35+
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | grep -v "###" | awk 'BEGIN {FS = ":.*?## "}; {printf "%s\n", $$1}' | xargs --open-tty $(MAKE)
36+
37+
syntax-php: ## Lint PHP syntax
1838
$(DOCKER_RUN) vendor/bin/parallel-lint --exclude vendor .
1939

20-
cs:
21-
$(DOCKER_RUN) vendor/bin/phpcs --parallel=$(nproc)
40+
cs-fix: ## Fix any automatically fixable code style issues
41+
$(DOCKER_RUN) vendor/bin/phpcbf --parallel=$(THREADS) --cache=./var/.phpcs.cache.json --standard=./etc/qa/phpcs.xml || $(DOCKER_RUN) vendor/bin/phpcbf --parallel=$(THREADS) --cache=./var/.phpcs.cache.json --standard=./etc/qa/phpcs.xml || $(DOCKER_RUN) vendor/bin/phpcbf --parallel=$(THREADS) --cache=./var/.phpcs.cache.json --standard=./etc/qa/phpcs.xml -vvvv
42+
43+
cs: ## Check the code for code style issues
44+
$(DOCKER_RUN) vendor/bin/phpcs --parallel=$(THREADS) --cache=./var/.phpcs.cache.json --standard=./etc/qa/phpcs.xml
2245

23-
cs-fix:
24-
$(DOCKER_RUN) vendor/bin/phpcbf --parallel=$(nproc)
46+
stan: ## Run static analysis (PHPStan)
47+
$(DOCKER_RUN) vendor/bin/phpstan analyse src --ansi -c ./etc/qa/phpstan.neon
2548

26-
stan:
27-
$(DOCKER_RUN) vendor/bin/phpstan analyse src tests --level max --ansi -c phpstan.neon
49+
psalm: ## Run static analysis (Psalm)
50+
$(DOCKER_RUN) vendor/bin/psalm --threads=$(THREADS) --shepherd --stats --config=./etc/qa/psalm.xml
2851

29-
psalm:
30-
$(DOCKER_RUN) vendor/bin/psalm --threads=$(nproc) --shepherd --stats
52+
composer-install: ## Install dependencies
53+
$(DOCKER_RUN) composer install --no-progress --ansi --no-interaction --prefer-dist -o
3154

32-
unit:
33-
$(DOCKER_RUN) vendor/bin/phpunit --colors=always -c phpunit.xml.dist --coverage-text --coverage-html covHtml --coverage-clover ./build/logs/clover.xml
55+
backward-compatibility-check: ## Check code for backwards incompatible changes
56+
$(MAKE) backward-compatibility-check-raw || true
3457

35-
unit-ci: unit
36-
if [ -f ./build/logs/clover.xml ]; then wget https://scrutinizer-ci.com/ocular.phar && sleep 3 && php ocular.phar code-coverage:upload --format=php-clover ./build/logs/clover.xml; fi
58+
backward-compatibility-check-raw: ## Check code for backwards incompatible changes, doesn't ignore the failure ###
59+
$(DOCKER_RUN) vendor/bin/roave-backward-compatibility-check
3760

38-
infection:
39-
$(DOCKER_RUN) vendor/bin/infection --ansi --min-msi=100 --min-covered-msi=100 --threads=$(nproc)
61+
shell: ## Provides Shell access in the expected environment ###
62+
$(DOCKER_RUN) ash
4063

41-
composer-require-checker:
42-
$(DOCKER_RUN) vendor/bin/composer-require-checker --ignore-parse-errors --ansi -vvv --config-file=composer-require-checker.json
64+
task-list-ci: ## CI: Generate a JSON array of jobs to run, matches the commands run when running `make (|all)` ###
65+
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | grep -v "###" | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "%s\n", $$1}' | jq --raw-input --slurp -c 'split("\n")| .[0:-1]'
4366

44-
composer-unused:
45-
$(DOCKER_RUN) composer unused --ansi
67+
help: ## Show this help ###
68+
@printf "\033[33mUsage:\033[0m\n make [target]\n\n\033[33mTargets:\033[0m\n"
69+
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[32m%-32s\033[0m %s\n", $$1, $$2}' | tr -d '#'

0 commit comments

Comments
 (0)