From e0cddd9ce8ffc9677b0bd26851ba761093d15d2f Mon Sep 17 00:00:00 2001 From: Matthew Baggett Date: Sun, 14 Apr 2024 15:49:43 +0200 Subject: [PATCH] Trunk things --- .github/workflows/cache_trunk.yaml | 24 +++ .github/workflows/pr.yaml | 33 ++++ .trunk/.gitignore | 9 ++ .trunk/configs/.markdownlint.yaml | 2 + .trunk/configs/.yamllint.yaml | 7 + .trunk/trunk.yaml | 32 ++++ composer.json | 233 ++++++++++++++--------------- 7 files changed, 221 insertions(+), 119 deletions(-) create mode 100644 .github/workflows/cache_trunk.yaml create mode 100644 .github/workflows/pr.yaml create mode 100644 .trunk/.gitignore create mode 100644 .trunk/configs/.markdownlint.yaml create mode 100644 .trunk/configs/.yamllint.yaml create mode 100644 .trunk/trunk.yaml diff --git a/.github/workflows/cache_trunk.yaml b/.github/workflows/cache_trunk.yaml new file mode 100644 index 0000000..09500b1 --- /dev/null +++ b/.github/workflows/cache_trunk.yaml @@ -0,0 +1,24 @@ +name: Cache Trunk + +on: + push: + branches: [main] + paths: [.trunk/trunk.yaml] + +permissions: read-all + +jobs: + cache_trunk: + name: Cache Trunk + runs-on: ubuntu-latest + permissions: + actions: write + + steps: + - name: Checkout + uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 + + - name: Trunk Check + uses: ./ # external users, use: trunk-io/trunk-action@v1 + with: + check-mode: populate_cache_only diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml new file mode 100644 index 0000000..b61472f --- /dev/null +++ b/.github/workflows/pr.yaml @@ -0,0 +1,33 @@ +name: Pull Request +on: [pull_request, workflow_dispatch] +concurrency: + group: ${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +permissions: read-all + +jobs: + trunk_check: + name: Trunk Check Runner + runs-on: ubuntu-latest + permissions: + checks: write # For trunk to post annotations + + steps: + - name: Checkout + uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0 + + - name: Trunk Check + uses: ./ # external users, use: trunk-io/trunk-action@v1 + + action_tests: + name: Action tests + uses: ./.github/workflows/action_tests.yaml + + repo_tests: + name: Repository tests + uses: ./.github/workflows/repo_tests.yaml + + docker_repo_tests: + name: Repository tests (docker) + uses: ./.github/workflows/docker_repo_tests.yaml diff --git a/.trunk/.gitignore b/.trunk/.gitignore new file mode 100644 index 0000000..15966d0 --- /dev/null +++ b/.trunk/.gitignore @@ -0,0 +1,9 @@ +*out +*logs +*actions +*notifications +*tools +plugins +user_trunk.yaml +user.yaml +tmp diff --git a/.trunk/configs/.markdownlint.yaml b/.trunk/configs/.markdownlint.yaml new file mode 100644 index 0000000..b40ee9d --- /dev/null +++ b/.trunk/configs/.markdownlint.yaml @@ -0,0 +1,2 @@ +# Prettier friendly markdownlint config (all formatting rules disabled) +extends: markdownlint/style/prettier diff --git a/.trunk/configs/.yamllint.yaml b/.trunk/configs/.yamllint.yaml new file mode 100644 index 0000000..184e251 --- /dev/null +++ b/.trunk/configs/.yamllint.yaml @@ -0,0 +1,7 @@ +rules: + quoted-strings: + required: only-when-needed + extra-allowed: ["{|}"] + key-duplicates: {} + octal-values: + forbid-implicit-octal: true diff --git a/.trunk/trunk.yaml b/.trunk/trunk.yaml new file mode 100644 index 0000000..97bebd4 --- /dev/null +++ b/.trunk/trunk.yaml @@ -0,0 +1,32 @@ +# This file controls the behavior of Trunk: https://docs.trunk.io/cli +# To learn more about the format of this file, see https://docs.trunk.io/reference/trunk-yaml +version: 0.1 +cli: + version: 1.21.0 +# Trunk provides extensibility via plugins. (https://docs.trunk.io/plugins) +plugins: + sources: + - id: trunk + ref: v1.4.5 + uri: https://github.com/trunk-io/plugins +# Many linters and tools depend on runtimes - configure them here. (https://docs.trunk.io/runtimes) +runtimes: + enabled: + - node@18.12.1 + - python@3.10.8 +# This is the section where you manage your linters. (https://docs.trunk.io/check/configuration) +lint: + enabled: + - checkov@3.2.60 + - git-diff-check + - markdownlint@0.39.0 + - prettier@3.2.5 + - trivy@0.50.1 + - trufflehog@3.71.0 + - yamllint@1.35.1 +actions: + enabled: + - trunk-announce + - trunk-check-pre-push + - trunk-fmt-pre-commit + - trunk-upgrade-available diff --git a/composer.json b/composer.json index 0b53652..43249f1 100644 --- a/composer.json +++ b/composer.json @@ -1,122 +1,117 @@ { - "name": "benzine/core", - "description": "The core nugget.", - "type": "library", - "license": "GPL-3.0-or-later", - "authors": [ - { - "name": "Matthew Baggett", - "email": "matthew@baggett.me" - } - ], - "config": { - "sort-packages": true - }, - "require": { - "php": ">=8.0", - "ext-apcu": "*", - "ext-curl": "*", - "ext-iconv": "*", - "ext-json": "*", - "ext-openssl": "*", - "ext-redis": "*", - "ext-reflection": "*", - "ext-simplexml": "*", - "ext-sockets": "*", - "ext-zip": "*", - "bjeavons/zxcvbn-php": "^1.0", - "brainmaestro/composer-git-hooks": "^2.8", - "bramus/monolog-colored-line-formatter": "~3.0", - "cache/apc-adapter": "^1.0", - "cache/apcu-adapter": "^1.0", - "cache/array-adapter": "^1.0", - "cache/chain-adapter": "^1.0", - "cache/redis-adapter": "^1.0", - "cocur/slugify": "^4.0", - "doctrine/annotations": "^1.10", - "donatj/flags": "^1.4", - "fakerphp/faker": "^1.14.1", - "friendsofphp/php-cs-fixer": "^3.0", - "kint-php/kint": "^4.0", - "kint-php/kint-twig": "^4.0", - "matthewbaggett/inflection": "^2.1", - "matthewbaggett/uuid": "^2.3", - "mattketmo/camel": "^1.1", - "maximebf/debugbar": "^1.16", - "middlewares/content-length": "^2.0", - "middlewares/debugbar": "^2.0", - "middlewares/encoder": "^2.1", - "middlewares/geolocation": "^3.0", - "middlewares/payload": "^3.0", - "middlewares/response-time": "^2.0", - "middlewares/trailing-slash": "^2.0", - "middlewares/whoops": "^2.0", - "monolog/monolog": "^2.1", - "php-di/slim-bridge": "^3.0", - "php-webdriver/webdriver": "^1.6", - "psr/cache": "^1.0", - "psr/container": "^1.0", - "psr/simple-cache": "^1.0", - "slim/http-cache": "^1.0", - "slim/psr7": "^1.1", - "slim/slim": "^4.5", - "slim/twig-view": "^3.2", - "squizlabs/php_codesniffer": "3.*", - "swaggest/json-schema": "^0.12.39", - "symfony/translation": "^5.1", - "symfony/twig-bridge": "^5.1", - "symfony/yaml": "^5.1", - "tuupola/server-timing-middleware": "^0.9", - "twig/extra-bundle": "^3", - "twig/intl-extra": "^3.0", - "twig/twig": "^3.0" - }, - "require-dev": { - "benzine/orm": "dev-master", - "brianium/paratest": "^6.0", - "clue/commander": "^v1.3.0", - "jc21/clitable": "^1.2", - "johnkary/phpunit-speedtrap": "^3.0.0", - "php-coveralls/php-coveralls": "^2.1", - "phpstan/phpstan": "^0.12", - "phpstan/phpstan-deprecation-rules": "^0.12", - "phpstan/phpstan-phpunit": "^0.12.16", - "phpstan/phpstan-symfony": "^0.12", - "phpunit/phpunit": "^9.2", - "slam/phpstan-extensions": "^5.0", - "thecodingmachine/phpstan-strict-rules": "^0.12", - "wyrihaximus/html-compress": "^4.1" - }, - "suggest": { - "benzine/orm" : "Model/Service/Crud generation made easy" - }, - "autoload": { - "psr-4": { - "Benzine\\": "src", - "Benzine\\Tests\\": "tests/" - } - }, - "bin": [ - "bin/queue-status", - "bin/queue-view-item", - "bin/worker" - ], - "extra": { - "hooks": { - "pre-commit": [ - "echo committing as $(git config user.name)", - "docker run --rm -i -v $(pwd):/app cytopia/php-cs-fixer:latest fix /app" - ], - "pre-push": [ - "composer install", - "docker run --rm -i -v $(pwd):/app cytopia/php-cs-fixer:latest fix /app", - "vendor/bin/phpstan analyse" - ], - "post-merge": "composer install --ignore-platform-reqs" - } - }, - "scripts": { - "post-install-cmd": "cghooks add --ignore-lock", - "post-update-cmd": "cghooks update" + "name": "benzine/core", + "description": "The core nugget.", + "type": "library", + "license": "GPL-3.0-or-later", + "authors": [ + { + "name": "Matthew Baggett", + "email": "matthew@baggett.me" } + ], + "config": { + "sort-packages": true + }, + "require": { + "php": ">=8.0", + "ext-apcu": "*", + "ext-curl": "*", + "ext-iconv": "*", + "ext-json": "*", + "ext-openssl": "*", + "ext-redis": "*", + "ext-reflection": "*", + "ext-simplexml": "*", + "ext-sockets": "*", + "ext-zip": "*", + "bjeavons/zxcvbn-php": "^1.0", + "bramus/monolog-colored-line-formatter": "~3.1", + "cache/apc-adapter": "^1.0", + "cache/apcu-adapter": "^1.0", + "cache/array-adapter": "^1.0", + "cache/chain-adapter": "^1.0", + "cache/redis-adapter": "^1.0", + "cocur/slugify": "^4.0", + "doctrine/annotations": "^1.10", + "donatj/flags": "^1.4", + "fakerphp/faker": "^1.14.1", + "friendsofphp/php-cs-fixer": "^3.0", + "kint-php/kint": "^4.0", + "kint-php/kint-twig": "^4.0", + "matthewbaggett/inflection": "^2.1", + "matthewbaggett/uuid": "^2.3", + "mattketmo/camel": "^1.1", + "maximebf/debugbar": "^1.16", + "middlewares/content-length": "^2.0", + "middlewares/debugbar": "^2.0", + "middlewares/encoder": "^2.1", + "middlewares/geolocation": "^3.0", + "middlewares/payload": "^3.0", + "middlewares/response-time": "^2.0", + "middlewares/trailing-slash": "^2.0", + "middlewares/whoops": "^2.0", + "monolog/monolog": "^3.6", + "php-di/slim-bridge": "^3.0", + "php-webdriver/webdriver": "^1.6", + "psr/cache": "^1.0", + "psr/container": "^1.0", + "psr/simple-cache": "^1.0", + "slim/http-cache": "^1.0", + "slim/psr7": "^1.1", + "slim/slim": "^4.5", + "slim/twig-view": "^3.2", + "squizlabs/php_codesniffer": "3.*", + "swaggest/json-schema": "^0.12.39", + "symfony/translation": "^5.1", + "symfony/twig-bridge": "^5.1", + "symfony/yaml": "^5.1", + "tuupola/server-timing-middleware": "^0.9", + "twig/extra-bundle": "^3", + "twig/intl-extra": "^3.0", + "twig/twig": "^3.0" + }, + "require-dev": { + "benzine/orm": "dev-main", + "brianium/paratest": "^7", + "clue/commander": "^v1.3.0", + "ergebnis/phpunit-slow-test-detector": "^2.1", + "jc21/clitable": "^1.2", + "php-coveralls/php-coveralls": "^2.1", + "phpstan/phpstan": "^0.12", + "phpstan/phpstan-deprecation-rules": "^0.12", + "phpstan/phpstan-phpunit": "^0.12.16", + "phpstan/phpstan-symfony": "^0.12", + "phpunit/phpunit": "^10", + "slam/phpstan-extensions": "^5.0", + "thecodingmachine/phpstan-strict-rules": "^0.12", + "wyrihaximus/html-compress": "^4.1" + }, + "suggest": { + "benzine/orm": "Model/Service/Crud generation made easy" + }, + "autoload": { + "psr-4": { + "Benzine\\": "src", + "Benzine\\Tests\\": "tests/" + } + }, + "bin": [ + "bin/queue-status", + "bin/queue-view-item", + "bin/worker" + ], + "extra": { + "hooks": { + "pre-commit": [ + "echo committing as $(git config user.name)", + "docker run --rm -i -v $(pwd):/app cytopia/php-cs-fixer:latest fix /app" + ], + "pre-push": [ + "composer install", + "docker run --rm -i -v $(pwd):/app cytopia/php-cs-fixer:latest fix /app", + "vendor/bin/phpstan analyse" + ], + "post-merge": "composer install --ignore-platform-reqs" + } + } }