Skip to content

Commit

Permalink
Merge 8016971 into 9bf1bfd
Browse files Browse the repository at this point in the history
  • Loading branch information
iamcal committed May 4, 2021
2 parents 9bf1bfd + 8016971 commit ddfc53f
Show file tree
Hide file tree
Showing 2 changed files with 120 additions and 5 deletions.
94 changes: 94 additions & 0 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: PHP Composer

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:

runs-on: ${{ matrix.operating-system }}
strategy:
matrix:
operating-system: ['ubuntu-20.04']
php-versions: ['8.0']
phpunit-versions: ['9.5.4']
coverage: [false]
include:
- php-versions: '5.4'
operating-system: 'ubuntu-16.04'
phpunit-versions: '4.8.36'
- php-versions: '5.5'
operating-system: 'ubuntu-16.04'
phpunit-versions: '4.8.36'
- php-versions: '5.6'
operating-system: 'ubuntu-16.04'
phpunit-versions: '4.8.36'
- php-versions: '7.0'
operating-system: 'ubuntu-16.04'
phpunit-versions: '4.8.36'
- php-versions: '7.1'
operating-system: 'ubuntu-18.04'
phpunit-versions: '4.8.36'
- php-versions: '7.2'
operating-system: 'ubuntu-18.04'
phpunit-versions: '4.8.36'
- php-versions: '7.3'
operating-system: 'ubuntu-18.04'
phpunit-versions: '7.5.20'
- php-versions: '7.4'
operating-system: 'ubuntu-20.04'
phpunit-versions: '7.5.20'
coverage: true

steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-versions }}
coverage: xdebug
tools: phpunit:${{ matrix.phpunit-versions }}

- uses: actions/checkout@v2

- run: composer require "phpunit/phpunit:${{ matrix.phpunit-versions }}" --dev --no-update

- run: composer remove php-coveralls/php-coveralls --dev --no-update

- run: composer require php-coveralls/php-coveralls:~1.0 --dev --no-update
if: ${{ matrix.coverage }}

- run: cat composer.json

- name: Cache Composer packages
id: composer-cache
uses: actions/cache@v2
with:
path: vendor
key: ${{ runner.os }}-php-${{ matrix.php-versions }}-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php-
- name: Install dependencies
run: composer install --prefer-source --no-interaction --dev

- name: Run tests
run: ./vendor/bin/phpunit
if: ${{ !matrix.coverage }}

- name: Run tests with coverage
run: |
mkdir -p build/logs
./vendor/bin/phpunit --coverage-clover build/logs/clover.xml
ls -l build/logs/
if: ${{ matrix.coverage }}

- name: Upload coverage results to Coveralls
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
composer global require php-coveralls/php-coveralls
php-coveralls --coverage_clover=build/logs/clover.xml -v
if: ${{ matrix.coverage }}
31 changes: 26 additions & 5 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,11 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="src/SQLParser.php" verbose="true" testdox="true">
<phpunit
backupGlobals="false"
backupStaticAttributes="false"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
verbose="true"
bootstrap="src/SQLParser.php">

<php>
<ini name="intl.default_locale" value="en"/>
<ini name="intl.error_level" value="0"/>
<ini name="memory_limit" value="-1"/>
<ini name="date.timezone" value="America/Los_Angeles"/>
</php>

<testsuites>
<testsuite name="unit">
<directory>tests</directory>
<directory suffix=".php">tests</directory>
</testsuite>
</testsuites>
<logging>
<log type="coverage-clover" target="build/logs/clover.xml"/>
</logging>

<filter>
<whitelist>
<directory suffix=".php">src</directory>
</whitelist>
</filter>
</phpunit>

0 comments on commit ddfc53f

Please sign in to comment.