Skip to content

Commit

Permalink
Fix migration for Symfony 6.4
Browse files Browse the repository at this point in the history
  • Loading branch information
On5-Repos committed Jul 7, 2024
0 parents commit 6e199f6
Show file tree
Hide file tree
Showing 83 changed files with 5,161 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# These are supported funding model platforms

github: craigh
52 changes: 52 additions & 0 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: CodeCov

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

permissions:
contents: read

jobs:
coverage:
name: 'Code Coverage'

runs-on: ubuntu-latest

steps:
- name: 'Check out'
uses: actions/checkout@v3

- name: 'PHP setup'
uses: shivammathur/setup-php@v2
with:
php-version: '8.1'
coverage: pcov

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install Dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist

- name: Execute tests (Unit and Feature tests) via PHPUnit
run: vendor/bin/phpunit --coverage-clover coverage.xml

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v2
with:
# token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos
files: ./coverage.xml
# flags: unittests # optional
# name: codecov-umbrella # optional
# fail_ci_if_error: true # optional (default = false)
# verbose: true # optional (default = false)

147 changes: 147 additions & 0 deletions .github/workflows/symfony.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
name: Symfony

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

permissions:
contents: read

jobs:
cs-fixer:
name: 'PHP CS Fixer'

runs-on: 'ubuntu-latest'

strategy:
matrix:
php-version:
- '8.1'

steps:
- name: 'Check out'
uses: 'actions/checkout@v2'

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

- name: 'Get Composer cache directory'
id: 'composer-cache'
run: 'echo "::set-output name=cache-dir::$(composer config cache-files-dir)"'

- name: 'Cache dependencies'
uses: 'actions/cache@v2'
with:
path: '${{ steps.composer-cache.outputs.cache-dir }}'
key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}"
restore-keys: 'php-${{ matrix.php-version }}-composer-locked-'

- name: 'Install dependencies'
run: 'composer update --no-progress --prefer-stable'

- name: 'Check the code style'
run: 'vendor/bin/php-cs-fixer fix --diff --dry-run'

phpstan:
name: 'PhpStan'

runs-on: 'ubuntu-latest'

strategy:
matrix:
php-version:
- '8.1'

steps:
- name: 'Check out'
uses: 'actions/checkout@v2'

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

- name: 'Get Composer cache directory'
id: 'composer-cache'
run: 'echo "::set-output name=cache-dir::$(composer config cache-files-dir)"'

- name: 'Cache dependencies'
uses: 'actions/cache@v2'
with:
path: '${{ steps.composer-cache.outputs.cache-dir }}'
key: "php-${{ matrix.php-version }}-composer-locked-${{ hashFiles('composer.lock') }}"
restore-keys: 'php-${{ matrix.php-version }}-composer-locked-'

- name: 'Install dependencies'
run: 'composer update --no-progress --prefer-stable'

- name: 'Run PhpStan'
run: 'vendor/bin/phpstan analyze --no-progress'

symfony-tests:
name: 'PHPUnit'

runs-on: ubuntu-latest

strategy:
matrix:
include:
- php-version: '7.4'
composer-options: '--prefer-lowest --prefer-stable'
symfony-version: '5.4.*'
- php-version: '7.4'
composer-options: '--prefer-stable'
symfony-version: '5.4.*'
- php-version: '8.0'
composer-options: '--prefer-stable'
symfony-version: '5.4.*'
- php-version: '8.1'
composer-options: '--prefer-stable'
symfony-version: '5.4.*'
- php-version: '8.0'
composer-options: '--prefer-stable'
symfony-version: '6.0.*'
- php-version: '8.1'
composer-options: '--prefer-stable'
symfony-version: '6.1.*'

steps:
- name: 'Check out'
uses: actions/checkout@v3

- name: 'PHP setup'
uses: shivammathur/setup-php@v2
with:
php-version: '${{ matrix.php-version }}'
coverage: 'none'

- name: Copy .env.test.local
run: php -r "file_exists('.env.test.local') || copy('.env.test', '.env.test.local');"

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install Dependencies
run: composer install -q --no-ansi --no-interaction --no-scripts --no-progress --prefer-dist

- name: Create Database
run: |
mkdir -p data
touch data/database.sqlite
- name: Execute tests (Unit and Feature tests) via PHPUnit
env:
DATABASE_URL: sqlite:///%kernel.project_dir%/data/database.sqlite
run: vendor/bin/phpunit
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/.idea
/.DS_Store

/var
/vendor
/composer.lock
/.phpunit.result.cache
/temp-coverage
/coverage.xml

/.php-cs-fixer.cache
25 changes: 25 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

$finder = (new PhpCsFixer\Finder())
->in(['src', 'tests'])
;

return (new PhpCsFixer\Config())
->setRules([
'@Symfony' => true,
'declare_strict_types' => true,
'header_comment' => [
'header' => 'This file is part of the Zikula package.
Copyright Zikula - https://ziku.la/
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.',
'location' => 'after_declare_strict',
],
'nullable_type_declaration_for_default_null_value' => ['use_nullable_type_declaration' => true],
'no_superfluous_phpdoc_tags' => ['allow_mixed' => true],
])
->setRiskyAllowed(true)
->setFinder($finder)
;
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Version 1.0.1
=============
15 September 2023

- Allow newer versions of Twig (@Guite)
- Correct symfony/contracts to be more specific and fix Symfony v6 compatibility (@craigh)
- Fix small issue in unit tests (@On5-Repos)
- Fix dev dependencies at specific version (@mbabker)
- Reduce github actions matrix to only php 8.1 for QA related tools (@mbabker)
- Correct new QA issues from upgrades to tools (@craigh)

Version 1.0.0
=============
21 June 2022

- Initial release
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2022 Zikula Project

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
25 changes: 25 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# @see https://www.strangebuzz.com/en/snippets/the-perfect-makefile-for-symfony
.PHONY : cp test build deploy eol verify

## —— GENERAL —————————————————————————————————————————————————
help: ## Outputs this help screen
@grep -E '(^[a-zA-Z0-9_-]+:.*?##.*$$)|(^##)' $(MAKEFILE_LIST) | awk 'BEGIN {FS = ":.*?## "}{printf "\033[32m%-30s\033[0m %s\n", $$1, $$2}' | sed -e 's/\[32m##/[33m/'

## —— CODING —————————————————————————————————————————————————
cs: ## Check coding standards with php-cs-fixer (config = .php-cs-fixer.dist.php)
./vendor/bin/php-cs-fixer fix --dry-run

csf: ## Check coding standards with php-cs-fixer (config = .php-cs-fixer.dist.php)
./vendor/bin/php-cs-fixer fix

stan: ## PHPStan Static Code analysis
./vendor/bin/phpstan analyse

## —— TEST —————————————————————————————————————————————————
test: cs stan phpunit ## check coding standards and run tests

phpunit: ## Run PHPUnit Test
./vendor/bin/phpunit -c phpunit.xml.dist --coverage-text

phpunit-cov: ## Run PHPUnit Test with coverage. Output to html in /temp-coverage
XDEBUG_MODE=coverage ./vendor/bin/phpunit --coverage-clover coverage.xml
Loading

0 comments on commit 6e199f6

Please sign in to comment.