From 60a5e97d5a90bf6c1e600329b9b1dbff956f1b33 Mon Sep 17 00:00:00 2001 From: terremoth Date: Sat, 2 Mar 2024 21:12:37 -0300 Subject: [PATCH] First commit --- .editorconfig | 12 +++++++ .github/workflows/workflow.yml | 58 ++++++++++++++++++++++++++++++++++ README.md | 19 ++++++++++- composer.json | 56 ++++++++++++++++++++++++++++++++ phpcs.xml | 12 +++++++ phpmd.xml | 14 ++++++++ phpunit.xml | 23 ++++++++++++++ psalm.xml | 25 +++++++++++++++ src/vendor/.gitkeep | 0 tests/vendor/.gitkeep | 0 10 files changed, 218 insertions(+), 1 deletion(-) create mode 100644 .editorconfig create mode 100644 .github/workflows/workflow.yml create mode 100644 composer.json create mode 100644 phpcs.xml create mode 100644 phpmd.xml create mode 100644 phpunit.xml create mode 100644 psalm.xml create mode 100644 src/vendor/.gitkeep create mode 100644 tests/vendor/.gitkeep diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..f1e6bf7 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +root = true + +# Unix-style newlines with a newline ending every file +[*] +end_of_line = lf +insert_final_newline = true +charset = utf-8 +indent_style = space +indent_size = 4 + +[{*.yml, *.yaml}] +indent_size = 2 \ No newline at end of file diff --git a/.github/workflows/workflow.yml b/.github/workflows/workflow.yml new file mode 100644 index 0000000..de7399f --- /dev/null +++ b/.github/workflows/workflow.yml @@ -0,0 +1,58 @@ +name: Complete Workflow + +on: [ push, pull_request ] + +jobs: + run: + runs-on: ubuntu-latest + + steps: + - name: Checkout Actions + uses: actions/checkout@v4 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.2' +# coverage: none + + - name: Setup Composer + uses: php-actions/composer@v6 + + - name: Cache composer dependencies + uses: actions/cache@v4 + with: + path: vendor + key: composer-${{ hashFiles('composer.lock') }} + +# - name: Run composer install +# run: composer install -n --prefer-dist + + - name: Run psalm + run: ./vendor/bin/psalm --shepherd --threads=2 --no-cache --output-format=github + + - name: PHPUnit Tests + uses: php-actions/phpunit@v3 + env: + XDEBUG_MODE: coverage + with: + bootstrap: vendor/autoload.php + configuration: phpunit.xml + php_extensions: xdebug + args: tests --coverage-clover ./coverage.xml + + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v4.0.1 + with: + files: ./coverage.xml + verbose: true + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} + + - name: PHP Mess Detector + uses: php-actions/phpmd@v1 + with: + php_version: 8.1 + path: src/,demos/,tests/ + output: text + ruleset: phpmd.xml diff --git a/README.md b/README.md index 9a6e8cd..bf2eb83 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,19 @@ # php-project-template -My personal PHP projects template +My personal PHP projects template + +Change the "vendor" word to the correct repo vendor name + +[![CodeCov](https://codecov.io/gh/terremoth/vendor/graph/badge.svg?token=TOKEN)](https://app.codecov.io/gh/terremoth/vendor) +[![Psalm type coverage](https://shepherd.dev/github/terremoth/vendor/coverage.svg)](https://shepherd.dev/github/terremoth/vendor) +[![Psalm level](https://shepherd.dev/github/terremoth/vendor/level.svg)](https://shepherd.dev/github/terremoth/vendor) +[![Test Run Status](https://github.com/terremoth/vendor/actions/workflows/workflow.yml/badge.svg?branch=main)](https://github.com/terremoth/vendor/actions/workflows/workflow.yml) +[![Codacy Badge](https://app.codacy.com/project/badge/Grade/f77e487ba22943b5b199a2567f44d6af)](https://app.codacy.com/gh/terremoth/vendor/dashboard?utm_source=gh&utm_medium=referral&utm_content=&utm_campaign=Badge_grade) +[![Code Climate Maintainability](https://api.codeclimate.com/v1/badges/0b0046e370496f58fa6e/maintainability)](https://codeclimate.com/github/terremoth/vendor/maintainability) +[![License](https://img.shields.io/github/license/terremoth/vendor.svg?logo=gnu&color=41bb13)](https://github.com/terremoth/vendor/blob/main/LICENSE) + +See [demos/demo.php](demos/demo.php) for examples. + +## Installation + +- Clone this repo: +- `$ git clone ...` \ No newline at end of file diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..00e2435 --- /dev/null +++ b/composer.json @@ -0,0 +1,56 @@ +{ + "name": "terremoth/", + "description": "", + "type": "library", + "require": { + "php": "^8.1" + }, + "keywords": [ + "project-template", + ], + "require-dev": { + "phpunit/phpunit": "^10.0", + "vimeo/psalm": "^5.0", + "nikic/php-parser": "^4.10", + "squizlabs/php_codesniffer": "*", + "phpmd/phpmd": "@stable" + }, + "license": "GPL-3.0-or-later", + "autoload": { + "psr-4": { + "\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "\\Tests\\": "tests/" + } + }, + "authors": [ + { + "name": "terremoth", + "email": "dutra.astro@gmail.com" + } + ], + "minimum-stability": "stable", + "scripts": { + "fix": "vendor/bin/phpcbf", + "lint": "vendor/bin/phpcs --standard=phpcs.xml", + "analyze": "vendor/bin/psalm", + "test": "vendor/bin/phpunit tests", + "mess": "vendor/bin/phpmd src/,tests/,demos/ github cleancode,codesize,controversial,design,naming,unusedcode", + "ci": [ + "@composer lint", + "@composer analyze", + "@composer mess", + "@composer test" + ], + "build": [ + "@composer fix", + "@composer lint", + "@composer analyze", + "@composer mess", + "@composer test" + ] + } +} diff --git a/phpcs.xml b/phpcs.xml new file mode 100644 index 0000000..235a726 --- /dev/null +++ b/phpcs.xml @@ -0,0 +1,12 @@ + + + PHP Box Designer Coding Style + + + error + + src + tests + demos + diff --git a/phpmd.xml b/phpmd.xml new file mode 100644 index 0000000..70af8bc --- /dev/null +++ b/phpmd.xml @@ -0,0 +1,14 @@ + + + Best, complete and strict configs for PHPMD + + + + + + + diff --git a/phpunit.xml b/phpunit.xml new file mode 100644 index 0000000..04d743b --- /dev/null +++ b/phpunit.xml @@ -0,0 +1,23 @@ + + + + + tests + + + + + + src + + + diff --git a/psalm.xml b/psalm.xml new file mode 100644 index 0000000..f8ead91 --- /dev/null +++ b/psalm.xml @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + diff --git a/src/vendor/.gitkeep b/src/vendor/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/tests/vendor/.gitkeep b/tests/vendor/.gitkeep new file mode 100644 index 0000000..e69de29