-
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
Thomas Jarrand
committed
Aug 6, 2021
1 parent
520741c
commit e0bef4b
Showing
14 changed files
with
537 additions
and
28 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,115 @@ | ||
name: 'CI' | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
|
||
jobs: | ||
|
||
lint: | ||
name: 'Lint' | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
|
||
steps: | ||
- name: 'Checkout' | ||
uses: actions/checkout@v2 | ||
|
||
- name: 'Setup PHP' | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
coverage: "none" | ||
extensions: "json" | ||
ini-values: "memory_limit=-1" | ||
php-version: "8.0" | ||
|
||
- name: 'Determine composer cache directory' | ||
id: composer-cache | ||
run: echo "::set-output name=directory::$(composer config cache-dir)" | ||
|
||
- name: 'Cache composer dependencies' | ||
uses: actions/cache@v2 | ||
with: | ||
path: ${{ steps.composer-cache.outputs.directory }} | ||
key: 7.4-composer-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: 7.4-composer- | ||
|
||
- name: 'Install dependencies' | ||
id: deps | ||
run: | | ||
echo "::group::composer update" | ||
composer update --no-progress --ansi | ||
echo "::endgroup::" | ||
echo "::group::install phpunit" | ||
# Required for PhpStan | ||
vendor/bin/simple-phpunit install | ||
echo "::endgroup::" | ||
- name: 'Composer validate' | ||
if: always() && steps.deps.outcome == 'success' | ||
run: composer validate --strict | ||
|
||
- name: 'PHP CS Fixer' | ||
if: always() && steps.deps.outcome == 'success' | ||
run: vendor/bin/php-cs-fixer fix --dry-run --diff | ||
|
||
- name: 'PhpStan' | ||
if: always() && steps.deps.outcome == 'success' | ||
run: vendor/bin/phpstan analyse | ||
|
||
tests: | ||
name: 'Tests' | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
|
||
strategy: | ||
fail-fast: false # don't cancel other matrix jobs on failure | ||
matrix: | ||
php: [ '7.4', '8.0' ] | ||
|
||
steps: | ||
- name: 'Checkout' | ||
uses: actions/checkout@v2 | ||
|
||
- name: 'Setup PHP' | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
coverage: "none" | ||
extensions: "json" | ||
ini-values: "memory_limit=-1" | ||
php-version: "${{ matrix.php }}" | ||
|
||
- name: 'Determine composer cache directory' | ||
id: composer-cache | ||
run: echo "::set-output name=directory::$(composer config cache-dir)" | ||
|
||
- name: 'Cache composer dependencies' | ||
uses: actions/cache@v2 | ||
with: | ||
path: ${{ steps.composer-cache.outputs.directory }} | ||
key: ${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: ${{ matrix.php }}-composer- | ||
|
||
- name: 'Fixup Composer' | ||
if: matrix.php == 8.0 | ||
run: | | ||
echo "::group::Fixup Composer platform config for third-parties deps not PHP 8 ready yet" | ||
composer config platform.php 7.4.99 | ||
echo "::endgroup::" | ||
- name: 'Install dependencies' | ||
run: | | ||
echo "::group::composer update" | ||
composer update --no-progress --ansi | ||
echo "::endgroup::" | ||
echo "::group::install phpunit" | ||
vendor/bin/simple-phpunit install | ||
echo "::endgroup::" | ||
- name: 'Run tests' | ||
run: vendor/bin/simple-phpunit --testdox | ||
|
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,2 +1,13 @@ | ||
###> symfony/phpunit-bridge ### | ||
.phpunit | ||
.phpunit.result.cache | ||
/phpunit.xml | ||
###< symfony/phpunit-bridge ###### | ||
|
||
###> friendsofphp/php-cs-fixer ### | ||
/.php-cs-fixer.php | ||
/.php-cs-fixer.cache | ||
###< friendsofphp/php-cs-fixer ### | ||
|
||
/vendor/ | ||
composer.lock |
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,29 @@ | ||
<?php | ||
|
||
$finder = (new PhpCsFixer\Finder())->in([ | ||
__DIR__ | ||
]); | ||
|
||
return (new PhpCsFixer\Config()) | ||
->setFinder($finder) | ||
->setCacheFile('.php-cs-fixer.cache') // forward compatibility with 3.x line | ||
->setRiskyAllowed(true) | ||
->setRules([ | ||
'@PSR12' => true, | ||
'@Symfony' => true, | ||
'strict_param' => true, | ||
'array_syntax' => ['syntax' => 'short'], | ||
'concat_space' => ['spacing' => 'one'], | ||
'declare_strict_types' => true, | ||
'native_function_invocation' => ['include' => ['@compiler_optimized']], | ||
'no_superfluous_phpdoc_tags' => true, | ||
'ordered_imports' => true, | ||
'phpdoc_annotation_without_dot' => false, | ||
'phpdoc_order' => true, | ||
'phpdoc_summary' => false, | ||
'simplified_null_return' => false, | ||
'single_line_throw' => false, | ||
'void_return' => true, | ||
'yoda_style' => false, | ||
]) | ||
; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,64 @@ | ||
.SILENT: | ||
|
||
## Colors | ||
COLOR_RESET = \033[0m | ||
COLOR_INFO = \033[32m | ||
COLOR_COMMENT = \033[33m | ||
|
||
## Help | ||
help: | ||
printf "${COLOR_COMMENT}Usage:${COLOR_RESET}\n" | ||
printf " make [target]\n\n" | ||
printf "${COLOR_COMMENT}Available targets:${COLOR_RESET}\n" | ||
awk '/^[a-zA-Z\-\_0-9\.@]+:/ { \ | ||
helpMessage = match(lastLine, /^## (.*)/); \ | ||
if (helpMessage) { \ | ||
helpCommand = substr($$1, 0, index($$1, ":")); \ | ||
helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \ | ||
printf " ${COLOR_INFO}%-16s${COLOR_RESET} %s\n", helpCommand, helpMessage; \ | ||
} \ | ||
} \ | ||
{ lastLine = $$0 }' $(MAKEFILE_LIST) | ||
|
||
########### | ||
# Install # | ||
########### | ||
|
||
## Install dependencies | ||
install: | ||
composer install | ||
composer update | ||
|
||
######## | ||
# Lint # | ||
######## | ||
|
||
lint: lint-twig | ||
## Run code style checks | ||
lint: lint.php-cs-fixer lint.phpstan lint.composer lint.twig | ||
|
||
lint.php-cs-fixer: | ||
vendor/bin/php-cs-fixer fix | ||
|
||
lint.phpstan: | ||
vendor/bin/phpstan analyse . | ||
|
||
lint.composer: | ||
composer validate --strict | ||
|
||
lint-twig: | ||
lint.twig: | ||
php bin/lint.twig.php Resources/views | ||
|
||
############ | ||
# Security # | ||
############ | ||
|
||
# Run Symfony security check | ||
security.symfony: | ||
symfony check:security | ||
|
||
######## | ||
# Test # | ||
######## | ||
|
||
## Run tests | ||
test: | ||
vendor/bin/simple-phpunit |
Oops, something went wrong.