Skip to content

Commit

Permalink
Feature/GitHub actions (#72)
Browse files Browse the repository at this point in the history
* add Github Actions config

* fix YAML syntax

* add dev dependencies; update Composer script paths

* update Travis CI config

* update Travis CI config: add os + version settings; rename matrix to jobs

* update Github Actions trigger events

* add links to README
  • Loading branch information
mjaschen authored Jul 13, 2020
1 parent 039a708 commit 72bc786
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 26 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
@@ -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
25 changes: 3 additions & 22 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
sudo: false

os: linux
dist: xenial
language: php

php:
Expand All @@ -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
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

<!-- MarkdownTOC autolink=true bracket=round depth=0 autoanchor=false -->

- [phpgeo - A Simple Geo Library for PHP](#phpgeo---a-simple-geo-library-for-php)
Expand Down Expand Up @@ -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
12 changes: 8 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 72bc786

Please sign in to comment.