From 7633daeb47c45a3caa3e9ef7b9ea3d289b296bf8 Mon Sep 17 00:00:00 2001 From: Denis Date: Sat, 2 Aug 2025 10:44:13 +0300 Subject: [PATCH 01/11] feat: add docker file in folder --- .docker/Dockerfile | 15 +++++++++++++++ Dockerfile | 7 ------- docker-compose.yml | 4 ++-- 3 files changed, 17 insertions(+), 9 deletions(-) create mode 100755 .docker/Dockerfile delete mode 100755 Dockerfile diff --git a/.docker/Dockerfile b/.docker/Dockerfile new file mode 100755 index 0000000..60afeaa --- /dev/null +++ b/.docker/Dockerfile @@ -0,0 +1,15 @@ +FROM php:8.4-cli-alpine + +COPY php.ini /usr/local/etc/php/php.ini + +RUN apk add --no-cache --virtual .build-deps $PHPIZE_DEPS \ + && apk add --no-cache linux-headers + +RUN pecl install xdebug \ + && docker-php-ext-enable xdebug + +COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer + +WORKDIR /app + +COPY . /app diff --git a/Dockerfile b/Dockerfile deleted file mode 100755 index 10bb7b7..0000000 --- a/Dockerfile +++ /dev/null @@ -1,7 +0,0 @@ -FROM php:8.4-cli-alpine - -WORKDIR /app - -COPY . /app - -COPY --from=composer:latest /usr/bin/composer /usr/local/bin/composer \ No newline at end of file diff --git a/docker-compose.yml b/docker-compose.yml index cf8392c..ec47ef0 100755 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -3,8 +3,8 @@ services: app: container_name: scribe-plugin build: - context: ./ + context: .docker volumes: - ./:/app tty: true - stdin_open: true \ No newline at end of file + stdin_open: true From e3c409be95d0dff1e8cd5f6758d55a5d03893c60 Mon Sep 17 00:00:00 2001 From: Denis Date: Sat, 2 Aug 2025 10:44:28 +0300 Subject: [PATCH 02/11] fix: update actions - add new files --- .github/workflows/code-standart.yml | 38 ----------------------------- .github/workflows/lint.yml | 28 +++++++++++++++++++++ .github/workflows/tests.yml | 32 ++++++++++++++++++++++++ 3 files changed, 60 insertions(+), 38 deletions(-) delete mode 100644 .github/workflows/code-standart.yml create mode 100644 .github/workflows/lint.yml create mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/code-standart.yml b/.github/workflows/code-standart.yml deleted file mode 100644 index ce5bd95..0000000 --- a/.github/workflows/code-standart.yml +++ /dev/null @@ -1,38 +0,0 @@ -name: CODE CHECK - TESTS - -on: ['push', 'pull_request'] - -jobs: - coding-standard: - name: Coding Standard - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - - name: Setup PHP - uses: shivammathur/setup-php@v2 - with: - php-version: '8.4' - coverage: none - - - name: Get composer cache directory - id: composer-cache - run: | - echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT - - - name: Cache composer dependencies - uses: actions/cache@v4 - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} - restore-keys: | - ${{ runner.os }}-composer- - - - name: Install dependencies - run: composer install --no-progress --no-suggest --prefer-dist --no-interaction - - - name: Check coding style - run: composer cs-check - - - name: Run tests - run: composer tests diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000..af876c8 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,28 @@ +name: LINT + +on: ['push'] + +jobs: + coding-standard: + name: Coding Standard + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Setup PHP 8.4 + uses: shivammathur/setup-php@v2 + with: + php-version: '8.4' + coverage: none + extensions: dom, curl, libxml, mbstring, zip, pdo, sqlite, pdo_sqlite, bcmath, intl, gd + + - name: Cache composer dependencies + uses: actions/cache@v4 + with: + path: vendor + key: composer-${{ hashFiles('composer.lock') }} + + - name: Install dependencies + run: composer install + + - name: Run lint code + run: composer lint diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..c14caae --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,32 @@ +name: TESTS + +on: ['push'] + +jobs: + test: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + php: + - '8.4' + + name: Tests (PHP ${{ matrix.php }} - ${{ matrix.deps }}) + + steps: + - uses: actions/checkout@v3 + - name: Setup PHP ${{ matrix.php }} + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php }} + extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick + coverage: xdebug + + - name: Install dependencies + run: composer update + + - name: Test code + run: composer tests + + - name: Test coverage + run: composer tests-coverage From 6fc707388de17a11c293890109644e039219887c Mon Sep 17 00:00:00 2001 From: Denis Date: Sat, 2 Aug 2025 10:45:39 +0300 Subject: [PATCH 03/11] feat: add file config --- .docker/php.ini | 1 + 1 file changed, 1 insertion(+) create mode 100644 .docker/php.ini diff --git a/.docker/php.ini b/.docker/php.ini new file mode 100644 index 0000000..6f2ba38 --- /dev/null +++ b/.docker/php.ini @@ -0,0 +1 @@ +xdebug.mode=develop,debug,coverage From b4850c17785ffb9965b5065b4d6c8f112036d980 Mon Sep 17 00:00:00 2001 From: Denis Date: Sat, 2 Aug 2025 10:45:52 +0300 Subject: [PATCH 04/11] feat: add command and update old --- makefile | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/makefile b/makefile index afc4073..2860f47 100755 --- a/makefile +++ b/makefile @@ -9,18 +9,22 @@ up: build: docker compose up -d --build -# command for exec in container +# command for exec in app container exec: docker exec -it scribe-plugin /bin/sh -# command for install pkg +# command for install composer install: docker exec -i scribe-plugin composer install --dev -# command for run verify code -code-check: - docker exec -i scribe-plugin composer cs-check +# command for run lint code +lint: + docker exec -i scribe-plugin composer lint # command for run tests test: - docker exec -i scribe-plugin composer tests \ No newline at end of file + docker exec -i scribe-plugin composer tests + +# command for run tests coverage +test-coverage: + docker exec -i scribe-plugin composer tests From 95e6ffd5340383eba871ad14eab70b76dcc225b7 Mon Sep 17 00:00:00 2001 From: Denis Date: Sat, 2 Aug 2025 10:46:05 +0300 Subject: [PATCH 05/11] fix: add current unit tests --- phpunit.xml.dist | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/phpunit.xml.dist b/phpunit.xml.dist index e6198e0..ee6eaa4 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -5,13 +5,12 @@ colors="true" > - - ./tests + + tests/Unit - app src From aa7c8ef547799c2a2f5e07ede2e6a7c799d33348 Mon Sep 17 00:00:00 2001 From: Denis Date: Sat, 2 Aug 2025 10:46:13 +0300 Subject: [PATCH 06/11] feat: add command --- composer.json | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index fb28d4b..f1a289a 100755 --- a/composer.json +++ b/composer.json @@ -11,7 +11,7 @@ } ], "require": { - "php": "^8.4.0" + "php": ">=8.1" }, "autoload": { "psr-4": { @@ -25,8 +25,9 @@ }, "minimum-stability": "stable", "scripts": { - "tests": "php ./vendor/bin/pest", - "cs-check": [ + "tests": "pest --stop-on-failure --colors", + "tests-coverage": "pest --coverage --min=90", + "lint": [ "@phpstan", "@cs", "@rector" From 0a9369c0ed54e0f31346ec767bc5626f493bddb1 Mon Sep 17 00:00:00 2001 From: Denis Date: Sat, 2 Aug 2025 10:46:21 +0300 Subject: [PATCH 07/11] fix: update readme --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b0ee042..8ac7f34 100755 --- a/README.md +++ b/README.md @@ -2,7 +2,8 @@ This repository is designed to give you a template with which you can create your own packages. -GitHub Workflow Status +GitHub Workflow Status +GitHub Workflow Status Total Downloads Latest Version License From 9cbb3caff7b25c3b31422d47f466a268cdc2332c Mon Sep 17 00:00:00 2001 From: Denis Date: Sat, 2 Aug 2025 10:49:49 +0300 Subject: [PATCH 08/11] feat: add new version --- .github/workflows/tests.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index c14caae..eea4355 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -10,6 +10,9 @@ jobs: matrix: php: - '8.4' + - '8.3' + - '8.2' + - '8.1' name: Tests (PHP ${{ matrix.php }} - ${{ matrix.deps }}) From 24024c5c056a8150e6dcc65498ffeb31b017f1e0 Mon Sep 17 00:00:00 2001 From: Denis Date: Sat, 2 Aug 2025 10:51:12 +0300 Subject: [PATCH 09/11] fix: delete old version --- .github/workflows/tests.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index eea4355..20e1dd1 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -12,7 +12,6 @@ jobs: - '8.4' - '8.3' - '8.2' - - '8.1' name: Tests (PHP ${{ matrix.php }} - ${{ matrix.deps }}) From 01cf4ecd3c80f87c8425dc51dfcb23d28be7c325 Mon Sep 17 00:00:00 2001 From: Denis Date: Sat, 2 Aug 2025 11:07:16 +0300 Subject: [PATCH 10/11] feat: add new item in list --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8ac7f34..6a4a7dc 100755 --- a/README.md +++ b/README.md @@ -32,9 +32,12 @@ make init ## What do you get * Ready-made template project using the latest version of PHP -* Tests using pest +* Tests/Test Coverage using pest * Static analyzers: phpstan/rector/phpcs * Ready-made environment using docker +* Xdebug mod +* GitHub actions for lint/tests +* Issue Template for bug/question I would be glad to receive your **feedback** From 038671fddeea75ec91458138ae904a9078eb42c0 Mon Sep 17 00:00:00 2001 From: Denis Date: Sat, 2 Aug 2025 11:07:23 +0300 Subject: [PATCH 11/11] feat: add issue template --- .github/ISSUE_TEMPLATE/bug-report.yml | 35 +++++++++++++++++++++++++++ .github/ISSUE_TEMPLATE/question.yml | 24 ++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/bug-report.yml create mode 100644 .github/ISSUE_TEMPLATE/question.yml diff --git a/.github/ISSUE_TEMPLATE/bug-report.yml b/.github/ISSUE_TEMPLATE/bug-report.yml new file mode 100644 index 0000000..950f21e --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug-report.yml @@ -0,0 +1,35 @@ +name: Bug report +description: | + Something didn't work as expected? Create a report to help us improve. +labels: [ "bug", "triage" ] +assignees: [ ] +body: + - type: markdown + attributes: + value: | + Example description + - type: input + id: pkg_version + attributes: + label: Package name version + description: Run `composer show -v | grep package/name`. + placeholder: "example: 1.0.0" + validations: + required: true + - type: input + id: php_version + attributes: + label: PHP version + description: Run `php -v`. + placeholder: "example: 8.4" + validations: + required: true + - type: textarea + id: what-happened + attributes: + label: What happened? + description: | + Example description + placeholder: I ran `php artisan migration:fresh` on prod, and then... + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/question.yml b/.github/ISSUE_TEMPLATE/question.yml new file mode 100644 index 0000000..c294bf4 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/question.yml @@ -0,0 +1,24 @@ +name: Question +description: Ask or suggest something. +labels: ["question", "triage"] +assignees: [] +body: + - type: markdown + attributes: + value: | + Example description + - type: input + id: pkg_version + attributes: + label: Package name version + description: Run `composer show -v | grep package/name`. + placeholder: "example: 1.0.0" + validations: + required: true + - type: textarea + id: question + attributes: + label: Your question + placeholder: + validations: + required: true