Skip to content

Commit 0f853a6

Browse files
authored
Using github actions (#17)
Switch from Travis to Github Actions as our test runner
1 parent 9bf1bfd commit 0f853a6

2 files changed

Lines changed: 120 additions & 5 deletions

File tree

.github/workflows/php.yml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: PHP Composer
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
build:
11+
12+
runs-on: ${{ matrix.operating-system }}
13+
strategy:
14+
matrix:
15+
operating-system: ['ubuntu-20.04']
16+
php-versions: ['8.0']
17+
phpunit-versions: ['9.5.4']
18+
coverage: [false]
19+
include:
20+
- php-versions: '5.4'
21+
operating-system: 'ubuntu-16.04'
22+
phpunit-versions: '4.8.36'
23+
- php-versions: '5.5'
24+
operating-system: 'ubuntu-16.04'
25+
phpunit-versions: '4.8.36'
26+
- php-versions: '5.6'
27+
operating-system: 'ubuntu-16.04'
28+
phpunit-versions: '4.8.36'
29+
- php-versions: '7.0'
30+
operating-system: 'ubuntu-16.04'
31+
phpunit-versions: '4.8.36'
32+
- php-versions: '7.1'
33+
operating-system: 'ubuntu-18.04'
34+
phpunit-versions: '4.8.36'
35+
- php-versions: '7.2'
36+
operating-system: 'ubuntu-18.04'
37+
phpunit-versions: '4.8.36'
38+
- php-versions: '7.3'
39+
operating-system: 'ubuntu-18.04'
40+
phpunit-versions: '7.5.20'
41+
- php-versions: '7.4'
42+
operating-system: 'ubuntu-20.04'
43+
phpunit-versions: '7.5.20'
44+
coverage: true
45+
46+
steps:
47+
- name: Setup PHP
48+
uses: shivammathur/setup-php@v2
49+
with:
50+
php-version: ${{ matrix.php-versions }}
51+
coverage: xdebug
52+
tools: phpunit:${{ matrix.phpunit-versions }}
53+
54+
- uses: actions/checkout@v2
55+
56+
- run: composer require "phpunit/phpunit:${{ matrix.phpunit-versions }}" --dev --no-update
57+
58+
- run: composer remove php-coveralls/php-coveralls --dev --no-update
59+
60+
- run: composer require php-coveralls/php-coveralls:~1.0 --dev --no-update
61+
if: ${{ matrix.coverage }}
62+
63+
- run: cat composer.json
64+
65+
- name: Cache Composer packages
66+
id: composer-cache
67+
uses: actions/cache@v2
68+
with:
69+
path: vendor
70+
key: ${{ runner.os }}-php-${{ matrix.php-versions }}-${{ hashFiles('**/composer.lock') }}
71+
restore-keys: |
72+
${{ runner.os }}-php-
73+
74+
- name: Install dependencies
75+
run: composer install --prefer-source --no-interaction --dev
76+
77+
- name: Run tests
78+
run: ./vendor/bin/phpunit
79+
if: ${{ !matrix.coverage }}
80+
81+
- name: Run tests with coverage
82+
run: |
83+
mkdir -p build/logs
84+
./vendor/bin/phpunit --coverage-clover build/logs/clover.xml
85+
ls -l build/logs/
86+
if: ${{ matrix.coverage }}
87+
88+
- name: Upload coverage results to Coveralls
89+
env:
90+
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
91+
run: |
92+
composer global require php-coveralls/php-coveralls
93+
php-coveralls --coverage_clover=build/logs/clover.xml -v
94+
if: ${{ matrix.coverage }}

phpunit.xml.dist

Lines changed: 26 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,32 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit bootstrap="src/SQLParser.php" verbose="true" testdox="true">
2+
<phpunit
3+
backupGlobals="false"
4+
backupStaticAttributes="false"
5+
colors="true"
6+
convertErrorsToExceptions="true"
7+
convertNoticesToExceptions="true"
8+
convertWarningsToExceptions="true"
9+
processIsolation="false"
10+
stopOnFailure="false"
11+
verbose="true"
12+
bootstrap="src/SQLParser.php">
13+
14+
<php>
15+
<ini name="intl.default_locale" value="en"/>
16+
<ini name="intl.error_level" value="0"/>
17+
<ini name="memory_limit" value="-1"/>
18+
<ini name="date.timezone" value="America/Los_Angeles"/>
19+
</php>
20+
321
<testsuites>
422
<testsuite name="unit">
5-
<directory>tests</directory>
23+
<directory suffix=".php">tests</directory>
624
</testsuite>
725
</testsuites>
8-
<logging>
9-
<log type="coverage-clover" target="build/logs/clover.xml"/>
10-
</logging>
26+
27+
<filter>
28+
<whitelist>
29+
<directory suffix=".php">src</directory>
30+
</whitelist>
31+
</filter>
1132
</phpunit>

0 commit comments

Comments
 (0)