Skip to content

Commit

Permalink
Convert to GitHub Actions for CI Testing
Browse files Browse the repository at this point in the history
  • Loading branch information
giggsey committed May 23, 2020
1 parent cb79970 commit 53bdad1
Show file tree
Hide file tree
Showing 5 changed files with 102 additions and 46 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,6 @@ tests/ export-ignore
build.xml export-ignore
libphonenumber-for-php.spec export-ignore
phpunit.xml.dist export-ignore
.github/ export-ignore

* text=auto
99 changes: 99 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: "Continuous Integration"

on:
push:
paths-ignore:
- 'docs/**'
pull_request:
paths-ignore:
- 'docs/**'

env:
COMPOSER_FLAGS: "--ansi --no-interaction --no-progress --no-suggest --prefer-dist"
COVERAGE_FLAGS: "--coverage-text --coverage-clover build/logs/clover.xml"

jobs:
tests:
name: PHP ${{ matrix.php-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
php-version:
- "5.3"
- "5.4"
- "5.5"
- "5.6"
- "7.0"
- "7.1"
- "7.2"
- "7.3"
- "7.4"
include:
- php-version: 5.3
dependencies: lowest
- php-version: 7.4
coverage: coverage
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: mbstring, dom
coverage: xdebug
env:
update: true
COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Problem Matchers for PHPUnit
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"
- name: Cache composer dependencies
uses: actions/cache@v1
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json') }}
restore-keys: ${{ matrix.php-version }}-composer-
- name: Install Composer dependencies (highest)
if: "matrix.dependencies != 'lowest'"
uses: nick-invision/retry@v1
with:
timeout_minutes: 10
max_attempts: 3
command: composer update ${{ env.COMPOSER_FLAGS }}
- name: Install Composer dependencies (lowest)
if: "matrix.dependencies == 'lowest'"
uses: nick-invision/retry@v1
with:
timeout_minutes: 10
max_attempts: 3
command: composer update ${{ env.COMPOSER_FLAGS }} --prefer-lowest --prefer-stable
- name: composer validate
run: composer validate --strict
- name: Test with phpunit (with coverage)
id: phpunit-coverage
if: "matrix.coverage == 'coverage'"
run: vendor/bin/phpunit ${{ env.COVERAGE_FLAGS }}
- name: Test with phpunit (without coverage)
if: "matrix.coverage != 'coverage'"
run: vendor/bin/phpunit
- name: Upload code coverage to Scrutinize
if: steps.phpunit-coverage.outcome == 'success'
uses: nick-invision/retry@v1
with:
timeout_minutes: 10
max_attempts: 3
command: |
wget -q https://scrutinizer-ci.com/ocular.phar
php ocular.phar code-coverage:upload --format=php-clover ./build/logs/clover.xml
- name: Submit Coveralls
if: steps.phpunit-coverage.outcome == 'success'
run: |
[[ -f vendor/bin/php-coveralls ]] && COVERALLS_PATH=vendor/bin/php-coveralls || COVERALLS_PATH=vendor/bin/coveralls
php $COVERALLS_PATH -v --exclude-no-stmt
env:
COVERALLS_RUN_LOCALLY: 1
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
43 changes: 0 additions & 43 deletions .travis.yml

This file was deleted.

4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# libphonenumber for PHP [![Build Status](https://img.shields.io/travis/giggsey/libphonenumber-for-php.svg?style=flat-square)](https://travis-ci.org/giggsey/libphonenumber-for-php) [![Coverage Status](https://img.shields.io/coveralls/giggsey/libphonenumber-for-php.svg?style=flat-square)](https://coveralls.io/r/giggsey/libphonenumber-for-php?branch=master)
# libphonenumber for PHP [![Build Status](https://github.com/giggsey/libphonenumber-for-php/workflows/Continuous%20Integration/badge.svg)](https://github.com/giggsey/libphonenumber-for-php/actions?query=workflow%3A%22Continuous+Integration%22) [![Coverage Status](https://img.shields.io/coveralls/giggsey/libphonenumber-for-php.svg?style=flat-square)](https://coveralls.io/r/giggsey/libphonenumber-for-php?branch=master)

[![Total Downloads](https://poser.pugx.org/giggsey/libphonenumber-for-php/downloads?format=flat-square)](https://packagist.org/packages/giggsey/libphonenumber-for-php)
[![Downloads per month](https://img.shields.io/packagist/dm/giggsey/libphonenumber-for-php.svg?style=flat-square)](https://packagist.org/packages/giggsey/libphonenumber-for-php)
Expand All @@ -8,8 +8,6 @@
## What is it?
A PHP library for parsing, formatting, storing and validating international phone numbers. This library is based on Google's [libphonenumber](https://github.com/google/libphonenumber).



- [Installation](#installation)
- [Documentation](#documentation)
- [Online Demo](#online-demo)
Expand Down
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
"build/",
"docs/",
"tests/",
".github/",
".editorconfig",
".gitattributes",
".gitignore",
Expand Down

0 comments on commit 53bdad1

Please sign in to comment.