diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..cd890d3 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,36 @@ +name: Amplitude PHP CI + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + testsuite: + runs-on: ubuntu-latest + strategy: + matrix: + php-version: ['7.2', '7.3', '7.4'] + name: PHP ${{ matrix.php-version }} + steps: + - uses: actions/checkout@v2 + - name: Setup PHP with XDebug + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-version }} + coverage: xdebug + - name: Validate composer.json + run: composer validate + - name: Install dependencies + run: composer install + - name: Run test suite + run: vendor/bin/phpunit --coverage-clover build/logs/clover.xml + - name: PSR2 coverage + run: vendor/bin/phpcs --standard=psr2 src test + + - name: Upload coverage results to Coveralls (only for one result) + if: matrix.php-version == '7.2' + env: + COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: vendor/bin/php-coveralls --coverage_clover=build/logs/clover.xml -v diff --git a/.gitignore b/.gitignore index bafda97..5ed2b48 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ composer.phar composer.lock /vendor/ /build/ +.phpunit.result.cache diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 9e4d269..0000000 --- a/.travis.yml +++ /dev/null @@ -1,17 +0,0 @@ -language: php -sudo: false - -php: - - 7.2 - - 7.3 - -before_script: - - composer require satooshi/php-coveralls - - composer install --dev - -script: - - vendor/bin/phpunit --coverage-clover build/logs/clover.xml - - ./vendor/bin/phpcs --standard=psr2 src test - -after_success: - - php vendor/bin/coveralls diff --git a/README.md b/README.md index 39cc05b..43463fa 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # Zumba amplitude-php [![Software License](https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square)](LICENSE) -[![Build Status](https://img.shields.io/travis/zumba/amplitude-php/master.svg?style=flat-square)](https://travis-ci.org/zumba/amplitude-php) -[![Code Coverage](https://img.shields.io/coveralls/zumba/amplitude-php/master.svg)](https://coveralls.io/github/zumba/amplitude-php) +![Build Status](https://github.com/zumba/amplitude-php/workflows/Amplitude%20PHP%20CI/badge.svg) +[![Coverage Status](https://coveralls.io/repos/github/zumba/amplitude-php/badge.svg?branch=master)](https://coveralls.io/github/zumba/amplitude-php?branch=master) [![Scrutinizer](https://scrutinizer-ci.com/g/zumba/amplitude-php/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/zumba/amplitude-php/) This is a moderately thin PHP API for [Amplitude](https://amplitude.com/), powerful enough to do what you need without getting in the way. Designed to work well in 2 main scenarios: diff --git a/composer.json b/composer.json index ecd3caa..0f013d8 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,8 @@ }, "require-dev": { "phpunit/phpunit": "8.3.*", - "squizlabs/php_codesniffer": "3.4.*" + "squizlabs/php_codesniffer": "3.4.*", + "php-coveralls/php-coveralls": "^2.4" }, "autoload": { "psr-4": { diff --git a/phpunit.xml b/phpunit.xml index 3cda678..3fa7cdc 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -13,4 +13,9 @@ ./test + + + ./src + +