From 7d2fd17a83c3ce09428f4f48ce8e3333a3fdd794 Mon Sep 17 00:00:00 2001 From: Wilmer Arambula <42547589+terabytesoftw@users.noreply.github.com> Date: Sun, 2 Jul 2023 12:07:30 -0400 Subject: [PATCH] Update template. (#9) --- .gitattributes | 23 ++++++++----- .github/workflows/build.yml | 4 ++- .github/workflows/dependency-check.yml | 2 +- .github/workflows/mutation.yml | 6 ++-- .github/workflows/static.yml | 2 +- .gitignore | 6 ++-- README.md | 46 ++++++-------------------- composer.json | 8 ++--- docs/testing.md | 35 ++++++++++++++++++++ phpunit.xml.dist | 46 +++++++++++--------------- 10 files changed, 93 insertions(+), 85 deletions(-) create mode 100644 docs/testing.md diff --git a/.gitattributes b/.gitattributes index 7c3b027..65a6a4e 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,5 +1,5 @@ # Autodetect text files -* text=auto +* text=auto eol=lf # ...Unless the name matches the following overriding patterns @@ -21,14 +21,19 @@ *.gif binary *.ttf binary -# Ignore some meta files when creating an archive of this repository -/.github export-ignore -/.editorconfig export-ignore -/.gitattributes export-ignore -/.gitignore export-ignore -/.scrutinizer.yml export-ignore -/docs export-ignore - # Avoid merge conflicts in CHANGELOG # https://about.gitlab.com/2015/02/10/gitlab-reduced-merge-conflicts-by-90-percent-with-changelog-placeholders/ /CHANGELOG.md merge=union + +# Exclude files from the archive +/.gitattributes export-ignore +/.github export-ignore +/.gitignore export-ignore +/.styleci.yml export-ignore +/codeception.yml export-ignore +/composer-require-checker.json export-ignore +/docs export-ignore +/phpunit.xml.dist export-ignore +/psalm.xml export-ignore +/rector.php export-ignore +/tests export-ignore diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f12ea5e..812f3db 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -23,7 +23,9 @@ name: build jobs: phpunit: - uses: yiisoft/actions/.github/workflows/phpunit.yml@master + uses: php-forge/actions/.github/workflows/phpunit.yml@main + secrets: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} with: os: >- ['ubuntu-latest', 'windows-latest'] diff --git a/.github/workflows/dependency-check.yml b/.github/workflows/dependency-check.yml index fba3d14..5b57355 100644 --- a/.github/workflows/dependency-check.yml +++ b/.github/workflows/dependency-check.yml @@ -25,7 +25,7 @@ name: dependency-check jobs: composer-require-checker: - uses: yiisoft/actions/.github/workflows/composer-require-checker.yml@master + uses: php-forge/actions/.github/workflows/composer-require-checker.yml@main with: os: >- ['ubuntu-latest'] diff --git a/.github/workflows/mutation.yml b/.github/workflows/mutation.yml index c1aca98..ef6929b 100644 --- a/.github/workflows/mutation.yml +++ b/.github/workflows/mutation.yml @@ -21,11 +21,11 @@ name: mutation test jobs: mutation: - uses: yiisoft/actions/.github/workflows/roave-infection.yml@master + uses: php-forge/actions/.github/workflows/roave-infection.yml@main + secrets: + STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }} with: os: >- ['ubuntu-latest'] php: >- ['8.1'] - secrets: - STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }} diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml index 301ab7c..2dbe430 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/static.yml @@ -23,7 +23,7 @@ name: static analysis jobs: psalm: - uses: yiisoft/actions/.github/workflows/psalm.yml@master + uses: php-forge/actions/.github/workflows/psalm.yml@main with: os: >- ['ubuntu-latest'] diff --git a/.gitignore b/.gitignore index b3e357c..33918c0 100644 --- a/.gitignore +++ b/.gitignore @@ -13,14 +13,12 @@ # phpunit phpunit.phar -/phpunit.xml .phpunit.result.cache +.phpunit.cache +phpunit.xlm #yii3 config packages /config/packages # windows thumbnail cache Thumbs.db - -# package-lock.json -package-lock.json diff --git a/README.md b/README.md index 21e5186..4a0e65d 100644 --- a/README.md +++ b/README.md @@ -6,45 +6,19 @@

-## Install +## Requirements -For use create a new repository from this template. For more information see [Creating a repository from a template](https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/creating-a-repository-from-a-template). +The minimun version of `PHP` required by this package is `PHP 8.1`. -Also you can git clone this repository. For more information see [Cloning a repository](https://docs.github.com/en/github/creating-cloning-and-archiving-repositories/cloning-a-repository). +For install this package, you need [composer](https://getcomposer.org/). -## Checking dependencies +## Usage -This package uses [composer-require-checker](https://github.com/maglnet/ComposerRequireChecker) to check if all dependencies are correctly defined in `composer.json`. - -To run the checker, execute the following command: - -```shell -composer run check-dependencies -``` - -## Mutation testing - -Mutation testing is checked with [Infection](https://infection.github.io/). To run it: - -```shell -composer run mutation -``` - -## Static analysis - -The code is statically analyzed with [Psalm](https://psalm.dev/). To run static analysis: - -```shell -composer run psalm -``` +[Check the documentation docs](/docs/README.md) to learn about usage. ## Testing -The code is tested with [PHPUnit](https://phpunit.de/). To run tests: - -``` -composer run test -``` +[Check the documentation testing](/docs/testing.md) to learn about testing. ## CI status @@ -55,10 +29,10 @@ composer run test [![type-coverage](https://shepherd.dev/github/yii-tools/template/coverage.svg)](https://shepherd.dev/github/yii-tools/template) [![StyleCI](https://github.styleci.io/repos/494495136/shield?branch=main)](https://github.styleci.io/repos/494495136?branch=main) -## License - -The MIT License (MIT). Please see [License File](LICENSE.md) for more information. - ## Our social networks [![Twitter](https://img.shields.io/badge/twitter-follow-1DA1F2?logo=twitter&logoColor=1DA1F2&labelColor=555555?style=flat)](https://twitter.com/Terabytesoftw) + +## License + +The MIT License (MIT). Please see [License File](LICENSE.md) for more information. diff --git a/composer.json b/composer.json index 480ae41..57e194a 100644 --- a/composer.json +++ b/composer.json @@ -12,10 +12,10 @@ "php": "^8.1" }, "require-dev": { - "maglnet/composer-require-checker": "^4.3", - "phpunit/phpunit": "^9.5", - "roave/infection-static-analysis-plugin": "^1.28", - "vimeo/psalm": "^5.6" + "maglnet/composer-require-checker": "^4.6", + "phpunit/phpunit": "^10.2", + "roave/infection-static-analysis-plugin": "^1.32", + "vimeo/psalm": "^5.1" }, "autoload": { "psr-4": { diff --git a/docs/testing.md b/docs/testing.md new file mode 100644 index 0000000..63478f7 --- /dev/null +++ b/docs/testing.md @@ -0,0 +1,35 @@ +# Testing + +## Checking dependencies + +This package uses [composer-require-checker](https://github.com/maglnet/ComposerRequireChecker) to check if all dependencies are correctly defined in `composer.json`. + +To run the checker, execute the following command: + +```shell +composer run check-dependencies +``` + +## Mutation testing + +Mutation testing is checked with [Infection](https://infection.github.io/). To run it: + +```shell +composer run mutation +``` + +## Static analysis + +The code is statically analyzed with [Psalm](https://psalm.dev/). To run static analysis: + +```shell +composer run psalm +``` + +## Unit tests + +The code is tested with [PHPUnit](https://phpunit.de/). To run tests: + +``` +composer run test +``` diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 80517a2..f29a28d 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,30 +1,24 @@ - - + - - - - - - - ./src - - - ./vendor - - + + + tests + + - - - ./tests - - + + + ./src + +