diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..51f12e8 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,54 @@ +name: CI + +on: + push: + pull_request: + +jobs: + Build: + runs-on: ubuntu-latest + + strategy: + fail-fast: false + matrix: + php-versions: + - "7.4" + - "8.0" + - "8.1" + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-versions }} + extensions: ctype, mbstring + tools: cs2pr + + - name: Get Composer's cache directory + id: composer-cache-path + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + + - name: Cache Composer dependencies + uses: actions/cache@v3 + id: composer-cache + with: + path: ${{ steps.composer-cache-path.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: ${{ runner.os }}-composer- + + - name: Install dependencies + run: composer install + + - name: PHP-CS-Fixer + if: matrix.php-versions == '8.1' + run: vendor/bin/php-cs-fixer fix --dry-run --format=checkstyle | cs2pr + + # https://github.com/marketplace/actions/setup-php-action#phpunit + - name: Setup problem matchers for PHPUnit + run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json" + + - name: PHPUnit + run: vendor/bin/phpunit diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index eb69df9..0000000 --- a/.travis.yml +++ /dev/null @@ -1,37 +0,0 @@ -language: php -php: - - '7.0' - - '7.1' - - '7.2' - - '7.3' - - '7.4' - - '8.0' - -cache: - directories: - - vendor - - $HOME/.composer - -env: - global: - - DEFAULT_COMPOSER_FLAGS="--optimize-autoloader --no-interaction --no-progress" - -before_script: - - composer global show hirak/prestissimo -q || travis_retry composer global require $DEFAULT_COMPOSER_FLAGS hirak/prestissimo - - composer install --no-interaction - -stages: - - Static Code Analysis - - Test - -jobs: - include: - - stage: Static Code Analysis - php: 7.3 - script: - - vendor/bin/php-cs-fixer fix -v --dry-run - allow_failures: - - php: nightly - -script: - - vendor/bin/phpunit diff --git a/README.md b/README.md index 4268096..05fef1d 100644 --- a/README.md +++ b/README.md @@ -265,9 +265,9 @@ usages with native `::class` keyword, introduced in PHP 5.5. [ico-version]: https://img.shields.io/packagist/v/ely/php-code-style.svg?style=flat-square [ico-license]: https://img.shields.io/badge/license-Apache-green.svg?style=flat-square [ico-downloads]: https://img.shields.io/packagist/dt/ely/php-code-style.svg?style=flat-square -[ico-build-status]: https://img.shields.io/travis/elyby/php-code-style/master.svg?style=flat-square +[ico-build-status]: https://img.shields.io/github/workflow/status/elyby/php-code-style/CI.svg?style=flat-square [link-packagist]: https://packagist.org/packages/ely/php-code-style [link-contributors]: ../../contributors [link-downloads]: https://packagist.org/packages/ely/php-code-style/stats -[link-build-status]: https://travis-ci.org/elyby/php-code-style +[link-build-status]: https://github.com/elyby/php-code-style/actions