Skip to content

Commit 70de4a0

Browse files
committed
Added GitHub workflow for tests
1 parent ecff8ec commit 70de4a0

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

.github/workflows/tests.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: PHP Tests
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
run:
12+
runs-on: ${{ matrix.operating-system }}
13+
14+
strategy:
15+
matrix:
16+
operating-system: [ ubuntu-latest ]
17+
php-version: [ '8.0', '8.1', '8.2' ]
18+
19+
name: PHP ${{ matrix.php-version }} test on ${{ matrix.operating-system }}
20+
21+
steps:
22+
- name: Checkout Code
23+
uses: actions/checkout@v3
24+
25+
- name: Install PHP
26+
id: php
27+
uses: shivammathur/setup-php@v2
28+
with:
29+
php-version: ${{ matrix.php-version }}
30+
31+
- name: Check PHP version
32+
run: php -v
33+
34+
- name: Cache Composer packages
35+
id: composer-cache
36+
uses: actions/cache@v3
37+
with:
38+
path: vendor
39+
key: ${{ runner.os }}-${{ matrix.operating-system }}-php-${{ steps.php.outputs.php-version }}
40+
restore-keys: |
41+
${{ runner.os }}-${{ matrix.operating-system }}-php-${{ steps.php.outputs.php-version }}
42+
43+
- if: steps.composer-cache.outputs.cache-hit != 'true'
44+
name: Install Composer dependencies
45+
run: composer install --prefer-dist --no-progress
46+
47+
- name: PHPUnit Tests
48+
run: vendor/bin/phpunit --coverage-clover ./tests/coverage.xml
49+
50+
- name: Upload coverage reports to Codecov
51+
uses: codecov/codecov-action@v3
52+
with:
53+
token: ${{ secrets.CODECOV_TOKEN }}
54+
files: ./tests/coverage.xml
55+
flags: os-${{ matrix.operating-system }}_php-${{ matrix.php-version }}
56+
verbose: true

0 commit comments

Comments
 (0)