Skip to content

Commit

Permalink
Preparation70 (#14)
Browse files Browse the repository at this point in the history
* Test suite
* Doc and badges
* False positive error ignored
  • Loading branch information
Spomky authored Dec 8, 2021
1 parent 9738825 commit fbeb834
Show file tree
Hide file tree
Showing 37 changed files with 1,389 additions and 251 deletions.
23 changes: 23 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Contributing

First of all, **thank you** for contributing.

Bugs or feature requests can be posted online on the GitHub issues section of the project.

Few rules to ease code reviews and merges:

- You MUST follow the [PSR-12](http://www.php-fig.org/psr/psr-12/) coding standard.
- You MUST run the test suite.
- You MUST write (or update) unit tests when bugs are fixed or features are added.
- You SHOULD write documentation.

To contribute use [Pull Requests](https://help.github.com/articles/using-pull-requests), please, write commit messages that make sense, and rebase your branch before submitting your PR.

May be asked to squash your commits too. This is used to "clean" your Pull Request before merging it, avoiding commits such as fix tests, fix 2, fix 3, etc.

Run test suite
------------

* install composer: `curl -s http://getcomposer.org/installer | php`
* install dependencies: `php composer.phar install`
* run tests: `vendor/bin/phpunit`
2 changes: 2 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
github: Spomky
patreon: FlorentMorselli
21 changes: 21 additions & 0 deletions .github/ISSUE_TEMPLATE/1_Bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
name: 🐛 Bug Report
about: ⚠️ See below for security reports
labels: Bug

---

**Version(s) affected**: x.y.z

**Description**
<!-- A clear and concise description of the problem. -->

**How to reproduce**
<!-- Code and/or config needed to reproduce the problem. If it's a complex bug,
create a "bug reproducer" as explained in: -->

**Possible Solution**
<!--- Optional: only if you have suggestions on a fix/reason for the bug -->

**Additional context**
<!-- Optional: any other context about the problem: log messages, screenshots, etc. -->
12 changes: 12 additions & 0 deletions .github/ISSUE_TEMPLATE/2_Feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
name: 🚀 Feature Request
about: Ideas for new features and improvements

---

**Description**
<!-- A clear and concise description of the new feature. -->

**Example**
<!-- A simple example of the new feature in action (include PHP code, YAML config, etc.)
If the new feature changes an existing feature, include a simple before/after comparison. -->
11 changes: 11 additions & 0 deletions .github/ISSUE_TEMPLATE/3_Support_question.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
name: ⛔ Support Question
about: We usually do not provide support. Please ask your question on https://stackoverflow.com/

---

We use GitHub issues only to discuss bugs and new features.
For this kind of questions about using the library or the bundle, please use
https://stackoverflow.com/ using the tags `[aes]` and `[php]`

Thanks!
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/4_Documentation_issue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
name: 📖 Documentation Issue
about: To report typo or obsolete section in the documentation

---
19 changes: 19 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
| Q | A
| ------------- | ---
| Branch? | <!-- see below -->
| Bug fix? | yes/no
| New feature? | yes/no <!-- please update src/**/CHANGELOG.md files -->
| Deprecations? | yes/no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->
| Tickets | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exist, explain below instead -->
| License | MIT
<!--
Replace this notice by a short README for your feature/bugfix. This will help people
understand your PR and can be used as a start for the documentation.
Additionally:
- Always add tests and ensure they pass.
- Never break backward compatibility (unless you are working on the next major release branch).
- Bug fixes must be submitted against the lowest maintained branch where they apply
(lowest branches are regularly merged to upper ones so they get the fixes too.)
- Features and deprecations must be submitted against the last major branch (e.g. 1.x).
-->
8 changes: 8 additions & 0 deletions .github/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
daysUntilStale: 60
daysUntilClose: 7
staleLabel: wontfix
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs. Thank you
for your contributions.
closeComment: false
32 changes: 32 additions & 0 deletions .github/workflows/coding-standards.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Coding Standards

on: [push]

jobs:
tests:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ubuntu-latest]
php-versions: ['8.0']
name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }}

steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}

- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: json, mbstring, openssl, sqlite3
coverage: xdebug

- name: Install Composer dependencies
run: |
composer update --no-progress --no-suggest --prefer-dist --optimize-autoloader
- name: CONDING STANDARDS
run: make ci-cs
35 changes: 35 additions & 0 deletions .github/workflows/mutation-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Mutation Testing

on: [push]

jobs:
tests:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ubuntu-latest]
php-versions: ['8.0']
name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }}

steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}

- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: json, mbstring, openssl, sqlite3
coverage: xdebug

- name: Install Composer dependencies
run: |
composer update --no-progress --no-suggest --prefer-dist --optimize-autoloader
- name: Fetch Git base reference
run: git fetch --depth=1 origin $GITHUB_BASE_REF

- name: Infection
run: make ci-mu
29 changes: 29 additions & 0 deletions .github/workflows/rector_checkstyle.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Rector Checkstyle

on: [push]

jobs:
tests:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ ubuntu-latest ]
php-versions: [ '8.0' ]
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}

- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: json, mbstring, openssl, sqlite3
coverage: none

- name: Install Composer dependencies
run: composer update --no-progress --no-suggest --prefer-dist --optimize-autoloader

- name: Rector
run: make rector
32 changes: 32 additions & 0 deletions .github/workflows/static-analyze.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Static Analyze

on: [push]

jobs:
tests:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ubuntu-latest]
php-versions: ['8.0']
name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }}

steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}

- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: json, mbstring, openssl, sqlite3
coverage: xdebug

- name: Install Composer dependencies
run: |
composer update --no-progress --no-suggest --prefer-dist --optimize-autoloader
- name: PHPStan
run: make st
32 changes: 32 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Unit and Functional Tests

on: [push]

jobs:
tests:
runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: [ ubuntu-latest ]
php-versions: [ '8.0', '8.1' ]
name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }}

steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}

- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
extensions: json, mbstring, openssl, sqlite3
coverage: xdebug

- name: Install Composer dependencies
run: |
composer update --no-progress --no-suggest --prefer-dist --optimize-autoloader
- name: Run tests
run: make ci-cc
25 changes: 0 additions & 25 deletions .scrutinizer.yml

This file was deleted.

23 changes: 0 additions & 23 deletions .travis.yml

This file was deleted.

50 changes: 50 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
mu: vendor ## Mutation tests
vendor/bin/infection -s --threads=$(nproc) --min-msi=75 --min-covered-msi=75

tests: vendor ## Run all tests
vendor/bin/phpunit --color

cc: vendor ## Show test coverage rates (HTML)
vendor/bin/phpunit --coverage-html ./build

cs: vendor ## Fix all files using defined ECS rules
vendor/bin/ecs check --fix

tu: vendor ## Run only unit tests
vendor/bin/phpunit --color --group Unit

ti: vendor ## Run only integration tests
vendor/bin/phpunit --color --group Integration

tf: vendor ## Run only functional tests
vendor/bin/phpunit --color --group Functional

st: vendor ## Run static analyse
vendor/bin/phpstan analyse


################################################

ci-mu: vendor ## Mutation tests (for Github only)
vendor/bin/infection --logger-github -s --threads=$(nproc) --min-msi=75 --min-covered-msi=75

ci-cc: vendor ## Show test coverage rates (console)
vendor/bin/phpunit --coverage-text

ci-cs: vendor ## Check all files using defined ECS rules
vendor/bin/ecs check

################################################


vendor: composer.json composer.lock
composer validate
composer install

rector: vendor ## Check all files using Rector
vendor/bin/rector process --ansi --dry-run --xdebug

.DEFAULT_GOAL := help
help:
@grep -E '(^[a-zA-Z_-]+:.*?##.*$$)|(^##)' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[32m%-30s\033[0m %s\n", $$1, $$2}' | sed -e 's/\[32m##/[33m/'
.PHONY: help
Loading

0 comments on commit fbeb834

Please sign in to comment.