diff --git a/.docker/Dockerfile b/.docker/Dockerfile index 9326c9c..67c5ff9 100755 --- a/.docker/Dockerfile +++ b/.docker/Dockerfile @@ -1,6 +1,7 @@ FROM composer -LABEL maintainer='dario.cancelliere@facile.it' +LABEL maintainer='artoo-dev@facile.it' +RUN apk add --update linux-headers RUN pecl channel-update pecl.php.net RUN pecl bundle -d /usr/src/php/ext/ xdebug RUN docker-php-ext-install xdebug diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml new file mode 100644 index 0000000..03168a2 --- /dev/null +++ b/.github/workflows/tests.yaml @@ -0,0 +1,57 @@ +name: "Tests" + +on: [push, pull_request] + +jobs: + phpunit: + name: "Tests" + runs-on: "ubuntu-22.04" + + strategy: + matrix: + php-version: + - "7.3" + - "7.4" + - "8.0" + - "8.1" + deps: + - "lowest" + - "highest" + coverage: + - "false" + include: + - deps: "highest" + php-version: "8.1" + coverage: "true" + + steps: + - name: "Checkout" + uses: "actions/checkout@v2" + with: + fetch-depth: 2 + - name: "Install PHP" + uses: "shivammathur/setup-php@v2" + with: + php-version: "${{ matrix.php-version }}" + coverage: "pcov" + ini-values: "zend.assertions=1" + - name: "Install dependencies" + uses: ramsey/composer-install@v1 + with: + dependency-versions: ${{ matrix.deps }} + composer-options: --prefer-dist + - name: "Run PHPUnit" + run: "vendor/bin/phpunit" + if: "${{ matrix.coverage != 'true' }}" + - name: "Run PHPUnit with coverage" + run: "vendor/bin/phpunit --coverage-clover=coverage.xml" + - name: "Run PHP-CS-Fixer (E2E test)" + run: "vendor/bin/php-cs-fixer fix --dry-run --diff" + if: "${{ matrix.deps != 'lowest' && matrix.php-version != '8.1' }}" + - uses: actions/checkout@v2 + - name: Upload Scrutinizer coverage + if: "${{ matrix.deps == 'highest' && matrix.php-version == '8.1' && matrix.coverage == 'true' }}" + uses: sudo-bot/action-scrutinizer@latest + with: + args: + coverage-file: "coverage.xml" diff --git a/.scrutinizer.yml b/.scrutinizer.yml index 2e93a93..217aac6 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -1,3 +1,8 @@ +build: + image: default-bionic + environment: + php: 8.1 + checks: php: true @@ -22,3 +27,4 @@ tools: filter: excluded_paths: - tests/* + - .phpstorm.meta.php diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 7ced4d0..0000000 --- a/.travis.yml +++ /dev/null @@ -1,31 +0,0 @@ -language: php -sudo: false -cache: - directories: - - ${HOME}/.composer/cache/files - -matrix: - include: - - php: 7.1 - env: - - DEPS_LOWEST=1 - - php: 7.4 - env: - - COVERAGE=1 - - PHPSTAN=1 - - php: nightly - fast_finish: true - allow_failures: - - php: nightly - -install: - - phpenv config-rm xdebug.ini || true - - if [[ ${DEPS_LOWEST} == 1 ]]; then composer update --prefer-dist --prefer-stable --prefer-lowest --no-interaction; fi - - if [[ ${DEPS_LOWEST} != 1 ]]; then composer update --prefer-source --no-interaction; fi - -script: - - if [[ ${PHPSTAN} == 1 ]]; then ./vendor/bin/phpstan analyse --level 5 ./src/ ./tests/; fi - - if [[ ${COVERAGE} == 1 ]]; then phpdbg -qrr ./vendor/bin/phpunit --coverage-clover ./build/logs/clover.xml; else ./vendor/bin/phpunit; fi - -after_success: - - if [[ ${COVERAGE} == 1 ]]; then wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover ./build/logs/clover.xml; fi diff --git a/composer.json b/composer.json index cad2897..d14d5c7 100644 --- a/composer.json +++ b/composer.json @@ -4,16 +4,19 @@ "type": "library", "license": "proprietary", "require": { - "php": "^7.1", + "php": "7.3 - 8.1", "ext-json": "*", "psr/container": "^1.0" }, "require-dev": { - "facile-it/facile-coding-standard": "^0.3.1", + "facile-it/facile-coding-standard": "^0.3.1|^0.5.2", "phpstan/phpstan": "^0.12.8", - "phpunit/phpunit": "^7.5|^8.5" + "phpunit/phpunit": "^7.5|^8.5.23" }, "config": { + "allow-plugins": { + "facile-it/facile-coding-standard": true + }, "optimize-autoloader": true, "preferred-install": { "*": "dist" diff --git a/docker-compose.yaml b/docker-compose.yaml index fe89910..548b9eb 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -8,3 +8,4 @@ services: - ./:/dist/:cached - ./.docker/xdebug.ini:/usr/local/etc/php/conf.d/xdebug.ini:ro working_dir: /dist/ + command: composer install