Skip to content

Commit e4e2a28

Browse files
committed
GitHub Actions: Add test workflow
1 parent 0388a6b commit e4e2a28

File tree

4 files changed

+95
-15
lines changed

4 files changed

+95
-15
lines changed

.github/workflows/test.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Test
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
branches:
7+
- master
8+
- v2 # Temporary until v2 is merged into master
9+
push:
10+
branches:
11+
- master
12+
- v2 # Temporary until v2 is merged into master
13+
14+
concurrency:
15+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref_name }}-${{ github.event.pull_request.number || github.sha }}
16+
cancel-in-progress: true
17+
18+
permissions: {}
19+
20+
jobs:
21+
phpunit:
22+
runs-on: ubuntu-latest
23+
permissions:
24+
contents: read
25+
strategy:
26+
matrix:
27+
php: ['8.1', '8.2', '8.3', '8.4']
28+
dependency-versions: [lowest, highest]
29+
coverage: [none]
30+
exclude:
31+
- php: '8.4'
32+
dependency-versions: highest
33+
coverage: none
34+
include:
35+
- php: '8.4'
36+
dependency-versions: highest
37+
coverage: xdebug
38+
steps:
39+
- uses: actions/checkout@v4
40+
41+
- uses: shivammathur/setup-php@v2
42+
with:
43+
php-version: ${{ matrix.php }}
44+
coverage: ${{ matrix.coverage }}
45+
env:
46+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47+
48+
- uses: ramsey/composer-install@v3
49+
with:
50+
dependency-versions: ${{ matrix.dependency-versions }}
51+
composer-options: --no-audit --optimize-autoloader
52+
53+
- run: composer test -- --coverage-clover coverage.xml
54+
if: ${{ matrix.coverage == 'xdebug' }}
55+
56+
- run: composer test -- --no-coverage
57+
if: ${{ matrix.coverage != 'xdebug' }}
58+
59+
- uses: actions/upload-artifact@v4
60+
if: ${{ matrix.coverage == 'xdebug' }}
61+
with:
62+
name: coverage
63+
path: coverage.xml
64+
65+
coveralls:
66+
needs: phpunit
67+
runs-on: ubuntu-latest
68+
permissions:
69+
contents: read
70+
steps:
71+
- uses: actions/download-artifact@v4
72+
with:
73+
name: coverage
74+
- uses: coverallsapp/github-action@v2
75+
with:
76+
file: coverage.xml

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
/vendor/
22
/coverage/
3-
/composer.lock
3+
/composer.lock
4+
5+
# PHPUnit
6+
/.phpunit.cache
7+
/coverage.xml

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@
2424
"vlucas/phpdotenv": "^5.6"
2525
},
2626
"require-dev": {
27-
"phpunit/phpunit": "^10.0",
28-
"laravel/pint": "^1.13"
27+
"laravel/pint": "^1.13",
28+
"phpunit/phpunit": "^10.5"
2929
},
3030
"scripts": {
3131
"test": "phpunit",
@@ -37,4 +37,4 @@
3737
},
3838
"minimum-stability": "dev",
3939
"prefer-stable": true
40-
}
40+
}

phpunit.xml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit backupGlobals="false"
3-
backupStaticAttributes="false"
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
4+
backupGlobals="false"
45
bootstrap="vendor/autoload.php"
56
colors="true"
6-
convertErrorsToExceptions="true"
7-
convertNoticesToExceptions="true"
8-
convertWarningsToExceptions="true"
97
processIsolation="false"
10-
stopOnFailure="false">
8+
stopOnFailure="false"
9+
cacheDirectory=".phpunit.cache"
10+
backupStaticProperties="false">
1111
<testsuites>
1212
<testsuite name="Config">
1313
<directory suffix="Test.php">tests</directory>
1414
</testsuite>
1515
</testsuites>
16-
<filter>
17-
<whitelist processUncoveredFilesFromWhitelist="true">
16+
<source>
17+
<include>
1818
<directory suffix=".php">src</directory>
19-
</whitelist>
20-
</filter>
21-
</phpunit>
19+
</include>
20+
</source>
21+
</phpunit>

0 commit comments

Comments
 (0)