-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jan Galek
committed
Aug 3, 2023
1 parent
7d6750e
commit 9fba165
Showing
22 changed files
with
321 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,22 @@ | ||
.PHONY: install tests | ||
.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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
includes: | ||
- vendor/contributte/phpstan/phpstan.neon | ||
|
||
parameters: | ||
level: 0 | ||
phpVersion: 80200 | ||
|
||
scanDirectories: | ||
- src | ||
|
||
fileExtensions: | ||
- php | ||
|
||
paths: | ||
- src |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<ruleset name="TroiaStudio" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="vendor/squizlabs/php_codesniffer/phpcs.xsd"> | ||
<!-- Rulesets --> | ||
<rule ref="./vendor/contributte/qa/ruleset-8.2.xml"> | ||
<exclude name="Generic.WhiteSpace.DisallowSpaceIndent.SpacesUsed" /> | ||
</rule> | ||
<config name="php_version" value="80200"/> | ||
|
||
<!-- Rules --> | ||
<rule ref="SlevomatCodingStandard.Files.TypeNameMatchesFileName"> | ||
<properties> | ||
<property name="rootNamespaces" type="array"> | ||
<element key="src" value="TroiaStudio\SshKeyValidator"/> | ||
<element key="tests" value="Tests"/> | ||
</property> | ||
</properties> | ||
</rule> | ||
<rule ref="SlevomatCodingStandard.TypeHints.DeclareStrictTypes"> | ||
<properties> | ||
<property name="declareOnFirstLine" value="0"/> | ||
</properties> | ||
</rule> | ||
|
||
<rule ref="Generic.WhiteSpace.DisallowTabIndent" /> | ||
|
||
<!-- Excludes --> | ||
<exclude-pattern>/tests/tmp</exclude-pattern> | ||
</ruleset> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,17 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
declare(strict_types = 1); | ||
|
||
namespace TroiaStudio\SshKeyValidator\Enums; | ||
|
||
enum SSH_KEY: string | ||
enum SshKey: string | ||
{ | ||
|
||
case DSS = '/^(ssh-dss) (AAAAB3NzaC1kc3[0-9A-Za-z+\/]+[=]{0,3})(\s.*)?$/'; | ||
case ECDSA_SHA2_NITSTP256 = '/^(ecdsa-sha2-nistp256) (AAAAE2VjZHNhLXNoYTItbmlzdHAyNT[0-9A-Za-z+\/]+[=]{0,3})(\s.*)?$/'; | ||
case SK_ECDSA_SHA2_NITSTP256 = '/^([email protected]) (AAAAInNrLWVjZHNhLXNoYTItbmlzdHAyNTZAb3BlbnNzaC5jb2[0-9A-Za-z+\/]+[=]{0,3})(\s.*)?$/'; | ||
case ED25519 = '/^(ssh-ed25519) (AAAAC3NzaC1lZDI1NTE5[0-9A-Za-z+\/]+[=]{0,3})(\s.*)?$/'; | ||
case SK_ED25519 = '/^([email protected]) (AAAAGnNrLXNzaC1lZDI1NTE5QG9wZW5zc2guY29t[0-9A-Za-z+\/]+[=]{0,3})(\s.*)?$/'; | ||
case RSA = '/^(ssh-rsa) (AAAAB3NzaC1yc2[0-9A-Za-z+\/]+[=]{0,3})(\s.*)?$/'; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.