From 9f5641b9c7272b66d96cfb7b79ec4b6b5ade6c10 Mon Sep 17 00:00:00 2001 From: Cees-Jan Kiewiet Date: Fri, 19 Apr 2024 22:16:40 +0200 Subject: [PATCH] Initial code setup --- .editorconfig | 20 +++ .gitattributes | 14 ++ .github/CODEOWNERS | 1 + .github/FUNDING.yml | 1 + .github/boring-cyborg.yml | 60 +++++++++ .github/renovate.json | 6 + .github/settings.yml | 122 ++++++++++++++++++ .github/workflows/ci.yml | 17 +++ .github/workflows/release-managment.yaml | 26 ++++ .gitignore | 6 + CONTRIBUTING.md | 42 ++++++ LICENSE | 21 +++ Makefile | 90 +++++++++++++ bin/mammatus-helm-json | 19 +++ composer.json | 3 +- composer.lock | 83 +++++++++--- etc/ci/markdown-link-checker.json | 10 ++ .../115dde3bb86dc1db232dc6f47d909e89 | 1 + .../198f1b332569b5ca2a950de5748b3b80 | 1 + .../2e11549a624de3790cb85693dd1fff45 | 1 + .../80fb71734d8c153f4c4074ff5054ad74 | 1 + .../8492db70bba2ae303099122bbca38c9a | 1 + .../896626606d07aa9aabb35abc10197c79 | 1 + .../bf636324a07ef8e1956d58bf7f77c5dc | 1 + .../cc1878cf252cae3b0e05838039c01d66 | 1 + .../e02f76f6db345dda48ef583ec1ceb8d0 | 1 + .../f69c0eeba27642927e5355d97a31da91 | 1 + etc/qa/.phpunit.cache/test-results | 1 + etc/qa/composer-require-checker.json | 22 ++++ etc/qa/composer-unused.php | 13 ++ etc/qa/phpcs.xml | 13 ++ etc/qa/phpstan.neon | 11 ++ etc/qa/phpunit.xml | 16 +++ etc/qa/psalm.xml | 59 +++++++++ infection.json.dist | 65 ++++++++++ src/Helm.php | 34 +++++ src/Helm/Values.php | 14 ++ tests/Angry.php | 20 +++ tests/AppTest.php | 68 ++++++++++ tests/Sad.php | 9 ++ var/.gitkeep | 0 41 files changed, 879 insertions(+), 17 deletions(-) create mode 100644 .editorconfig create mode 100644 .gitattributes create mode 100644 .github/CODEOWNERS create mode 100644 .github/FUNDING.yml create mode 100644 .github/boring-cyborg.yml create mode 100644 .github/renovate.json create mode 100644 .github/settings.yml create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/release-managment.yaml create mode 100644 .gitignore create mode 100644 CONTRIBUTING.md create mode 100644 LICENSE create mode 100644 Makefile create mode 100755 bin/mammatus-helm-json create mode 100644 etc/ci/markdown-link-checker.json create mode 100644 etc/qa/.phpunit.cache/code-coverage/115dde3bb86dc1db232dc6f47d909e89 create mode 100644 etc/qa/.phpunit.cache/code-coverage/198f1b332569b5ca2a950de5748b3b80 create mode 100644 etc/qa/.phpunit.cache/code-coverage/2e11549a624de3790cb85693dd1fff45 create mode 100644 etc/qa/.phpunit.cache/code-coverage/80fb71734d8c153f4c4074ff5054ad74 create mode 100644 etc/qa/.phpunit.cache/code-coverage/8492db70bba2ae303099122bbca38c9a create mode 100644 etc/qa/.phpunit.cache/code-coverage/896626606d07aa9aabb35abc10197c79 create mode 100644 etc/qa/.phpunit.cache/code-coverage/bf636324a07ef8e1956d58bf7f77c5dc create mode 100644 etc/qa/.phpunit.cache/code-coverage/cc1878cf252cae3b0e05838039c01d66 create mode 100644 etc/qa/.phpunit.cache/code-coverage/e02f76f6db345dda48ef583ec1ceb8d0 create mode 100644 etc/qa/.phpunit.cache/code-coverage/f69c0eeba27642927e5355d97a31da91 create mode 100644 etc/qa/.phpunit.cache/test-results create mode 100644 etc/qa/composer-require-checker.json create mode 100644 etc/qa/composer-unused.php create mode 100644 etc/qa/phpcs.xml create mode 100644 etc/qa/phpstan.neon create mode 100644 etc/qa/phpunit.xml create mode 100644 etc/qa/psalm.xml create mode 100644 infection.json.dist create mode 100644 src/Helm.php create mode 100644 src/Helm/Values.php create mode 100644 tests/Angry.php create mode 100644 tests/AppTest.php create mode 100644 tests/Sad.php create mode 100644 var/.gitkeep diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..ddb9a84 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,20 @@ +root = true + +[*] +charset = utf-8 +indent_style = space +indent_size = 4 +insert_final_newline = true +trim_trailing_whitespace = true + +[*.json] +indent_size = 2 + +[*.yml] +indent_size = 2 + +[*.yaml] +indent_size = 2 + +[Makefile] +indent_style = tab diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..93d5b50 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,14 @@ +# Ignoring files for distribution archieves +.github/ export-ignore +etc/ci/ export-ignore +etc/qa/ export-ignore +tests/ export-ignore +var/ export-ignore +.devcontainer.json export-ignore +.editorconfig export-ignore +.gitattributes export-ignore +.gitignore export-ignore +CONTRIBUTING.md export-ignore +infection.json.dist export-ignore +Makefile export-ignore +README.md export-ignore diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..fbfd285 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @WyriHaximus diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..6396afc --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +github: WyriHaximus diff --git a/.github/boring-cyborg.yml b/.github/boring-cyborg.yml new file mode 100644 index 0000000..80bcb6b --- /dev/null +++ b/.github/boring-cyborg.yml @@ -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 diff --git a/.github/renovate.json b/.github/renovate.json new file mode 100644 index 0000000..0f9020c --- /dev/null +++ b/.github/renovate.json @@ -0,0 +1,6 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": [ + "github>WyriHaximus/renovate-config:php-package-dev" + ] +} diff --git a/.github/settings.yml b/.github/settings.yml new file mode 100644 index 0000000..f1701a8 --- /dev/null +++ b/.github/settings.yml @@ -0,0 +1,122 @@ +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: "Deprecations ๐Ÿ‘‹" + color: ff7700 + - name: "Dependabot ๐Ÿค–" + color: 0366d6 + - 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: [ + "Milestone Check", + "โœ”๏ธ" + ] + # 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: [] diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..cd15956 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,17 @@ +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 diff --git a/.github/workflows/release-managment.yaml b/.github/workflows/release-managment.yaml new file mode 100644 index 0000000..d125036 --- /dev/null +++ b/.github/workflows/release-managment.yaml @@ -0,0 +1,26 @@ +name: Release Management +on: + pull_request: + types: + - opened + - labeled + - unlabeled + - synchronize + - reopened + - milestoned + - demilestoned + - ready_for_review + 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 }} diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..59fb369 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +var/* +!var/.gitkeep +src/Generated/* +!src/Generated/.gitkeep +vendor/ +etc/qa/.phpunit.result.cache diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..b65f6fa --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,42 @@ +# Contributing + +Pull requests are highly appreciated. Here's a quick guide. + +Fork, then clone the repo: + + git clone git@github.com:your-username/json.git + +Set up your machine: + + composer install + +Make sure the tests pass: + + make unit + +Make sure the tests pass on all supported PHP versions (requires docker): + + make dunit + +Make your change. Add tests for your change. Make the tests pass: + + make dunit && make unit + +Before committing and submitting your pull request make sure it passes PSR2 coding style, unit tests pass and pass on all supported PHP versions: + + make contrib + +Push to your fork and [submit a pull request][pr]. + +[pr]: https://help.github.com/articles/creating-a-pull-request/ + +At this point you're waiting on me. I like to at least comment on pull requests +within a day or two. I may suggest some changes or improvements or alternatives. + +Some things that will increase the chance that your pull request is accepted: + +* Write tests. +* Follow PSR2 (travis will also check for this). +* Write a [good commit message][commit]. + +[commit]: http://chris.beams.io/posts/git-commit/ diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..15d7c7b --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2017 reactive-apps + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..10cc30d --- /dev/null +++ b/Makefile @@ -0,0 +1,90 @@ +# set all to phony +SHELL=bash + +.PHONY: * + +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";') +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]);") +CONTAINER_NAME=$(shell echo "ghcr.io/wyrihaximusnet/php:${PHP_VERSION}-nts-alpine${SLIM_DOCKER_IMAGE}-dev") +COMPOSER_CACHE_DIR=$(shell composer config --global cache-dir -q || echo ${HOME}/.composer-php/cache) +COMPOSER_CONTAINER_CACHE_DIR=$(shell docker run --rm -it ${CONTAINER_NAME} 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`" \ + ${CONTAINER_NAME} +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-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 + +stan: ## Run static analysis (PHPStan) + $(DOCKER_RUN) vendor/bin/phpstan analyse src tests --level max --ansi -c ./etc/qa/phpstan.neon + +unit-testing: ## Run tests + $(DOCKER_RUN) vendor/bin/phpunit --colors=always -c ./etc/qa/phpunit.xml --coverage-text --coverage-html ./var/tests-unit-coverage-html --coverage-clover ./var/tests-unit-clover-coverage.xml + $(DOCKER_RUN) test -n "$(COVERALLS_REPO_TOKEN)" && test -n "$(COVERALLS_RUN_LOCALLY)" && test -f ./var/tests-unit-clover-coverage.xml && vendor/bin/php-coveralls -v --coverage_clover ./build/logs/clover.xml --json_path ./var/tests-unit-clover-coverage-upload.json || true + +unit-testing-raw: ## Run tests #### + php vendor/phpunit/phpunit/phpunit --colors=always -c ./etc/qa/phpunit.xml --coverage-text --coverage-html ./var/tests-unit-coverage-html --coverage-clover ./var/tests-unit-clover-coverage.xml + test -n "$(COVERALLS_REPO_TOKEN)" && test -n "$(COVERALLS_RUN_LOCALLY)" && test -f ./var/tests-unit-clover-coverage.xml && ./vendor/bin/php-coveralls -v --coverage_clover ./build/logs/clover.xml --json_path ./var/tests-unit-clover-coverage-upload.json || true + +composer-require-checker: ## Ensure we require every package used in this package directly + $(DOCKER_RUN) vendor/bin/composer-require-checker --ignore-parse-errors --ansi -vvv --config-file=./etc/qa/composer-require-checker.json + +composer-unused: ## Ensure we don't require any package we don't use in this package directly + $(DOCKER_RUN) vendor/bin/composer-unused --ansi --configuration=./etc/qa/composer-unused.php + +composer-install: ## Install dependencies + $(DOCKER_RUN) composer install --no-progress --ansi --no-interaction --prefer-dist -o + +backward-compatibility-check: ## Check code for backwards incompatible changes + $(MAKE) backward-compatibility-check-raw || true + +backward-compatibility-check-raw: ## Check code for backwards incompatible changes, doesn't ignore the failure ### + $(DOCKER_RUN) vendor/bin/roave-backward-compatibility-check + +shell: ## Provides Shell access in the expected environment #### + $(DOCKER_RUN) bash + +install: ## Install dependencies #### + $(DOCKER_RUN) composer install + +update: ## Update dependencies #### + $(DOCKER_RUN) composer update -W + +outdated: ## Show outdated dependencies #### + $(DOCKER_RUN) composer outdated + +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]' + +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 '#' diff --git a/bin/mammatus-helm-json b/bin/mammatus-helm-json new file mode 100755 index 0000000..79ee474 --- /dev/null +++ b/bin/mammatus-helm-json @@ -0,0 +1,19 @@ +#!/usr/bin/php + ContainerFactory::create()->get(Helm::class)->json())()); +})(); diff --git a/composer.json b/composer.json index 8d9c916..9ff7365 100644 --- a/composer.json +++ b/composer.json @@ -5,7 +5,8 @@ "require": { "php": "^8.2", "mammatus/app": "dev-master", - "mammatus/cron": "dev-list-crons-bin", + "mammatus/cron": "dev-kubernetes-helm-crons-hook", + "mammatus/kubernetes-events": "dev-main", "psr/event-dispatcher": "^1" }, "require-dev": { diff --git a/composer.lock b/composer.lock index 9b53071..c15a4b2 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "be58bdacf4759a8c59d700f31e51c315", + "content-hash": "379ef2ca8ee5ab6e532295991a136166", "packages": [ { "name": "bramus/ansi-php", @@ -253,16 +253,16 @@ }, { "name": "composer/composer", - "version": "2.7.2", + "version": "2.7.3", "source": { "type": "git", "url": "https://github.com/composer/composer.git", - "reference": "b826edb791571ab1eaf281eb1bd6e181a1192adc" + "reference": "e49be96f3bccd183c9ff1313686c06cf898ba4be" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/composer/zipball/b826edb791571ab1eaf281eb1bd6e181a1192adc", - "reference": "b826edb791571ab1eaf281eb1bd6e181a1192adc", + "url": "https://api.github.com/repos/composer/composer/zipball/e49be96f3bccd183c9ff1313686c06cf898ba4be", + "reference": "e49be96f3bccd183c9ff1313686c06cf898ba4be", "shasum": "" }, "require": { @@ -347,7 +347,7 @@ "irc": "ircs://irc.libera.chat:6697/composer", "issues": "https://github.com/composer/composer/issues", "security": "https://github.com/composer/composer/security/policy", - "source": "https://github.com/composer/composer/tree/2.7.2" + "source": "https://github.com/composer/composer/tree/2.7.3" }, "funding": [ { @@ -363,7 +363,7 @@ "type": "tidelift" } ], - "time": "2024-03-11T16:12:18+00:00" + "time": "2024-04-19T19:40:57+00:00" }, { "name": "composer/metadata-minifier", @@ -1549,16 +1549,16 @@ }, { "name": "mammatus/cron", - "version": "dev-list-crons-bin", + "version": "dev-kubernetes-helm-crons-hook", "source": { "type": "git", "url": "https://github.com/MammatusPHP/cron.git", - "reference": "c57671efe764f88254a89f3127e4d7767fb70b64" + "reference": "eeed383d64416620036ab0d091e3dd64e122437f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/MammatusPHP/cron/zipball/c57671efe764f88254a89f3127e4d7767fb70b64", - "reference": "c57671efe764f88254a89f3127e4d7767fb70b64", + "url": "https://api.github.com/repos/MammatusPHP/cron/zipball/eeed383d64416620036ab0d091e3dd64e122437f", + "reference": "eeed383d64416620036ab0d091e3dd64e122437f", "shasum": "" }, "require": { @@ -1567,6 +1567,7 @@ "mammatus/app": "dev-master", "mammatus/cron-attributes": "^1", "mammatus/cron-contracts": "^1.0.1", + "mammatus/kubernetes-events": "dev-main", "mammatus/life-cycle-events": "^2", "php": "^8.2", "psr/container": "^1.1.2", @@ -1587,8 +1588,7 @@ "wyrihaximus/async-test-utilities": "^8.0.1" }, "bin": [ - "bin/mammatus-cron", - "bin/mammatus-cron-list" + "bin/mammatus-cron" ], "type": "composer-plugin", "extra": { @@ -1621,7 +1621,7 @@ "description": "โฑ๏ธ Cron manager", "support": { "issues": "https://github.com/MammatusPHP/cron/issues", - "source": "https://github.com/MammatusPHP/cron/tree/list-crons-bin" + "source": "https://github.com/MammatusPHP/cron/tree/kubernetes-helm-crons-hook" }, "funding": [ { @@ -1629,7 +1629,7 @@ "type": "github" } ], - "time": "2024-04-15T14:11:19+00:00" + "time": "2024-04-20T08:49:31+00:00" }, { "name": "mammatus/cron-attributes", @@ -1717,6 +1717,56 @@ ], "time": "2024-03-23T14:37:16+00:00" }, + { + "name": "mammatus/kubernetes-events", + "version": "dev-main", + "source": { + "type": "git", + "url": "https://github.com/MammatusPHP/kubernetes-events.git", + "reference": "e1bea8365ddbe6b27ad7c7ea2ecec4a037857160" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/MammatusPHP/kubernetes-events/zipball/e1bea8365ddbe6b27ad7c7ea2ecec4a037857160", + "reference": "e1bea8365ddbe6b27ad7c7ea2ecec4a037857160", + "shasum": "" + }, + "require": { + "php": "^8.2" + }, + "require-dev": { + "wyrihaximus/async-test-utilities": "^8.0.1" + }, + "default-branch": true, + "type": "library", + "extra": { + "php-di-definitions": { + "di": [ + "etc/di/*.php" + ] + }, + "wyrihaximus": { + "broadcast": { + "has-listeners": true + } + } + }, + "autoload": { + "psr-4": { + "Mammatus\\Kubernetes\\Events\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "โฑ๏ธ Cron manager", + "support": { + "issues": "https://github.com/MammatusPHP/kubernetes-events/issues", + "source": "https://github.com/MammatusPHP/kubernetes-events/tree/main" + }, + "time": "2024-04-20T08:45:32+00:00" + }, { "name": "mammatus/life-cycle-events", "version": "2.0.0", @@ -14131,7 +14181,8 @@ "minimum-stability": "stable", "stability-flags": { "mammatus/app": 20, - "mammatus/cron": 20 + "mammatus/cron": 20, + "mammatus/kubernetes-events": 20 }, "prefer-stable": false, "prefer-lowest": false, diff --git a/etc/ci/markdown-link-checker.json b/etc/ci/markdown-link-checker.json new file mode 100644 index 0000000..15fb56f --- /dev/null +++ b/etc/ci/markdown-link-checker.json @@ -0,0 +1,10 @@ +{ + "httpHeaders": [ + { + "urls": ["https://docs.github.com/"], + "headers": { + "Accept-Encoding": "zstd, br, gzip, deflate" + } + } + ] +} diff --git a/etc/qa/.phpunit.cache/code-coverage/115dde3bb86dc1db232dc6f47d909e89 b/etc/qa/.phpunit.cache/code-coverage/115dde3bb86dc1db232dc6f47d909e89 new file mode 100644 index 0000000..c40c787 --- /dev/null +++ b/etc/qa/.phpunit.cache/code-coverage/115dde3bb86dc1db232dc6f47d909e89 @@ -0,0 +1 @@ +a:6:{s:9:"classesIn";a:1:{s:26:"Mammatus\Cron\BuildIn\Noop";a:6:{s:4:"name";s:4:"Noop";s:14:"namespacedName";s:26:"Mammatus\Cron\BuildIn\Noop";s:9:"namespace";s:21:"Mammatus\Cron\BuildIn";s:9:"startLine";i:12;s:7:"endLine";i:19;s:7:"methods";a:1:{s:7:"perform";a:6:{s:10:"methodName";s:7:"perform";s:9:"signature";s:15:"perform(): void";s:10:"visibility";s:6:"public";s:9:"startLine";i:15;s:7:"endLine";i:18;s:3:"ccn";i:1;}}}}s:8:"traitsIn";a:0:{}s:11:"functionsIn";a:0:{}s:14:"linesOfCodeFor";a:3:{s:11:"linesOfCode";i:20;s:18:"commentLinesOfCode";i:0;s:21:"nonCommentLinesOfCode";i:20;}s:15:"ignoredLinesFor";a:2:{i:0;i:12;i:1;i:13;}s:17:"executableLinesIn";a:2:{i:12;i:1;i:17;i:2;}} \ No newline at end of file diff --git a/etc/qa/.phpunit.cache/code-coverage/198f1b332569b5ca2a950de5748b3b80 b/etc/qa/.phpunit.cache/code-coverage/198f1b332569b5ca2a950de5748b3b80 new file mode 100644 index 0000000..2734fc5 --- /dev/null +++ b/etc/qa/.phpunit.cache/code-coverage/198f1b332569b5ca2a950de5748b3b80 @@ -0,0 +1 @@ +a:6:{s:9:"classesIn";a:1:{s:39:"Mammatus\Cron\Generated\AbstractManager";a:6:{s:4:"name";s:15:"AbstractManager";s:14:"namespacedName";s:39:"Mammatus\Cron\Generated\AbstractManager";s:9:"namespace";s:23:"Mammatus\Cron\Generated";s:9:"startLine";i:12;s:7:"endLine";i:36;s:7:"methods";a:2:{s:4:"cron";a:6:{s:10:"methodName";s:4:"cron";s:9:"signature";s:85:"cron(WyriHaximus\React\Mutex\Contracts\MutexInterface $mutex): WyriHaximus\React\Cron";s:10:"visibility";s:9:"protected";s:9:"startLine";i:16;s:7:"endLine";i:33;s:3:"ccn";i:2;}s:7:"perform";a:6:{s:10:"methodName";s:7:"perform";s:9:"signature";s:28:"perform(string $class): void";s:10:"visibility";s:9:"protected";s:9:"startLine";i:35;s:7:"endLine";i:35;s:3:"ccn";i:0;}}}}s:8:"traitsIn";a:0:{}s:11:"functionsIn";a:0:{}s:14:"linesOfCodeFor";a:3:{s:11:"linesOfCode";i:37;s:18:"commentLinesOfCode";i:0;s:21:"nonCommentLinesOfCode";i:37;}s:15:"ignoredLinesFor";a:1:{i:0;i:12;}s:17:"executableLinesIn";a:13:{i:18;i:2;i:19;i:3;i:22;i:4;i:23;i:4;i:24;i:4;i:25;i:4;i:26;i:4;i:27;i:4;i:28;i:4;i:29;i:4;i:30;i:4;i:32;i:5;i:35;i:6;}} \ No newline at end of file diff --git a/etc/qa/.phpunit.cache/code-coverage/2e11549a624de3790cb85693dd1fff45 b/etc/qa/.phpunit.cache/code-coverage/2e11549a624de3790cb85693dd1fff45 new file mode 100644 index 0000000..2fa9724 --- /dev/null +++ b/etc/qa/.phpunit.cache/code-coverage/2e11549a624de3790cb85693dd1fff45 @@ -0,0 +1 @@ +a:6:{s:9:"classesIn";a:1:{s:39:"Mammatus\Cron\Generated\AbstractManager";a:6:{s:4:"name";s:15:"AbstractManager";s:14:"namespacedName";s:39:"Mammatus\Cron\Generated\AbstractManager";s:9:"namespace";s:23:"Mammatus\Cron\Generated";s:9:"startLine";i:15;s:7:"endLine";i:40;s:7:"methods";a:2:{s:4:"cron";a:6:{s:10:"methodName";s:4:"cron";s:9:"signature";s:85:"cron(WyriHaximus\React\Mutex\Contracts\MutexInterface $mutex): WyriHaximus\React\Cron";s:10:"visibility";s:9:"protected";s:9:"startLine";i:19;s:7:"endLine";i:37;s:3:"ccn";i:2;}s:7:"perform";a:6:{s:10:"methodName";s:7:"perform";s:9:"signature";s:28:"perform(string $class): void";s:10:"visibility";s:9:"protected";s:9:"startLine";i:39;s:7:"endLine";i:39;s:3:"ccn";i:0;}}}}s:8:"traitsIn";a:0:{}s:11:"functionsIn";a:0:{}s:14:"linesOfCodeFor";a:3:{s:11:"linesOfCode";i:41;s:18:"commentLinesOfCode";i:5;s:21:"nonCommentLinesOfCode";i:36;}s:15:"ignoredLinesFor";a:1:{i:0;i:15;}s:17:"executableLinesIn";a:13:{i:21;i:2;i:22;i:3;i:25;i:4;i:26;i:4;i:28;i:4;i:29;i:4;i:30;i:4;i:31;i:4;i:32;i:4;i:33;i:4;i:34;i:4;i:36;i:5;i:39;i:6;}} \ No newline at end of file diff --git a/etc/qa/.phpunit.cache/code-coverage/80fb71734d8c153f4c4074ff5054ad74 b/etc/qa/.phpunit.cache/code-coverage/80fb71734d8c153f4c4074ff5054ad74 new file mode 100644 index 0000000..0ac9ba4 --- /dev/null +++ b/etc/qa/.phpunit.cache/code-coverage/80fb71734d8c153f4c4074ff5054ad74 @@ -0,0 +1 @@ +a:6:{s:9:"classesIn";a:1:{s:32:"Mammatus\Cron\Composer\Installer";a:6:{s:4:"name";s:9:"Installer";s:14:"namespacedName";s:32:"Mammatus\Cron\Composer\Installer";s:9:"namespace";s:22:"Mammatus\Cron\Composer";s:9:"startLine";i:54;s:7:"endLine";i:291;s:7:"methods";a:7:{s:19:"getSubscribedEvents";a:6:{s:10:"methodName";s:19:"getSubscribedEvents";s:9:"signature";s:28:"getSubscribedEvents(): array";s:10:"visibility";s:6:"public";s:9:"startLine";i:57;s:7:"endLine";i:60;s:3:"ccn";i:1;}s:8:"activate";a:6:{s:10:"methodName";s:8:"activate";s:9:"signature";s:72:"activate(Composer\Composer $composer, Composer\IO\IOInterface $io): void";s:10:"visibility";s:6:"public";s:9:"startLine";i:62;s:7:"endLine";i:65;s:3:"ccn";i:1;}s:10:"deactivate";a:6:{s:10:"methodName";s:10:"deactivate";s:9:"signature";s:74:"deactivate(Composer\Composer $composer, Composer\IO\IOInterface $io): void";s:10:"visibility";s:6:"public";s:9:"startLine";i:67;s:7:"endLine";i:70;s:3:"ccn";i:1;}s:9:"uninstall";a:6:{s:10:"methodName";s:9:"uninstall";s:9:"signature";s:73:"uninstall(Composer\Composer $composer, Composer\IO\IOInterface $io): void";s:10:"visibility";s:6:"public";s:9:"startLine";i:72;s:7:"endLine";i:75;s:3:"ccn";i:1;}s:11:"findActions";a:6:{s:10:"methodName";s:11:"findActions";s:9:"signature";s:47:"findActions(Composer\Script\Event $event): void";s:10:"visibility";s:6:"public";s:9:"startLine";i:80;s:7:"endLine";i:152;s:3:"ccn";i:6;}s:28:"locateRootPackageInstallPath";a:6:{s:10:"methodName";s:28:"locateRootPackageInstallPath";s:9:"signature";s:121:"locateRootPackageInstallPath(Composer\Config $composerConfig, Composer\Package\RootPackageInterface $rootPackage): string";s:10:"visibility";s:7:"private";s:9:"startLine";i:157;s:7:"endLine";i:172;s:3:"ccn";i:3;}s:14:"findAllActions";a:6:{s:10:"methodName";s:14:"findAllActions";s:9:"signature";s:79:"findAllActions(Composer\Composer $composer, Composer\IO\IOInterface $io): array";s:10:"visibility";s:7:"private";s:9:"startLine";i:175;s:7:"endLine";i:290;s:3:"ccn";i:14;}}}}s:8:"traitsIn";a:0:{}s:11:"functionsIn";a:0:{}s:14:"linesOfCodeFor";a:3:{s:11:"linesOfCode";i:292;s:18:"commentLinesOfCode";i:28;s:21:"nonCommentLinesOfCode";i:264;}s:15:"ignoredLinesFor";a:1:{i:0;i:54;}s:17:"executableLinesIn";a:134:{i:59;i:1;i:65;i:2;i:70;i:3;i:75;i:4;i:82;i:5;i:83;i:6;i:84;i:7;i:85;i:8;i:86;i:9;i:87;i:10;i:91;i:11;i:92;i:12;i:94;i:13;i:95;i:14;i:107;i:14;i:96;i:15;i:97;i:16;i:100;i:17;i:102;i:18;i:103;i:19;i:106;i:20;i:112;i:21;i:114;i:22;i:116;i:23;i:118;i:24;i:120;i:25;i:122;i:26;i:124;i:27;i:126;i:28;i:129;i:29;i:131;i:30;i:133;i:31;i:135;i:32;i:136;i:32;i:137;i:32;i:138;i:32;i:139;i:32;i:140;i:32;i:142;i:33;i:143;i:33;i:145;i:34;i:146;i:35;i:148;i:36;i:149;i:36;i:150;i:36;i:151;i:36;i:161;i:37;i:162;i:38;i:163;i:39;i:167;i:40;i:168;i:41;i:171;i:42;i:177;i:43;i:178;i:44;i:179;i:45;i:180;i:46;i:185;i:47;i:186;i:47;i:187;i:47;i:188;i:48;i:189;i:49;i:190;i:50;i:193;i:51;i:194;i:52;i:196;i:53;i:198;i:53;i:201;i:53;i:203;i:53;i:236;i:53;i:238;i:53;i:241;i:53;i:244;i:53;i:264;i:53;i:266;i:53;i:268;i:53;i:280;i:53;i:282;i:53;i:289;i:53;i:197;i:54;i:200;i:55;i:202;i:56;i:204;i:57;i:205;i:58;i:206;i:59;i:207;i:60;i:208;i:61;i:209;i:62;i:212;i:63;i:213;i:64;i:214;i:65;i:215;i:66;i:217;i:67;i:221;i:68;i:222;i:69;i:225;i:70;i:226;i:71;i:227;i:72;i:229;i:73;i:235;i:74;i:237;i:75;i:240;i:76;i:242;i:77;i:247;i:78;i:248;i:78;i:253;i:78;i:254;i:78;i:249;i:79;i:250;i:80;i:252;i:81;i:255;i:82;i:256;i:83;i:257;i:83;i:258;i:83;i:259;i:83;i:260;i:83;i:263;i:84;i:265;i:85;i:267;i:86;i:269;i:87;i:270;i:88;i:271;i:89;i:274;i:90;i:275;i:90;i:276;i:90;i:277;i:90;i:278;i:90;i:279;i:90;i:281;i:91;i:283;i:92;i:284;i:92;i:285;i:92;i:286;i:92;i:287;i:92;i:288;i:92;}} \ No newline at end of file diff --git a/etc/qa/.phpunit.cache/code-coverage/8492db70bba2ae303099122bbca38c9a b/etc/qa/.phpunit.cache/code-coverage/8492db70bba2ae303099122bbca38c9a new file mode 100644 index 0000000..61ec7e5 --- /dev/null +++ b/etc/qa/.phpunit.cache/code-coverage/8492db70bba2ae303099122bbca38c9a @@ -0,0 +1 @@ +a:6:{s:9:"classesIn";a:1:{s:39:"Mammatus\Cron\Generated\AbstractManager";a:6:{s:4:"name";s:15:"AbstractManager";s:14:"namespacedName";s:39:"Mammatus\Cron\Generated\AbstractManager";s:9:"namespace";s:23:"Mammatus\Cron\Generated";s:9:"startLine";i:12;s:7:"endLine";i:37;s:7:"methods";a:2:{s:4:"cron";a:6:{s:10:"methodName";s:4:"cron";s:9:"signature";s:85:"cron(WyriHaximus\React\Mutex\Contracts\MutexInterface $mutex): WyriHaximus\React\Cron";s:10:"visibility";s:9:"protected";s:9:"startLine";i:16;s:7:"endLine";i:34;s:3:"ccn";i:2;}s:7:"perform";a:6:{s:10:"methodName";s:7:"perform";s:9:"signature";s:28:"perform(string $class): void";s:10:"visibility";s:9:"protected";s:9:"startLine";i:36;s:7:"endLine";i:36;s:3:"ccn";i:0;}}}}s:8:"traitsIn";a:0:{}s:11:"functionsIn";a:0:{}s:14:"linesOfCodeFor";a:3:{s:11:"linesOfCode";i:38;s:18:"commentLinesOfCode";i:2;s:21:"nonCommentLinesOfCode";i:36;}s:15:"ignoredLinesFor";a:1:{i:0;i:12;}s:17:"executableLinesIn";a:13:{i:18;i:2;i:19;i:3;i:22;i:4;i:23;i:4;i:25;i:4;i:26;i:4;i:27;i:4;i:28;i:4;i:29;i:4;i:30;i:4;i:31;i:4;i:33;i:5;i:36;i:6;}} \ No newline at end of file diff --git a/etc/qa/.phpunit.cache/code-coverage/896626606d07aa9aabb35abc10197c79 b/etc/qa/.phpunit.cache/code-coverage/896626606d07aa9aabb35abc10197c79 new file mode 100644 index 0000000..ad0d803 --- /dev/null +++ b/etc/qa/.phpunit.cache/code-coverage/896626606d07aa9aabb35abc10197c79 @@ -0,0 +1 @@ +a:6:{s:9:"classesIn";a:1:{s:21:"Mammatus\Cron\Manager";a:6:{s:4:"name";s:7:"Manager";s:14:"namespacedName";s:21:"Mammatus\Cron\Manager";s:9:"namespace";s:13:"Mammatus\Cron";s:9:"startLine";i:19;s:7:"endLine";i:56;s:7:"methods";a:4:{s:11:"__construct";a:6:{s:10:"methodName";s:11:"__construct";s:9:"signature";s:146:"__construct(Psr\Log\LoggerInterface $logger, WyriHaximus\React\Mutex\Contracts\MutexInterface $mutex, Psr\Container\ContainerInterface $container)";s:10:"visibility";s:6:"public";s:9:"startLine";i:21;s:7:"endLine";i:23;s:3:"ccn";i:1;}s:5:"start";a:6:{s:10:"methodName";s:5:"start";s:9:"signature";s:55:"start(Mammatus\LifeCycleEvents\Initialize $event): void";s:10:"visibility";s:6:"public";s:9:"startLine";i:25;s:7:"endLine";i:30;s:3:"ccn";i:1;}s:4:"stop";a:6:{s:10:"methodName";s:4:"stop";s:9:"signature";s:52:"stop(Mammatus\LifeCycleEvents\Shutdown $event): void";s:10:"visibility";s:6:"public";s:9:"startLine";i:32;s:7:"endLine";i:37;s:3:"ccn";i:1;}s:7:"perform";a:6:{s:10:"methodName";s:7:"perform";s:9:"signature";s:28:"perform(string $class): void";s:10:"visibility";s:9:"protected";s:9:"startLine";i:39;s:7:"endLine";i:55;s:3:"ccn";i:3;}}}}s:8:"traitsIn";a:0:{}s:11:"functionsIn";a:0:{}s:14:"linesOfCodeFor";a:3:{s:11:"linesOfCode";i:57;s:18:"commentLinesOfCode";i:1;s:21:"nonCommentLinesOfCode";i:56;}s:15:"ignoredLinesFor";a:1:{i:0;i:19;}s:17:"executableLinesIn";a:17:{i:23;i:1;i:27;i:2;i:28;i:3;i:29;i:4;i:34;i:5;i:35;i:6;i:36;i:7;i:41;i:8;i:43;i:9;i:44;i:10;i:45;i:11;i:46;i:12;i:49;i:13;i:50;i:14;i:51;i:15;i:52;i:16;i:53;i:17;}} \ No newline at end of file diff --git a/etc/qa/.phpunit.cache/code-coverage/bf636324a07ef8e1956d58bf7f77c5dc b/etc/qa/.phpunit.cache/code-coverage/bf636324a07ef8e1956d58bf7f77c5dc new file mode 100644 index 0000000..92e8ea9 --- /dev/null +++ b/etc/qa/.phpunit.cache/code-coverage/bf636324a07ef8e1956d58bf7f77c5dc @@ -0,0 +1 @@ +a:6:{s:9:"classesIn";a:1:{s:39:"Mammatus\Cron\Generated\AbstractManager";a:6:{s:4:"name";s:15:"AbstractManager";s:14:"namespacedName";s:39:"Mammatus\Cron\Generated\AbstractManager";s:9:"namespace";s:23:"Mammatus\Cron\Generated";s:9:"startLine";i:10;s:7:"endLine";i:28;s:7:"methods";a:2:{s:4:"cron";a:6:{s:10:"methodName";s:4:"cron";s:9:"signature";s:85:"cron(WyriHaximus\React\Mutex\Contracts\MutexInterface $mutex): WyriHaximus\React\Cron";s:10:"visibility";s:9:"protected";s:9:"startLine";i:14;s:7:"endLine";i:25;s:3:"ccn";i:2;}s:7:"perform";a:6:{s:10:"methodName";s:7:"perform";s:9:"signature";s:28:"perform(string $class): void";s:10:"visibility";s:9:"protected";s:9:"startLine";i:27;s:7:"endLine";i:27;s:3:"ccn";i:0;}}}}s:8:"traitsIn";a:0:{}s:11:"functionsIn";a:0:{}s:14:"linesOfCodeFor";a:3:{s:11:"linesOfCode";i:29;s:18:"commentLinesOfCode";i:0;s:21:"nonCommentLinesOfCode";i:29;}s:15:"ignoredLinesFor";a:1:{i:0;i:10;}s:17:"executableLinesIn";a:7:{i:16;i:2;i:17;i:3;i:20;i:4;i:21;i:4;i:22;i:4;i:24;i:5;i:27;i:6;}} \ No newline at end of file diff --git a/etc/qa/.phpunit.cache/code-coverage/cc1878cf252cae3b0e05838039c01d66 b/etc/qa/.phpunit.cache/code-coverage/cc1878cf252cae3b0e05838039c01d66 new file mode 100644 index 0000000..a9409f7 --- /dev/null +++ b/etc/qa/.phpunit.cache/code-coverage/cc1878cf252cae3b0e05838039c01d66 @@ -0,0 +1 @@ +a:6:{s:9:"classesIn";a:1:{s:39:"Mammatus\Cron\Generated\AbstractManager";a:6:{s:4:"name";s:15:"AbstractManager";s:14:"namespacedName";s:39:"Mammatus\Cron\Generated\AbstractManager";s:9:"namespace";s:23:"Mammatus\Cron\Generated";s:9:"startLine";i:12;s:7:"endLine";i:36;s:7:"methods";a:2:{s:4:"cron";a:6:{s:10:"methodName";s:4:"cron";s:9:"signature";s:85:"cron(WyriHaximus\React\Mutex\Contracts\MutexInterface $mutex): WyriHaximus\React\Cron";s:10:"visibility";s:9:"protected";s:9:"startLine";i:16;s:7:"endLine";i:33;s:3:"ccn";i:2;}s:7:"perform";a:6:{s:10:"methodName";s:7:"perform";s:9:"signature";s:28:"perform(string $class): void";s:10:"visibility";s:9:"protected";s:9:"startLine";i:35;s:7:"endLine";i:35;s:3:"ccn";i:0;}}}}s:8:"traitsIn";a:0:{}s:11:"functionsIn";a:0:{}s:14:"linesOfCodeFor";a:3:{s:11:"linesOfCode";i:37;s:18:"commentLinesOfCode";i:1;s:21:"nonCommentLinesOfCode";i:36;}s:15:"ignoredLinesFor";a:1:{i:0;i:12;}s:17:"executableLinesIn";a:13:{i:18;i:2;i:19;i:3;i:22;i:4;i:23;i:4;i:24;i:4;i:25;i:4;i:26;i:4;i:27;i:4;i:28;i:4;i:29;i:4;i:30;i:4;i:32;i:5;i:35;i:6;}} \ No newline at end of file diff --git a/etc/qa/.phpunit.cache/code-coverage/e02f76f6db345dda48ef583ec1ceb8d0 b/etc/qa/.phpunit.cache/code-coverage/e02f76f6db345dda48ef583ec1ceb8d0 new file mode 100644 index 0000000..cc7d1a0 --- /dev/null +++ b/etc/qa/.phpunit.cache/code-coverage/e02f76f6db345dda48ef583ec1ceb8d0 @@ -0,0 +1 @@ +a:6:{s:9:"classesIn";a:1:{s:32:"Mammatus\Cron\Composer\Installer";a:6:{s:4:"name";s:9:"Installer";s:14:"namespacedName";s:32:"Mammatus\Cron\Composer\Installer";s:9:"namespace";s:22:"Mammatus\Cron\Composer";s:9:"startLine";i:53;s:7:"endLine";i:290;s:7:"methods";a:7:{s:19:"getSubscribedEvents";a:6:{s:10:"methodName";s:19:"getSubscribedEvents";s:9:"signature";s:28:"getSubscribedEvents(): array";s:10:"visibility";s:6:"public";s:9:"startLine";i:56;s:7:"endLine";i:59;s:3:"ccn";i:1;}s:8:"activate";a:6:{s:10:"methodName";s:8:"activate";s:9:"signature";s:72:"activate(Composer\Composer $composer, Composer\IO\IOInterface $io): void";s:10:"visibility";s:6:"public";s:9:"startLine";i:61;s:7:"endLine";i:64;s:3:"ccn";i:1;}s:10:"deactivate";a:6:{s:10:"methodName";s:10:"deactivate";s:9:"signature";s:74:"deactivate(Composer\Composer $composer, Composer\IO\IOInterface $io): void";s:10:"visibility";s:6:"public";s:9:"startLine";i:66;s:7:"endLine";i:69;s:3:"ccn";i:1;}s:9:"uninstall";a:6:{s:10:"methodName";s:9:"uninstall";s:9:"signature";s:73:"uninstall(Composer\Composer $composer, Composer\IO\IOInterface $io): void";s:10:"visibility";s:6:"public";s:9:"startLine";i:71;s:7:"endLine";i:74;s:3:"ccn";i:1;}s:11:"findActions";a:6:{s:10:"methodName";s:11:"findActions";s:9:"signature";s:47:"findActions(Composer\Script\Event $event): void";s:10:"visibility";s:6:"public";s:9:"startLine";i:79;s:7:"endLine";i:151;s:3:"ccn";i:6;}s:28:"locateRootPackageInstallPath";a:6:{s:10:"methodName";s:28:"locateRootPackageInstallPath";s:9:"signature";s:121:"locateRootPackageInstallPath(Composer\Config $composerConfig, Composer\Package\RootPackageInterface $rootPackage): string";s:10:"visibility";s:7:"private";s:9:"startLine";i:156;s:7:"endLine";i:171;s:3:"ccn";i:3;}s:14:"findAllActions";a:6:{s:10:"methodName";s:14:"findAllActions";s:9:"signature";s:79:"findAllActions(Composer\Composer $composer, Composer\IO\IOInterface $io): array";s:10:"visibility";s:7:"private";s:9:"startLine";i:174;s:7:"endLine";i:289;s:3:"ccn";i:14;}}}}s:8:"traitsIn";a:0:{}s:11:"functionsIn";a:0:{}s:14:"linesOfCodeFor";a:3:{s:11:"linesOfCode";i:291;s:18:"commentLinesOfCode";i:28;s:21:"nonCommentLinesOfCode";i:263;}s:15:"ignoredLinesFor";a:1:{i:0;i:53;}s:17:"executableLinesIn";a:134:{i:58;i:1;i:64;i:2;i:69;i:3;i:74;i:4;i:81;i:5;i:82;i:6;i:83;i:7;i:84;i:8;i:85;i:9;i:86;i:10;i:90;i:11;i:91;i:12;i:93;i:13;i:94;i:14;i:106;i:14;i:95;i:15;i:96;i:16;i:99;i:17;i:101;i:18;i:102;i:19;i:105;i:20;i:111;i:21;i:113;i:22;i:115;i:23;i:117;i:24;i:119;i:25;i:121;i:26;i:123;i:27;i:125;i:28;i:128;i:29;i:130;i:30;i:132;i:31;i:134;i:32;i:135;i:32;i:136;i:32;i:137;i:32;i:138;i:32;i:139;i:32;i:141;i:33;i:142;i:33;i:144;i:34;i:145;i:35;i:147;i:36;i:148;i:36;i:149;i:36;i:150;i:36;i:160;i:37;i:161;i:38;i:162;i:39;i:166;i:40;i:167;i:41;i:170;i:42;i:176;i:43;i:177;i:44;i:178;i:45;i:183;i:46;i:184;i:46;i:185;i:46;i:186;i:47;i:187;i:48;i:188;i:49;i:191;i:50;i:192;i:51;i:194;i:52;i:196;i:52;i:199;i:52;i:201;i:52;i:234;i:52;i:236;i:52;i:239;i:52;i:242;i:52;i:262;i:52;i:264;i:52;i:266;i:52;i:279;i:52;i:281;i:52;i:288;i:52;i:195;i:53;i:198;i:54;i:200;i:55;i:202;i:56;i:203;i:57;i:204;i:58;i:205;i:59;i:206;i:60;i:207;i:61;i:210;i:62;i:211;i:63;i:212;i:64;i:213;i:65;i:215;i:66;i:219;i:67;i:220;i:68;i:223;i:69;i:224;i:70;i:225;i:71;i:227;i:72;i:233;i:73;i:235;i:74;i:238;i:75;i:240;i:76;i:245;i:77;i:246;i:77;i:251;i:77;i:252;i:77;i:247;i:78;i:248;i:79;i:250;i:80;i:253;i:81;i:254;i:82;i:255;i:82;i:256;i:82;i:257;i:82;i:258;i:82;i:261;i:83;i:263;i:84;i:265;i:85;i:267;i:86;i:268;i:87;i:269;i:88;i:270;i:89;i:273;i:90;i:274;i:90;i:275;i:90;i:276;i:90;i:277;i:90;i:278;i:90;i:280;i:91;i:282;i:92;i:283;i:92;i:284;i:92;i:285;i:92;i:286;i:92;i:287;i:92;}} \ No newline at end of file diff --git a/etc/qa/.phpunit.cache/code-coverage/f69c0eeba27642927e5355d97a31da91 b/etc/qa/.phpunit.cache/code-coverage/f69c0eeba27642927e5355d97a31da91 new file mode 100644 index 0000000..134c2f7 --- /dev/null +++ b/etc/qa/.phpunit.cache/code-coverage/f69c0eeba27642927e5355d97a31da91 @@ -0,0 +1 @@ +a:6:{s:9:"classesIn";a:1:{s:17:"Mammatus\Cron\App";a:6:{s:4:"name";s:3:"App";s:14:"namespacedName";s:17:"Mammatus\Cron\App";s:9:"namespace";s:13:"Mammatus\Cron";s:9:"startLine";i:17;s:7:"endLine";i:48;s:7:"methods";a:2:{s:11:"__construct";a:6:{s:10:"methodName";s:11:"__construct";s:9:"signature";s:89:"__construct(Psr\Container\ContainerInterface $container, Psr\Log\LoggerInterface $logger)";s:10:"visibility";s:6:"public";s:9:"startLine";i:19;s:7:"endLine";i:23;s:3:"ccn";i:1;}s:3:"run";a:6:{s:10:"methodName";s:3:"run";s:9:"signature";s:27:"run(string $className): int";s:10:"visibility";s:6:"public";s:9:"startLine";i:25;s:7:"endLine";i:47;s:3:"ccn";i:3;}}}}s:8:"traitsIn";a:0:{}s:11:"functionsIn";a:0:{}s:14:"linesOfCodeFor";a:3:{s:11:"linesOfCode";i:49;s:18:"commentLinesOfCode";i:1;s:21:"nonCommentLinesOfCode";i:48;}s:15:"ignoredLinesFor";a:1:{i:0;i:17;}s:17:"executableLinesIn";a:15:{i:23;i:1;i:27;i:2;i:46;i:2;i:28;i:3;i:30;i:4;i:31;i:5;i:32;i:6;i:33;i:7;i:36;i:8;i:37;i:9;i:38;i:10;i:40;i:11;i:41;i:12;i:42;i:13;i:44;i:14;}} \ No newline at end of file diff --git a/etc/qa/.phpunit.cache/test-results b/etc/qa/.phpunit.cache/test-results new file mode 100644 index 0000000..a326e3e --- /dev/null +++ b/etc/qa/.phpunit.cache/test-results @@ -0,0 +1 @@ +{"version":1,"defects":{"Mammatus\\Tests\\Cron\\AppTest::runAngry":8,"Mammatus\\Tests\\Cron\\AppTest::runNonAction":8},"times":{"Mammatus\\Tests\\Cron\\AppTest::runHappy":0.053,"Mammatus\\Tests\\Cron\\AppTest::runAngry":0.002,"Mammatus\\Tests\\Cron\\AppTest::runNonAction":0.002}} \ No newline at end of file diff --git a/etc/qa/composer-require-checker.json b/etc/qa/composer-require-checker.json new file mode 100644 index 0000000..7882deb --- /dev/null +++ b/etc/qa/composer-require-checker.json @@ -0,0 +1,22 @@ +{ + "symbol-whitelist" : [ + "null", "true", "false", + "static", "self", "parent", + "array", "string", "int", "float", "bool", "iterable", "callable", "void", "object", + "Composer\\Composer", "Composer\\Config", "Composer\\EventDispatcher\\EventSubscriberInterface", + "Composer\\IO\\IOInterface", "Composer\\Package\\RootPackageInterface", "Composer\\Plugin\\PluginInterface", + "Composer\\Script\\Event", "Composer\\Script\\ScriptEvents", "Safe\\chmod", "Safe\\file_get_contents", + "Safe\\file_put_contents", "Safe\\mkdir", "Safe\\spl_autoload_register", "WyriHaximus\\getIn", + "WyriHaximus\\listClassesInDirectories" + ], + "php-core-extensions" : [ + "Core", + "date", + "pcre", + "Phar", + "Reflection", + "SPL", + "standard" + ], + "scan-files" : [] +} diff --git a/etc/qa/composer-unused.php b/etc/qa/composer-unused.php new file mode 100644 index 0000000..d8835db --- /dev/null +++ b/etc/qa/composer-unused.php @@ -0,0 +1,13 @@ +addNamedFilter(NamedFilter::fromString('wyrihaximus/phpstan-rules-wrapper')); +}; diff --git a/etc/qa/phpcs.xml b/etc/qa/phpcs.xml new file mode 100644 index 0000000..1bb6ddb --- /dev/null +++ b/etc/qa/phpcs.xml @@ -0,0 +1,13 @@ + + + + + + + + + ../../src + ../../tests + + + diff --git a/etc/qa/phpstan.neon b/etc/qa/phpstan.neon new file mode 100644 index 0000000..659d1d5 --- /dev/null +++ b/etc/qa/phpstan.neon @@ -0,0 +1,11 @@ +parameters: + ignoreErrors: + - '#Method Mammatus\\Cron\\App::__construct\(\) has a parameter \$container with a type declaration of Psr\\Container\\ContainerInterface, but containers should not be injected.#' + - '#Method Mammatus\\Cron\\Manager::__construct\(\) has a parameter \$container with a type declaration of Psr\\Container\\ContainerInterface, but containers should not be injected.#' + ergebnis: + noExtends: + classesAllowedToBeExtended: + - Mammatus\Cron\Generated\AbstractManager + +includes: + - ../../vendor/wyrihaximus/async-test-utilities/rules.neon diff --git a/etc/qa/phpunit.xml b/etc/qa/phpunit.xml new file mode 100644 index 0000000..d091884 --- /dev/null +++ b/etc/qa/phpunit.xml @@ -0,0 +1,16 @@ + + + + + ../../tests/ + + + + + ../../src/ + + + + + + diff --git a/etc/qa/psalm.xml b/etc/qa/psalm.xml new file mode 100644 index 0000000..136d602 --- /dev/null +++ b/etc/qa/psalm.xml @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/infection.json.dist b/infection.json.dist new file mode 100644 index 0000000..927165e --- /dev/null +++ b/infection.json.dist @@ -0,0 +1,65 @@ +{ + "timeout": 120, + "source": { + "directories": [ + "src" + ] + }, + "logs": { + "text": "./var/infection.log", + "summary": "./var/infection-summary.log", + "json": "./var/infection.json", + "perMutator": "./var/infection-per-mutator.md", + "github": true + }, + "minMsi": 100, + "minCoveredMsi": 100, + "ignoreMsiWithNoMutations": true, + "mutators": { + "@default": true, + "FunctionCallRemoval": { + "ignore": [ + "WyriHaximus\\TestUtilities\\TestCase::waitUntilTheNextSecond" + ] + }, + "MethodCallRemoval": { + "ignore": [ + "WyriHaximus\\TestUtilities\\TestCase::tearDown" + ] + }, + "Continue_": { + "ignore": [ + "WyriHaximus\\TestUtilities\\TestCase::rmdir" + ] + }, + "TrueValue": { + "ignore": [ + "WyriHaximus\\TestUtilities\\TestCase::provideTrueFalse" + ] + }, + "ArrayItemRemoval": false, + "FalseValue": { + "ignore": [ + "WyriHaximus\\TestUtilities\\TestCase::provideTrueFalse" + ] + }, + "PublicVisibility": { + "ignore": [ + "WyriHaximus\\TestUtilities\\TestCase::provideTrueFalse" + ] + }, + "Identical": { + "ignore": [ + "WyriHaximus\\TestUtilities\\TestCase::getSysTempDir" + ] + }, + "UnwrapStrToUpper": { + "ignore": [ + "WyriHaximus\\TestUtilities\\TestCase::getSysTempDir" + ] + } + }, + "phpUnit": { + "configDir": "./etc/qa/" + } +} diff --git a/src/Helm.php b/src/Helm.php new file mode 100644 index 0000000..6415220 --- /dev/null +++ b/src/Helm.php @@ -0,0 +1,34 @@ +eventDispatcher->dispatch(new \Mammatus\Kubernetes\Events\Helm\Values($registry)); + + echo json_encode($registry->get()); + + return 0; + } +} diff --git a/src/Helm/Values.php b/src/Helm/Values.php new file mode 100644 index 0000000..9febfcc --- /dev/null +++ b/src/Helm/Values.php @@ -0,0 +1,14 @@ +angry; + } +} diff --git a/tests/AppTest.php b/tests/AppTest.php new file mode 100644 index 0000000..e0cac2e --- /dev/null +++ b/tests/AppTest.php @@ -0,0 +1,68 @@ +expects('get')->with(Noop::class)->once()->andReturn(new Noop()); + + $logger = Mockery::mock(LoggerInterface::class); + $logger->expects('log')->with('debug', 'Getting job', ['cronjob' => Noop::class])->once(); + $logger->expects('log')->with('debug', 'Starting job', ['cronjob' => Noop::class])->once(); + $logger->expects('log')->with('debug', 'Job finished', ['cronjob' => Noop::class])->once(); + + $exitCode = (new App($container, $logger))->run(Noop::class); + + self::assertSame(0, $exitCode); + } + + /** @test */ + public function runAngry(): void + { + $exception = new RuntimeException('Ik ben boos!'); + $container = Mockery::mock(ContainerInterface::class); + $container->expects('get')->with(Angry::class)->once()->andReturn(new Angry($exception)); + + $logger = Mockery::mock(LoggerInterface::class); + $logger->expects('log')->with('debug', 'Getting job', ['cronjob' => Angry::class])->once(); + $logger->expects('log')->with('debug', 'Starting job', ['cronjob' => Angry::class])->once(); + $logger->expects('log')->with('error', 'Job errored', ['cronjob' => Angry::class, 'exception' => $exception])->once(); + + $exitCode = (new App($container, $logger))->run(Angry::class); + + self::assertSame(1, $exitCode); + } + + /** @test */ + public function runNonAction(): void + { + $container = Mockery::mock(ContainerInterface::class); + $container->expects('get')->with(Sad::class)->once()->andReturn(new Sad()); + + $logger = Mockery::mock(LoggerInterface::class); + $logger->expects('log')->with('debug', 'Getting job', ['cronjob' => Sad::class])->once(); + $logger->expects('log')->withArgs(static function (string $type, string $message, array $context): bool { + return array_key_exists('cronjob', $context) && $context['cronjob'] === Sad::class && array_key_exists('exception', $context) && $context['exception'] instanceof RuntimeException && $context['exception']->getMessage() === 'Given job is not an action'; + })->once(); + + $exitCode = (new App($container, $logger))->run(Sad::class); + + self::assertSame(1, $exitCode); + } +} diff --git a/tests/Sad.php b/tests/Sad.php new file mode 100644 index 0000000..c544233 --- /dev/null +++ b/tests/Sad.php @@ -0,0 +1,9 @@ +