Skip to content

Commit

Permalink
add GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
nojimage committed Feb 26, 2021
1 parent dc2b568 commit 369331e
Showing 1 changed file with 91 additions and 0 deletions.
91 changes: 91 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: Setup PHP Action

on:
push:
branches:
- master
- develop
pull_request:
branches:
- '*'
schedule:
- cron: "0 7 1 * *"
branches:
- master

jobs:
testsuite:
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
php-version: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.4']
coverage: ['no']
test-tld: ['no']
include:
- php-version: '7.4'
coverage: 'coverage'
test-tld: 'no'
- php-version: '7.4'
coverage: 'no'
test-tld: 'test-tld'

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
extensions: mbstring, intl
coverage: xdebug

- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

- name: Install dependencies
run: composer install --prefer-dist

- name: Setup problem matchers for PHPUnit
if: matrix.php-version == '7.4'
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"

- name: Run PHPUnit
run: |
if [[ ${{ matrix.coverage }} == 'coverage' ]]; then
vendor/bin/phpunit --exclude-group deprecated,tld --stderr --verbose --coverage-clover=coverage.xml
elif [[ ${{ matrix.test-tld }} == 'test-tld' ]]; then
vendor/bin/phpunit --group tld --stderr
else
vendor/bin/phpunit --exclude-group deprecated,tld --stderr
fi
- name: Submit code coverage
if: matrix.coverage == 'coverage'
uses: codecov/codecov-action@v1

cscheck:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '7.4'
extensions: mbstring, intl, apcu
coverage: none
tools: cs2pr, phpcs

- name: Run PHP CodeSniffer
run: phpcs -qn --report=checkstyle --extensions=php --standard=PSR12 ./lib ./tests | cs2pr

0 comments on commit 369331e

Please sign in to comment.