From 678a8e81312aa0984e211a0ffb6cd0b75c9bd791 Mon Sep 17 00:00:00 2001 From: Jonathan Foote Date: Wed, 27 Jan 2021 13:08:24 -0600 Subject: [PATCH] Use Github Actions for automated tests --- .github/workflows/ci.yml | 36 ++++++++++++++++++++++++++++++++++++ .travis.yml | 17 ----------------- composer.json | 3 ++- phpunit.xml | 5 +++++ 4 files changed, 43 insertions(+), 18 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .travis.yml 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/.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/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 + +