Skip to content

Commit d8476a6

Browse files
committed
add github action tests
1 parent 3cfdf94 commit d8476a6

3 files changed

Lines changed: 52 additions & 7 deletions

File tree

.github/workflows/run-tests.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: run-tests
2+
3+
on:
4+
push:
5+
branches: [main, master]
6+
pull_request:
7+
branches: [main, master]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
php: [7.3, 7.4, 8.0, 8.1, 8.2, 8.3]
16+
dependency-version: [prefer-lowest, prefer-stable]
17+
18+
name: P${{ matrix.php }} - ${{ matrix.dependency-version }}
19+
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v4
23+
24+
- name: Setup PHP
25+
uses: shivammathur/setup-php@v2
26+
with:
27+
php-version: ${{ matrix.php }}
28+
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite3, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, fileinfo
29+
coverage: none
30+
31+
- name: Install dependencies
32+
run: composer update --${{ matrix.dependency-version }} --prefer-dist --no-interaction --no-progress
33+
34+
- name: Execute tests
35+
run: vendor/bin/phpunit --log-junit report.xml
36+
37+
- name: Publish Test Report
38+
uses: mikepenz/action-junit-report@v4
39+
if: success() || failure() # always run even if the previous step fails
40+
with:
41+
report_paths: 'report.xml'
42+

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,7 @@ vendor/
22
.idea/
33
.env
44
.phpunit.result.cache
5+
.phpunit.cache
6+
report.xml
7+
*.bak
58
composer.lock

phpunit.xml.dist

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit backupGlobals="false" backupStaticAttributes="false" bootstrap="vendor/autoload.php" colors="true" convertErrorsToExceptions="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" processIsolation="false" stopOnFailure="false">
3-
<coverage>
4-
<include>
5-
<directory suffix=".php">src/</directory>
6-
</include>
7-
</coverage>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" backupGlobals="false" bootstrap="vendor/autoload.php" colors="true" processIsolation="false" stopOnFailure="false" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
83
<testsuites>
94
<testsuite name="Package Test Suite">
10-
<directory suffix=".php">./tests/</directory>
5+
<directory suffix="Test.php">./tests/</directory>
116
</testsuite>
127
</testsuites>
8+
<source>
9+
<include>
10+
<directory suffix=".php">src/</directory>
11+
</include>
12+
</source>
1313
</phpunit>

0 commit comments

Comments
 (0)