Skip to content

Commit

Permalink
Next Gen
Browse files Browse the repository at this point in the history
  • Loading branch information
WyriHaximus committed Mar 23, 2024
1 parent aa63de9 commit f2d9622
Show file tree
Hide file tree
Showing 22 changed files with 10,745 additions and 110 deletions.
6 changes: 6 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,11 @@ trim_trailing_whitespace = true
[*.json]
indent_size = 2

[*.yml]
indent_size = 2

[*.yaml]
indent_size = 2

[Makefile]
indent_style = tab
18 changes: 10 additions & 8 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# Ignoring files for distribution archieves
examples/ export-ignore
.github/ export-ignore
etc/ export-ignore
tests/ export-ignore
.dunitconfig export-ignore
.travis.yml export-ignore
.gitignore export-ignore
var/ export-ignore
.devcontainer.json export-ignore
.editorconfig export-ignore
.gitattributes export-ignore
.scrutinizer.yml export-ignore
.styleci.yml export-ignore
appveyor.yml export-ignore
phpunit.xml.dist export-ignore
.gitignore export-ignore
CONTRIBUTING.md export-ignore
infection.json.dist export-ignore
Makefile export-ignore
README.md export-ignore
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @WyriHaximus
1 change: 1 addition & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
github: WyriHaximus
60 changes: 60 additions & 0 deletions .github/boring-cyborg.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
labelPRBasedOnFilePath:
"Documentation 📚":
- README.md
- CONTRIBUTING.md
"Dependencies 📦":
- Dockerfile*
- composer.*
- package.json
- package-lock.json
- yarn.lock
"Docker 🐳":
- Dockerfile*
- .docker/**/*
"Image 🖼":
- "**/*.gif"
- "**/*.jpg"
- "**/*.jpeg"
- "**/*.png"
- "**/*.webp"
"CSS 👩‍🎨":
- "**/*.css"
"HTML 👷‍♀️":
- "**/*.htm"
- "**/*.html"
"NEON 🦹‍♂️":
- "**/*.neon"
"MarkDown 📝":
- "**/*.md"
"YAML 🍄":
- "**/*.yml"
- "**/*.yaml"
"JSON 👨‍💼":
- "**/*.json"
"Go 🐹":
- "**/*.go"
"JavaScript 🦏":
- "**/*.js"
- package.json
- package-lock.json
- yarn.lock
"PHP 🐘":
- "**/*.php"
- composer.*
"Configuration ⚙":
- .github/*
"CI 🚧":
- .github/workflows/*
- .scrutinizer.yml
"Templates 🌲":
- "**/*.twig"
- "**/*.tpl"
"Helm ☸":
- .helm/**/*
"Tests 🧪":
- tests/**/*
"Source 🔮":
- src/**/*

labelerFlags:
labelOnPRUpdates: true
6 changes: 6 additions & 0 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"github>WyriHaximus/renovate-config:php-package"
]
}
115 changes: 115 additions & 0 deletions .github/settings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
repository:
private: false
has_issues: true
has_wiki: false
has_downloads: true
default_branch: master
allow_squash_merge: false
allow_merge_commit: true
allow_rebase_merge: false

# Labels: define labels for Issues and Pull Requests
labels:
- name: "Dependencies 📦"
color: 0025ff
description: "Pull requests that update a dependency file"
- name: "Image 🖼"
color: 00ffff
- name: "HTML 👷‍♀️"
color: ffffff
- name: "CSS 👩‍🎨"
color: b3b3b3
- name: "JavaScript 🦏"
color: ffff00
- name: "Go 🐹"
color: 00ADD8
- name: "JSON 👨‍💼"
color: 00ADD8
- name: "NEON 🦹‍♂️"
color: CE3262
- name: "MarkDown 📝"
color: 000000
- name: "YAML 🍄"
color: ff1aff
- name: "Templates 🌲"
color: 009933
- name: "Helm ☸"
color: 091C84
- name: "Tests 🧪"
color: ffe6e6
- name: "Source 🔮"
color: e6ffe6
- name: "Configuration ⚙"
color: b3b3cc
- name: "PHP 🐘"
color: 8892BF
description: "Hypertext Pre Processor"
- name: "Docker 🐳"
color: 0db7ed
description: "Pull requests that relate to Docker"
- name: "CI 🚧"
color: ffff00
- name: "Feature 🏗"
color: 66ff99
- name: "Documentation 📚"
color: 6666ff
- name: "Security 🕵️‍♀️"
color: ff0000
- name: "Hacktoberfest 🎃"
color: 152347
- name: "Bug 🐞"
color: d73a4a
description: "Something isn't working"
oldname: bug
- name: "Duplicate ♊"
color: cfd3d7
description: "This issue or pull request already exists"
oldname: duplicate
- name: "Enhancement ✨"
color: a2eeef
description: "New feature or request"
oldname: enhancement
- name: "Good First Issue"
color: 7057ff
description: "Good for newcomers"
oldname: "good first issue"
- name: "Help Wanted"
color: 008672
description: "Extra attention is needed"
oldname: "help wanted"
- name: Invalid
color: e4e669
description: "This doesn't seem right"
oldname: invalid
- name: "Question ❓"
color: d876e3
description: "Further information is requested"
oldname: question
- name: "Will not be fixed 🛑"
color: ffffff
description: "This will not be worked on"
oldname: wontfix
- name: "Sponsor Request ❤️"
color: fedbf0
description: "Issue/PR opened by sponsor"

