diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000..2657b65f --- /dev/null +++ b/.editorconfig @@ -0,0 +1,20 @@ +root = true + +[*] +end_of_line = lf +indent_style = space +charset = utf-8 +insert_final_newline = true +trim_trailing_whitespace = true + +[*.{twig,php}] +indent_size = 4 + +[.yamllint] +indent_size = 4 + +[composer.json] +indent_size = 4 + +[Makefile] +indent_style = tab diff --git a/.gitattributes b/.gitattributes index dabb7332..7b43fe78 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,4 +1,6 @@ .* export-ignore *.md export-ignore -Tests export-ignore +Makefile export-ignore +phpunit.xml.dist export-ignore Resources/doc export-ignore +Tests export-ignore diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 00000000..e171c32c --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,87 @@ +name: Test + +on: + push: + branches: + - 3.x + - master + pull_request: + +env: + ACTIONS_ALLOW_UNSECURE_COMMANDS: true + +jobs: + test: + name: PHP ${{ matrix.php-version }} + ${{ matrix.dependencies }} + ${{ matrix.variant }} + + runs-on: ubuntu-latest + + continue-on-error: ${{ matrix.allowed-to-fail }} + + strategy: + matrix: + php-version: + - '7.2' + - '7.3' + - '7.4' + - '8.0' + dependencies: [highest] + allowed-to-fail: [false] + variant: [normal] + include: + - php-version: '7.2' + dependencies: lowest + allowed-to-fail: false + variant: 'vich/uploader-bundle' + - php-version: '7.3' + dependencies: highest + allowed-to-fail: false + variant: normal + - php-version: '7.4' + dependencies: highest + allowed-to-fail: false + variant: 'symfony/symfony:"4.4.*"' + - php-version: '7.4' + dependencies: highest + allowed-to-fail: false + variant: 'vich/uploader-bundle' + - php-version: '8.0' + dependencies: highest + allowed-to-fail: true + variant: normal + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Install PHP with extensions + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-version }} + coverage: pcov + tools: composer:v2 + + - name: Add PHPUnit matcher + run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" + + - name: Configuration required for PHP 8.0 + if: matrix.php-version == '8.0' + run: composer config platform.php 7.4.99 + + - name: Install variant + if: matrix.variant != 'normal' + run: composer require ${{ matrix.variant }} --no-update + + - name: "Install Composer dependencies (${{ matrix.dependencies }})" + uses: "ramsey/composer-install@v1" + with: + dependency-versions: "${{ matrix.dependencies }}" + composer-options: "--prefer-dist --prefer-stable" + + - name: Run Tests with "vich/uploader-bundle" + if: matrix.variant == 'vich/uploader-bundle' + run: make test_with_vichuploaderbundle + + - name: Run Tests + if: matrix.variant != 'vich/uploader-bundle' + run: make test diff --git a/.gitignore b/.gitignore index 3215fbdf..fd89d6d9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,8 @@ -/vendor/ +.php_cs.cache +.phpunit.result.cache /Tests/Functional/cache /Tests/Functional/logs +/vendor/ composer.lock +phpstan.neon phpunit.xml -.php_cs.cache -.phpunit.result.cache diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 6247898d..00000000 --- a/.travis.yml +++ /dev/null @@ -1,48 +0,0 @@ -language: php -warnings_are_errors: false - -php: - - 7.2 - - 7.3 - - 7.4 - - nightly - -env: - global: - - PATH="$HOME/.composer/vendor/bin:$PATH" - -matrix: - fast_finish: true - include: - - php: 7.2 - - php: 7.2 - env: COMPOSER_FLAGS="--prefer-lowest" - - php: 7.2 - env: SYMFONY_VERSION="^4.4.0" - - php: 7.2 - env: INSTALL_VICH_UPLOADER_BUNDLE=true - - php: 7.3 - - php: 7.4 - - php: 7.4 - env: COMPOSER_FLAGS="--prefer-lowest" - - php: 7.4 - env: INSTALL_VICH_UPLOADER_BUNDLE=true - allow_failures: - - php: nightly - -sudo: false - -cache: - directories: - - $HOME/.composer/cache - -before_script: - - if [ -f xdebug.ini ]; then phpenv config-rm xdebug.ini; fi - - if [ "$GITHUB_OAUTH_TOKEN" != "" ]; then echo -e $GITHUB_OAUTH_TOKEN && composer config -g github-oauth.github.com $GITHUB_OAUTH_TOKEN; fi; - - if [ 70100 -gt $(php -r 'echo PHP_VERSION_ID;') ]; then composer remove --dev "phpstan/phpstan" --no-update; fi; - - if [ "$SYMFONY_VERSION" != "" ]; then composer require "symfony/symfony:${SYMFONY_VERSION}" --no-update; fi; - - if [ ! -z $INSTALL_VICH_UPLOADER_BUNDLE ]; then composer require "vich/uploader-bundle" --no-update; fi; - - COMPOSER_MEMORY_LIMIT=-1 composer update --prefer-dist --no-interaction $COMPOSER_FLAGS - -script: - - if [ ! -z $INSTALL_VICH_UPLOADER_BUNDLE ]; then make test_with_vichuploaderbundle; else make test; fi; diff --git a/.yamllint b/.yamllint new file mode 100644 index 00000000..87af4168 --- /dev/null +++ b/.yamllint @@ -0,0 +1,7 @@ +extends: default + +rules: + document-start: disable + line-length: + max: 120 + level: warning diff --git a/phpunit.xml.dist b/phpunit.xml.dist index 31edd159..399bebb2 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -11,7 +11,7 @@ bootstrap="Tests/bootstrap.php" > - +