Skip to content

Commit 0f49ed0

Browse files
committed
Add test workflow
1 parent a82771d commit 0f49ed0

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

.github/workflows/tests.yaml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Tests
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
push:
7+
branches:
8+
- master
9+
10+
jobs:
11+
tests:
12+
runs-on: ubuntu-latest
13+
14+
strategy:
15+
matrix:
16+
php-version: [ '8.1', '8.2', '8.3', '8.4' ]
17+
18+
name: Run tests on PHP v${{ matrix.php-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-version }}
28+
29+
- name: Set composer cache directory
30+
id: composer-cache
31+
run: echo "COMPOSER_CACHE_DIRECTORY=$(composer config cache-files-dir)" >> $GITHUB_ENV
32+
33+
- name: Restore composer from cache
34+
uses: actions/cache@v4
35+
with:
36+
path: ${{ env.COMPOSER_CACHE_DIRECTORY }}
37+
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
38+
restore-keys: ${{ runner.os }}-composer-
39+
40+
- name: Install composer dependencies
41+
run: composer install --no-interaction --prefer-dist --no-progress
42+
43+
- name: Run phpunit tests
44+
run: vendor/bin/phpunit --colors=always --testdox

0 commit comments

Comments
 (0)