branches:
- name: master
protection:
required_pull_request_reviews:
required_approving_review_count: 1
dismiss_stale_reviews: true
require_code_owner_reviews: true
# Required. Require status checks to pass before merging. Set to null to disable
required_status_checks:
# Required. Require branches to be up to date before merging.
strict: true
# Required. The list of status checks to require in order to merge into this branch
contexts: []
# Required. Enforce all configured restrictions for administrators. Set to true to enforce required status checks for repository administrators. Set to null to disable.
enforce_admins: true
# Required. Restrict who can push to this branch. Team and user restrictions are only available for organization-owned repositories. Set to null to disable.
restrictions:
apps: []
users: []
teams: []
20 changes: 20 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Continuous Integration
on:
push:
branches:
- 'main'
- 'master'
- 'refs/heads/v[0-9]+.[0-9]+.[0-9]+'
pull_request:
## This workflow needs the `pull-request` permissions to work for the package diffing
## Refs: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#permissions
permissions:
pull-requests: write
contents: read
jobs:
ci:
name: Continuous Integration
uses: WyriHaximus/github-workflows/.github/workflows/package.yaml@main
with:
env: "{\"REDIS_DSN\":\"redis://redis:6379/6\"}"
services: "{\"redis\":{\"image\":\"redis\",\"options\":\"--health-cmd \\\"redis-cli ping\\\" --health-interval 1s --health-timeout 5s --health-retries 50\"}}"
23 changes: 23 additions & 0 deletions .github/workflows/release-managment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Release Management
on:
pull_request:
types:
- opened
- labeled
- unlabeled
- synchronize
- reopened
milestone:
types:
- closed
permissions:
contents: write
issues: write
pull-requests: write
jobs:
release-managment:
name: Create Release
uses: WyriHaximus/github-workflows/.github/workflows/package-release-managment.yaml@main
with:
milestone: ${{ github.event.milestone.title }}
description: ${{ github.event.milestone.title }}
7 changes: 3 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
build
vendor
.env
/src/Generated/
var/
vendor/
etc/qa/.phpunit.result.cache
84 changes: 54 additions & 30 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,43 +3,67 @@ SHELL=bash

.PHONY: *

#ifneq ("$(wildcard /.dockerenv)","")
DOCKER_RUN=
#else
# DOCKER_RUN=docker run --rm -it \
# -v `pwd`:`pwd` \
# -w `pwd` \
# "wyrihaximusnet/php:7.4-zts-alpine3.11-dev"
#endif

all: lint cs-fix cs stan psalm unit infection composer-require-checker composer-unused

lint:
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/.$$//')
SLIM_DOCKER_IMAGE=$(shell php -r 'echo count(array_intersect(["gd", "vips"], explode(",", "${COMPOSER_SHOW_EXTENSION_LIST}"))) > 0 ? "" : "-slim";')
COMPOSER_CACHE_DIR=$(shell composer config --global cache-dir -q || echo ${HOME}/.composer-php/cache)
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]);")
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)

ifneq ("$(wildcard /.you-are-in-a-wyrihaximus.net-php-docker-image)","")
IN_DOCKER=TRUE
else
IN_DOCKER=FALSE
endif

ifeq ("$(IN_DOCKER)","TRUE")
DOCKER_RUN:=
else
DOCKER_RUN:=docker run --rm -it \
-v "`pwd`:`pwd`" \
-v "${COMPOSER_CACHE_DIR}:${COMPOSER_CONTAINER_CACHE_DIR}" \
-w "`pwd`" \
"ghcr.io/wyrihaximusnet/php:${PHP_VERSION}-nts-alpine${SLIM_DOCKER_IMAGE}-dev"
endif

ifneq (,$(findstring icrosoft,$(shell cat /proc/version)))
THREADS=1
else
THREADS=$(shell nproc)
endif

all: ## Runs everything ###
@grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | grep -v "###" | awk 'BEGIN {FS = ":.*?## "}; {printf "%s\n", $$1}' | xargs --open-tty $(MAKE)

syntax-php: ## Lint PHP syntax
$(DOCKER_RUN) vendor/bin/parallel-lint --exclude vendor .

cs:
$(DOCKER_RUN) vendor/bin/phpcs --parallel=$(nproc)
cs-fix: ## Fix any automatically fixable code style issues
$(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

cs: ## Check the code for code style issues
$(DOCKER_RUN) vendor/bin/phpcs --parallel=$(THREADS) --cache=./var/.phpcs.cache.json --standard=./etc/qa/phpcs.xml

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

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

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

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

unit-ci: unit
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
backward-compatibility-check-raw: ## Check code for backwards incompatible changes, doesn't ignore the failure ###
$(DOCKER_RUN) vendor/bin/roave-backward-compatibility-check

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

composer-require-checker:
$(DOCKER_RUN) vendor/bin/composer-require-checker --ignore-parse-errors --ansi -vvv --config-file=composer-require-checker.json
task-list-ci: ## CI: Generate a JSON array of jobs to run, matches the commands run when running `make (|all)` ###
@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]'

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

0 comments on commit f2d9622

Please sign in to comment.