diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml new file mode 100644 index 0000000..cd982d8 --- /dev/null +++ b/.github/workflows/php.yml @@ -0,0 +1,60 @@ +name: phpgeo Tests + +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + build: + + runs-on: ubuntu-latest + + strategy: + matrix: + php-versions: + - "7.2" + - "7.3" + - "7.4" + - "8.0" + name: PHP ${{ matrix.php-versions }} Tests + + steps: + - uses: actions/checkout@v2 + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-versions }} + coverage: xdebug + + - 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: Lint PHP Sources + run: composer run-script ci:lint + + - name: PHP Code Sniffer + run: composer run-script ci:sniff + + - name: Static Analysis + run: composer run-script ci:psalm + + - name: Unit Tests + run: composer run-script ci:tests diff --git a/.travis.yml b/.travis.yml index 4702819..1836d1b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,5 +1,5 @@ -sudo: false - +os: linux +dist: xenial language: php php: @@ -13,31 +13,12 @@ cache: - $HOME/.composer/cache env: - matrix: + jobs: - DEPENDENCIES=latest - DEPENDENCIES=oldest -before_install: -- > - echo "Disabling xdebug"; - if [[ ! "$TRAVIS_PHP_VERSION" =~ "7.4snapshot" ]]; then - phpenv config-rm xdebug.ini; - fi; - install: - > - echo; - echo "Installing Phive"; - wget -O phive.phar https://phar.io/releases/phive.phar; - wget -O phive.phar.asc https://phar.io/releases/phive.phar.asc; - gpg --keyserver pool.sks-keyservers.net --recv-keys 0x9D8A98B29B2D5D79; - gpg --verify phive.phar.asc phive.phar; - chmod +x phive.phar; - sudo mv phive.phar /usr/bin/phive; - echo "Installing Phive Tools"; - /usr/bin/phive install --trust-gpg-keys 2A8299CE842DD38C,4AA394086372C20A,31C7E470E2138192,8A03EA3B385DBAA1,4AA394086372C20A; - /usr/bin/phive status; - echo; if [ "$DEPENDENCIES" = "latest" ]; then echo "Installing the latest dependencies"; composer update --with-dependencies --prefer-stable --prefer-dist diff --git a/README.md b/README.md index 18ccce2..f24d6a3 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,11 @@ phpgeo provides abstractions to geographical coordinates (including support for different ellipsoids) and allows you to calculate geographical distances between coordinates with high precision. +- [phpgeo on Travis CI] +- [phpgeo on Packagist] + +## Table of Contents + - [phpgeo - A Simple Geo Library for PHP](#phpgeo---a-simple-geo-library-for-php) @@ -261,3 +266,5 @@ Psalm: * [Paul Vidal](https://github.com/paulvl) Polygon Implementation [Psalm]: https://github.com/vimeo/psalm +[phpgeo on TravisCI]: https://travis-ci.org/mjaschen/phpgeo +[phpgeo on Packagist]: https://packagist.org/packages/mjaschen/phpgeo \ No newline at end of file diff --git a/composer.json b/composer.json index 69e69f7..20a4657 100644 --- a/composer.json +++ b/composer.json @@ -50,14 +50,18 @@ } }, "require-dev": { - "daux/daux.io": "^0.12.0" + "daux/daux.io": "^0.14.0", + "phpunit/phpunit": "^8.0", + "vimeo/psalm": "^3.12", + "theseer/phpdox": "^0.12.0", + "squizlabs/php_codesniffer": "^3.5" }, "scripts": { "ci:composer-validate": "composer validate --no-check-all --no-check-lock --strict", "ci:lint": "find config src tests -name '*.php' -print0 | xargs -0 -n 1 -P 4 php -l", - "ci:psalm": "./tools/psalm", - "ci:sniff": "./tools/phpcs src tests", - "ci:tests": "./tools/phpunit tests/", + "ci:psalm": "./vendor/bin/psalm", + "ci:sniff": "./vendor/bin/phpcs src tests", + "ci:tests": "./vendor/bin/phpunit tests/", "ci:static": [ "@ci:composer-validate", "@ci:lint",