Skip to content

Commit

Permalink
chore: refactor project structure (#243)
Browse files Browse the repository at this point in the history
Signed-off-by: azjezz <azjezz@protonmail.com>
  • Loading branch information
azjezz committed Oct 30, 2021
1 parent 9319563 commit c5cf61b
Show file tree
Hide file tree
Showing 34 changed files with 5,225 additions and 8,400 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
/.editorconfig export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/tools export-ignore
/config export-ignore
/tests export-ignore
/docs export-ignore

Expand Down
60 changes: 4 additions & 56 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,60 +9,8 @@ updates:
- "Status: Review Needed"
- "Subject: Dependencies"
commit-message:
prefix: "[dependencies]"
assignees:
- "azjezz"

- package-ecosystem: "composer"
directory: "/tools/phpunit"
schedule:
interval: "daily"
labels:
- "Priority: Medium"
- "Status: Review Needed"
- "Subject: Dependencies"
commit-message:
prefix: "[tools]"
assignees:
- "azjezz"

- package-ecosystem: "composer"
directory: "/tools/php-cs-fixer"
schedule:
interval: "daily"
labels:
- "Priority: Medium"
- "Status: Review Needed"
- "Subject: Dependencies"
commit-message:
prefix: "[tools]"
assignees:
- "azjezz"

- package-ecosystem: "composer"
directory: "/tools/php-codesniffer"
schedule:
interval: "daily"
labels:
- "Priority: Medium"
- "Status: Review Needed"
- "Subject: Dependencies"
commit-message:
prefix: "[tools]"
assignees:
- "azjezz"

- package-ecosystem: "composer"
directory: "/tools/psalm"
schedule:
interval: "daily"
labels:
- "Priority: Medium"
- "Status: Review Needed"
- "Subject: Dependencies"
commit-message:
prefix: "[tools]"
assignees:
prefix: "chore(dependencies)"
assignees:
- "azjezz"

- package-ecosystem: "github-actions"
Expand All @@ -74,6 +22,6 @@ updates:
- "Status: Review Needed"
- "Subject: Dependencies"
commit-message:
prefix: "[ga]"
assignees:
prefix: "chore(github-actions)"
assignees:
- "azjezz"
2 changes: 1 addition & 1 deletion .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:

- name: "installing dependencies"
run: |
make install-benchmark-dependencies -j10 -O
make install -j10 -O
- name: "running benchmarks"
run: make benchmarks
2 changes: 1 addition & 1 deletion .github/workflows/code-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:

- name: "installing dependencies"
run: |
make install-unit-tests-dependencies -j10 -O
make install -j10 -O
- name: "sending code coverage to coveralls"
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/coding-standards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:

- name: "installing dependencies"
run: |
make install-coding-standard-dependencies -j10 -O
make install -j10 -O
- name: "checking coding standards"
run: make coding-standard-check
2 changes: 1 addition & 1 deletion .github/workflows/security-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:

- name: "installing dependencies"
run: |
make install-static-analysis-dependencies -j10 -O
make install -j10 -O
- name: "running security analysis ( psalm )"
run: make security-analysis
2 changes: 1 addition & 1 deletion .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:

- name: "installing dependencies"
run: |
make install-static-analysis-dependencies -j10 -O
make install -j10 -O
- name: "running static analysis"
run: make static-analysis
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:

- name: "installing dependencies"
run: |
make install-unit-tests-dependencies -j10
make install -j10
- name: "running unit tests"
run: make unit-tests
6 changes: 1 addition & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,6 @@

# composer vendor dir
/vendor/
/tools/*/vendor/

# composer lock file
/composer.lock

# Mac DS_Store files
.DS_Store
Expand All @@ -19,7 +15,7 @@
/.php-cs-fixer.cache

# phpunit cache
/tools/phpunit/.phpunit.result.cache
/config/.phpunit.result.cache

# test logs
/tests/logs/*
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Here is a small checklist to get you going:

## Submitting Pull Requests

Before we can merge your Pull-Request here are some guidelines that you need to follow.
Before we can merge your Pull-Request, here are some guidelines that you need to follow.

These guidelines exist not to annoy you, but to keep the code base clean, unified and future proof.

Expand Down
43 changes: 14 additions & 29 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,53 +1,38 @@
help: ## shows this help
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_\-\.]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)

install-root-dependencies: ## install dependencies for the library itself
composer update

install-coding-standard-dependencies: install-root-dependencies ## install dependencies for coding-standard checks tooling
cd tools/php-cs-fixer && composer update --ignore-platform-req php
cd tools/php-codesniffer && composer install

install-benchmark-dependencies: install-root-dependencies ## install dependencies for benchmark tooling
cd tools/phpbench && composer install

install-static-analysis-dependencies: install-root-dependencies install-benchmark-dependencies ## install dependencies for static analysis tooling
cd tools/psalm && composer install

install-unit-tests-dependencies: install-root-dependencies ## install dependencies for the test suite
cd tools/phpunit && composer install

install: install-root-dependencies install-coding-standard-dependencies install-benchmark-dependencies install-static-analysis-dependencies install-unit-tests-dependencies ## install all dependencies for a development environment
install: ## install all dependencies for a development environment
composer install

coding-standard-fix: ## apply automated coding standard fixes
./tools/php-cs-fixer/vendor/bin/php-cs-fixer fix --config=tools/php-cs-fixer/.php_cs.dist.php
./tools/php-codesniffer/vendor/bin/phpcbf --basepath=. --standard=tools/php-codesniffer/.phpcs.xml
./vendor/bin/php-cs-fixer fix --config=config/.php_cs.dist.php
./vendor/bin/phpcbf --basepath=. --standard=config/.phpcs.xml

coding-standard-check: ## check coding-standard compliance
./tools/php-cs-fixer/vendor/bin/php-cs-fixer fix --config=tools/php-cs-fixer/.php_cs.dist.php --dry-run
./tools/php-codesniffer/vendor/bin/phpcs --basepath=. --standard=tools/php-codesniffer/.phpcs.xml
./vendor/bin/php-cs-fixer fix --config=config/.php_cs.dist.php --dry-run
./vendor/bin/phpcs --basepath=. --standard=config/.phpcs.xml

benchmarks: ## run benchmarks
./tools/phpbench/vendor/bin/phpbench run --config tools/phpbench/phpbench.json
./vendor/bin/phpbench run --config config/phpbench.json

create-benchmark-reference: ## run benchmarks, mark current run as "reference"
./tools/phpbench/vendor/bin/phpbench run --config tools/phpbench/phpbench.json --tag=benchmark_reference
./vendor/bin/phpbench run --config config/phpbench.json --tag=benchmark_reference

compare-benchmark-to-reference: ## run benchmarks, compare result to the "reference" run
./tools/phpbench/vendor/bin/phpbench run --config tools/phpbench/phpbench.json --ref=benchmark_reference
./vendor/bin/phpbench run --config config/phpbench.json --ref=benchmark_reference

static-analysis: ## run static analysis checks
./tools/psalm/vendor/bin/psalm -c tools/psalm/psalm.xml --show-info=true --no-cache
./tools/psalm/vendor/bin/psalm -c tools/psalm/psalm.xml tests/static-analysis --no-cache
./vendor/bin/psalm -c config/psalm.xml --show-info=true --no-cache
./vendor/bin/psalm -c config/psalm.xml tests/static-analysis --no-cache

type-coverage: ## send static analysis type coverage metrics to https://shepherd.dev/
./tools/psalm/vendor/bin/psalm -c tools/psalm/psalm.xml --shepherd --stats
./vendor/bin/psalm -c config/psalm.xml --shepherd --stats

security-analysis: ## run static analysis security checks
./tools/psalm/vendor/bin/psalm -c tools/psalm/psalm.xml --taint-analysis
./vendor/bin/psalm -c config/psalm.xml --taint-analysis

unit-tests: ## run unit test suite
./tools/phpunit/vendor/bin/phpunit -c tools/phpunit/phpunit.xml.dist
./vendor/bin/phpunit -c config/phpunit.xml.dist

code-coverage: unit-tests ## generate and upload test coverage metrics to https://coveralls.io/
composer global require php-coveralls/php-coveralls
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ declare(strict_types=1);
use Psl\{Str, Vec};

/**
* @psalm-param iterable<?int> $codes
* @param iterable<?int> $codes
*/
function foo(iterable $codes): string
{
Expand Down
8 changes: 8 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,14 @@
"ext-sodium": "*",
"ext-intl": "*"
},
"require-dev": {
"squizlabs/php_codesniffer": "^3.6",
"friendsofphp/php-cs-fixer": "^3.0",
"phpbench/phpbench": "^1.1",
"phpunit/phpunit": "^9.5",
"vimeo/psalm": "^4.11.2",
"php-standard-library/psalm-plugin": "^1.1.1"
},
"autoload": {
"files": [
"src/bootstrap.php"
Expand Down
Loading

0 comments on commit c5cf61b

Please sign in to comment.