diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..8280ea0 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,147 @@ +name: CI + +on: + pull_request: + push: + branches: + - 'main' + +jobs: + composer-validate: + runs-on: ubuntu-latest + name: "Composer Validate" + steps: + - name: 'Checkout Code' + uses: actions/checkout@v2 + + - name: 'Validate composer.json' + run: composer validate --no-check-all --strict --no-check-lock + + composer-install: + needs: composer-validate + runs-on: ubuntu-latest + name: "Composer Install" + steps: + - name: 'Checkout Code' + uses: actions/checkout@v2 + + - name: 'Install Dependencies' + run: composer install --prefer-dist --no-progress --no-interaction + + code-style: + needs: composer-install + runs-on: ubuntu-latest + name: "Code Style" + strategy: + fail-fast: false + steps: + - name: 'Checkout Code' + uses: actions/checkout@v2 + + - name: 'Setup PHP' + uses: shivammathur/setup-php@v2 + with: + php-version: 8.0 + ini-values: memory_limit=-1 + coverage: none + tools: composer:v2 + + - name: 'Install PHP dependencies with Composer' + run: composer install --prefer-dist --no-progress --optimize-autoloader + working-directory: './' + + - name: 'Run CodeSniffer' + run: ./vendor/bin/phpcs ./ -p --encoding=utf-8 --extensions=php --ignore=vendor --ignore=tests --standard=phpcs.xml + + static-analysis: + needs: composer-install + runs-on: ubuntu-latest + name: "Static Analysis" + strategy: + fail-fast: false + steps: + - name: 'Checkout Code' + uses: actions/checkout@v2 + + - name: 'Setup PHP' + uses: shivammathur/setup-php@v2 + with: + php-version: 8.0 + ini-values: memory_limit=-1 + coverage: none + tools: composer:v2 + + - name: 'Install PHP dependencies with Composer' + run: composer install --prefer-dist --no-progress --optimize-autoloader + working-directory: './' + + - name: 'Run PHPStan' + run: ./vendor/bin/phpstan analyse --no-progress -c phpstan.neon ./ + + test: + needs: composer-install + runs-on: ubuntu-latest + name: "Tests (PHP ${{ matrix.php-version }})" + strategy: + fail-fast: false + matrix: + php-version: + - '7.2' + - '7.3' + - '7.4' + - '8.0' + steps: + - name: 'Checkout Code' + uses: actions/checkout@v2 + + - name: 'Setup PHP' + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-version }} + ini-values: memory_limit=-1 + coverage: none + tools: composer:v2 + + - name: 'Install PHP dependencies with Composer' + run: composer install --prefer-dist --no-progress --optimize-autoloader + working-directory: './' + + - name: 'Run PHPUnit' + run: ./vendor/bin/phpunit -v -c phpunit.xml.dist + + code-coverage: + needs: test + runs-on: ubuntu-latest + name: "Code Coverage" + strategy: + fail-fast: false + steps: + - name: 'Checkout Code' + uses: actions/checkout@v2 + + - name: 'Setup PHP' + uses: shivammathur/setup-php@v2 + with: + php-version: 7.4 + ini-values: memory_limit=-1 + coverage: pcov + tools: composer:v2 + + - name: 'Install PHP dependencies with Composer' + run: composer install --prefer-dist --no-progress --optimize-autoloader + working-directory: './' + + - name: 'Run PHPUnit with Code Coverage' + run: ./vendor/bin/phpunit -v -c phpunit.xml.dist --coverage-clover=coverage.xml + + - name: 'Download Coverage Files' + uses: actions/download-artifact@v2 + with: + path: reports + + - name: 'Upload to Codecov' + uses: codecov/codecov-action@v1 + with: + files: ./coverage.xml + fail_ci_if_error: true + verbose: true diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 23d58da..0000000 --- a/.travis.yml +++ /dev/null @@ -1,31 +0,0 @@ -language: php - -sudo: false - -php: - - 7.2 - - 7.3 - - 7.4 - - 8.0 - -before_script: - - composer self-update - -install: - - composer install --dev --no-interaction --prefer-dist - -script: - - ./vendor/bin/phpcs ./ -p --encoding=utf-8 --extensions=php --ignore=vendor --ignore=tests --standard=phpcs.xml - - ./vendor/bin/phpunit -c phpunit.xml.dist --coverage-clover=coverage.xml - - ./vendor/bin/phpstan analyse -l 8 --no-progress -c phpstan.neon ./ - -after_success: - - bash <(curl -s https://codecov.io/bash) - -cache: - directories: - - $COMPOSER_CACHE_DIR - -notifications: - email: - - genvaldartem@gmail.com diff --git a/README.md b/README.md index cad88ea..3b0f48d 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ PHP library for transliteration. πŸ‡ΊπŸ‡¦ πŸ‡¬πŸ‡§ πŸ‡·πŸ‡Ί πŸ”‘ 🐘 [![Scrutinizer Quality Score](https://img.shields.io/scrutinizer/g/fre5h/transliteration-php.svg?style=flat-square)](https://scrutinizer-ci.com/g/fre5h/transliteration-php/) -[![Build Status](https://img.shields.io/travis/fre5h/transliteration-php/master.svg?style=flat-square)](https://travis-ci.com/fre5h/transliteration-php) +[![Build Status](https://img.shields.io/github/workflow/status/fre5h/transliteration-php/CI/main?style=flat-square)](https://github.com/fre5h/transliteration-php/actions?query=workflow%3ACI+branch%3Amain+) [![CodeCov](https://img.shields.io/codecov/c/github/fre5h/transliteration-php.svg?style=flat-square)](https://codecov.io/github/fre5h/transliteration-php) [![License](https://img.shields.io/packagist/l/fresh/transliteration.svg?style=flat-square)](https://packagist.org/packages/fresh/transliteration) [![Latest Stable Version](https://img.shields.io/packagist/v/fresh/transliteration.svg?style=flat-square)](https://packagist.org/packages/fresh/transliteration) diff --git a/composer.json b/composer.json index 6034a3a..8281ade 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,7 @@ "php": ">=7.2" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^2.17", + "friendsofphp/php-cs-fixer": "^2.18", "phpstan/phpstan": "^0.12", "phpstan/phpstan-phpunit": "^0.12", "phpunit/phpunit": "~8.5",