diff --git a/.github/workflows/codesniffer.yml b/.github/workflows/codesniffer.yml new file mode 100644 index 0000000..6a730e3 --- /dev/null +++ b/.github/workflows/codesniffer.yml @@ -0,0 +1,39 @@ +name: "Codesniffer" + +on: + pull_request: + + push: + branches: [ "*" ] + + schedule: + - cron: "0 8 * * 1" + +jobs: + phpstan: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: "Setup PHP" + uses: shivammathur/setup-php@v2 + with: + php-version: '8.2' + + - name: Validate composer.json and composer.lock + run: composer validate + + - name: Cache Composer packages + id: composer-cache + uses: actions/cache@v3 + with: + path: vendor + key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-php- + + - name: Install dependencies + run: composer install --prefer-dist --no-progress + - name: Run coding standards + run: make cs \ No newline at end of file diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml new file mode 100644 index 0000000..fba1147 --- /dev/null +++ b/.github/workflows/phpstan.yml @@ -0,0 +1,39 @@ +name: PHPstan + +on: + pull_request: + + push: + branches: [ "*" ] + + schedule: + - cron: "0 8 * * 1" + +jobs: + phpstan: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: "Setup PHP" + uses: shivammathur/setup-php@v2 + with: + php-version: '8.2' + + - name: Validate composer.json and composer.lock + run: composer validate + + - name: Cache Composer packages + id: composer-cache + uses: actions/cache@v3 + with: + path: vendor + key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-php- + + - name: Install dependencies + run: composer install --prefer-dist --no-progress + - name: Run phpstan + run: make phpstan \ No newline at end of file diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..f3f637d --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,39 @@ +name: PHP Unit tests + +on: + pull_request: + + push: + branches: [ "*" ] + + schedule: + - cron: "0 8 * * 1" + +jobs: + test82: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: "Setup PHP" + uses: shivammathur/setup-php@v2 + with: + php-version: '8.2' + + - name: Validate composer.json and composer.lock + run: composer validate + + - name: Cache Composer packages + id: composer-cache + uses: actions/cache@v3 + with: + path: vendor + key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-php- + + - name: Install dependencies + run: composer install --prefer-dist --no-progress + - name: Run tests + run: make tests \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e3abb61 --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +# IDE +/.idea + +# Composer +/vendor +composer.lock + +# Tests +/coverage.xml diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..8503b0e --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2023 Troia Studio + +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..189b76b --- /dev/null +++ b/Makefile @@ -0,0 +1,22 @@ +.PHONY: install tests qa cs csf phpstan + +install: + composer install + +qa: phpstan cs + +cs: +ifdef GITHUB_ACTION + vendor/bin/phpcs --standard=ruleset.xml --encoding=utf-8 --colors -nsp -q --report=checkstyle src tests +else + vendor/bin/phpcs --standard=ruleset.xml --encoding=utf-8 --colors -nsp src tests +endif + +csf: + vendor/bin/phpcbf --standard=ruleset.xml --encoding=utf-8 --colors -nsp src tests + +phpstan: + vendor/bin/phpstan analyse -c phpstan.neon + +tests: + vendor/bin/phpunit --bootstrap vendor/autoload.php tests \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..1c4a8ea --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# ssh-key-validator-nette diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..c88c6fb --- /dev/null +++ b/composer.json @@ -0,0 +1,38 @@ +{ + "name": "troia-studio/ssh-key-validator-nette", + "description": "Implementation troia-studio/ssh-key-validator to symfony", + "type": "library", + "autoload": { + "psr-4": { + "TroiaStudio\\SshKeyValidator\\": "src/" + } + }, + "autoload-dev": { + "psr-4": { + "Tests\\": "tests" + } + }, + "require": { + "php": ">=8.2", + "troia-studio/ssh-key-validator": "^1.0", + "troia-studio/ssh-key-validator-symfony": "^1.0" + }, + "require-dev": { + "phpunit/phpunit": "^10", + "contributte/qa": "^0.3.1", + "contributte/phpstan": "^0.1.0" + }, + "license": "MIT", + "authors": [ + { + "name": "Jan Galek", + "email": "me@jan-galek.cz" + } + ], + "minimum-stability": "stable", + "config": { + "allow-plugins": { + "dealerdirect/phpcodesniffer-composer-installer": true + } + } +} diff --git a/phpstan.neon b/phpstan.neon new file mode 100644 index 0000000..42589b0 --- /dev/null +++ b/phpstan.neon @@ -0,0 +1,15 @@ +includes: + - vendor/contributte/phpstan/phpstan.neon + +parameters: + level: 0 + phpVersion: 80200 + + scanDirectories: + - src + + fileExtensions: + - php + + paths: + - src \ No newline at end of file diff --git a/ruleset.xml b/ruleset.xml new file mode 100644 index 0000000..8b1bcde --- /dev/null +++ b/ruleset.xml @@ -0,0 +1,10 @@ + + + + + + + + + /tests/tmp + \ No newline at end of file