diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml new file mode 100644 index 0000000..fe18c0b --- /dev/null +++ b/.github/workflows/php.yml @@ -0,0 +1,40 @@ +name: Unit Tests + +on: + push: + pull_request: + +jobs: + test: + runs-on: ubuntu-latest + + strategy: + matrix: + php: ["7.1", "7.2", "7.3", "7.4"] + + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Validate composer.json and composer.lock + run: composer validate + + - name: Cache Composer packages + id: composer-cache + uses: actions/cache@v2 + with: + path: vendor + key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} + restore-keys: | + ${{ runner.os }}-php- + + - name: Install dependencies + if: steps.composer-cache.outputs.cache-hit != 'true' + run: composer install --prefer-dist --no-progress --no-suggest + + - name: Run test suite + run: ./vendor/bin/phpunit --no-coverage + + - name: Run code style check + if: matrix.php == '7.1' + run: vendor/bin/php-cs-fixer fix --config=.php_cs.dist --verbose --diff --dry-run diff --git a/.php_cs.dist b/.php_cs.dist index 9879a52..6138fd4 100644 --- a/.php_cs.dist +++ b/.php_cs.dist @@ -44,6 +44,7 @@ $config = PhpCsFixer\Config::create() 'single_line_comment_style' => ['comment_types' => ['hash']], 'strict_comparison' => true, 'yoda_style' => ['equal' => false, 'identical' => false], + 'phpdoc_var_without_name' => false, ]); $config->setFinder( diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index ac931ed..0000000 --- a/.travis.yml +++ /dev/null @@ -1,61 +0,0 @@ -dist: bionic -sudo: false - -language: php - -matrix: - include: - - php: 7.1 - env: WITH_CS=true - - php: 7.1 - env: WITH_PHPUNIT=true WITH_COVERAGE=true - - php: 7.2 - env: WITH_PHPUNIT=true - - php: 7.3 - env: WITH_PHPUNIT=true - - php: 7.4 - env: WITH_PHPUNIT=true - - -cache: - directories: - - $HOME/.composer/cache - - $HOME/.php-cs-fixer - -before_install: - - | - if [[ "$WITH_COVERAGE" != "true" ]]; then - phpenv config-rm xdebug.ini - fi - if [[ "$WITH_CS" != "true" ]]; then - composer remove friendsofphp/php-cs-fixer --dev --no-update - fi - - composer validate - -install: - - composer install --no-interaction --prefer-source - -before_script: - - mkdir -p "$HOME/.php-cs-fixer" - - mkdir -p build/logs - -script: - - | - if [[ "$WITH_CS" == "true" ]]; then - vendor/bin/php-cs-fixer fix --config=.php_cs.dist --verbose --diff --dry-run - fi - - | - if [[ "$WITH_PHPUNIT" == "true" ]]; then - if [[ "$WITH_COVERAGE" == "true" ]]; then - vendor/bin/phpunit --coverage-clover=build/logs/coverage.clover - else - vendor/bin/phpunit --no-coverage - fi - fi - -after_script: - - | - if [[ "$WITH_COVERAGE" == "true" ]]; then - wget https://scrutinizer-ci.com/ocular.phar - php ocular.phar code-coverage:upload --format=php-clover build/logs/coverage.clover - fi