Skip to content

Commit

Permalink
Merge 8862e63 into 0ec68b2
Browse files Browse the repository at this point in the history
  • Loading branch information
noelma committed Dec 11, 2022
2 parents 0ec68b2 + 8862e63 commit c02e810
Show file tree
Hide file tree
Showing 75 changed files with 7,146 additions and 4,723 deletions.
10 changes: 6 additions & 4 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@
/tests export-ignore
.coveralls.yml export-ignore
.gitattributes export-ignore
.github export-ignore
.gitignore export-ignore
.php_cs.dist export-ignore
.travis.yml export-ignore
.php-cs-fixer.dist.php export-ignore
Makefile export-ignore
phpdoc.dist.xml export-ignore
phpunit.xml export-ignore
phpunit.xml.dist export-ignore
phpstan.neon.dist export-ignore
rector.php export-ignore
USAGE.md export-ignore
README_fr.md export-ignore
README_fr.md export-ignore
55 changes: 55 additions & 0 deletions .github/workflows/github-actions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Tests

on: [push, pull_request]

jobs:
tests:
name: Tests PHP ${{ matrix.php }}
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental }}
strategy:
fail-fast: false
matrix:
php: [7.2, 7.3, 7.4, 8.0, 8.1, 8.2]
experimental: [false]
include:
- coverage: --no-coverage
- php: 7.2
analysis: true
coverage: --coverage-clover clover.xml

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Set up PHP ${{ matrix.php }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: xdebug

- name: Install dependencies with Composer
uses: ramsey/composer-install@v1

- name: Coding standards
if: matrix.analysis
run: bin/php-cs-fixer fix --ansi --dry-run --using-cache=no -v --diff

- name: Static analysis
if: matrix.analysis
run: bin/phpstan --memory-limit=1G analyse

- name: Unit tests
run: bin/phpunit ${{ matrix.coverage }}

- name: Refactoring
if: matrix.analysis
run: bin/rector --dry-run

- name: Upload coverage results to Coveralls
if: matrix.analysis
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
composer require php-coveralls/php-coveralls -n -W
bin/php-coveralls --coverage_clover=clover.xml -v
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Repertory
/.scannerwork/
/bin/
/build/
/nbproject/
/vendor/
Expand All @@ -8,4 +9,4 @@
/*.lock
/*.phar
/*.properties
/.php_cs.cache
/*.cache
10 changes: 10 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?php

$finder = PhpCsFixer\Finder::create()
->exclude('build')
->in(__DIR__);

$config = new Soosyze\PhpCsFixer\Config();
$config->setFinder($finder);

return $config;
106 changes: 0 additions & 106 deletions .php_cs.dist

This file was deleted.

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

This file was deleted.

91 changes: 91 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
SHELL=bash
SOURCE_DIR = $(shell pwd)
BIN_DIR = ${SOURCE_DIR}/bin
COMPOSER = composer

_CYAN=\033[36m
_GREEN=\033[32m
_END=\033[0m

define printSection
@printf "${_CYAN}\n══════════════════════════════════════════════════\n${_END}"
@printf "${_CYAN} $1 ${_END}"
@printf "${_CYAN}\n══════════════════════════════════════════════════\n${_END}"
endef

# _ _ _
# | | | | | |
# | |_| | ___| |_ __
# | _ |/ _ \ | '_ \
# | | | | __/ | |_) |
# \_| |_/\___|_| .__/
# | |
# |_|

.PHONY: help
help: ## Displays the list of commands
$(call printSection,HELP)
@grep -E '(^[a-zA-Z_-]+:.*?##.*$$)|(^##)' $(MAKEFILE_LIST) \
| sort \
| awk 'BEGIN {FS = ":.*?## "}; {printf "${_GREEN}%-20s${_END} %s\n", $$1, $$2}' \
| sed -e 's/##//'

# _____
# / __ \
# | / \/ ___ _ __ ___ _ __ ___ ___ ___ _ __
# | | / _ \| '_ ` _ \| '_ \ / _ \/ __|/ _ \ '__|
# | \__/\ (_) | | | | | | |_) | (_) \__ \ __/ |
# \____/\___/|_| |_| |_| .__/ \___/|___/\___|_|
# | |
# |_|

.PHONY: install
install: clean-vendor install-vendor ## Install the project

.PHONY: clean-vendor
clean-vendor: ## Remove composer dependencies
$(call printSection,CLEAN VENDOR)
rm -rf ${SOURCE_DIR}/vendor

.PHONY: install-vendor
install-vendor: ${SOURCE_DIR}/vendor/composer/installed.json ## Install composer dependencies

${SOURCE_DIR}/vendor/composer/installed.json:
$(call printSection,INSTALL VENDOR)
$(COMPOSER) --no-interaction install --ansi --no-progress --prefer-dist

# _____ _ _ _
# | _ | | (_) |
# | | | |_ _ __ _| |_| |_ _ _
# | | | | | | |/ _` | | | __| | | |
# \ \/' / |_| | (_| | | | |_| |_| |
# \_/\_\\__,_|\__,_|_|_|\__|\__, |
# __/ |
# |___/

.PHONY: cs-fix
cs-fix: ## Checks if code style is compliant
$(call printSection,PHP-CS-FIXER)
${BIN_DIR}/php-cs-fixer fix

.PHONY: rector
rector: ## Checks if the quality of the code is compliant
$(call printSection,RECTOR)
${BIN_DIR}/rector process --dry-run

.PHONY: phpstan
phpstan: ## Check if the data types are compliant
$(call printSection,PHPSTAN)
${BIN_DIR}/phpstan --memory-limit=1G analyse

# _____ _
# |_ _| | |
# | | ___ ___| |_
# | |/ _ \/ __| __|
# | | __/\__ \ |_
# \_/\___||___/\__|

.PHONY: test
test: ## Run unit tests
$(call printSection,TEST phpunit)
${BIN_DIR}/phpunit
Loading

0 comments on commit c02e810

Please sign in to comment.