Skip to content

Commit 6ad2b65

Browse files
committed
UPD github action to test library
1 parent 79a0434 commit 6ad2b65

1 file changed

Lines changed: 29 additions & 8 deletions

File tree

.github/workflows/phpunit.yml

Lines changed: 29 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,49 @@
11
name: PHP Unit Tests
22

3-
on: [ push ]
3+
on:
4+
push:
5+
pull_request:
46

57
jobs:
68
test:
79
runs-on: ubuntu-latest
810

11+
strategy:
12+
matrix:
13+
php-version:
14+
- '7.4'
15+
# - '8.0'
16+
# - '8.1'
17+
# - '8.2'
18+
919
steps:
10-
- uses: actions/checkout@v2
20+
- name: Checkout repository
21+
uses: actions/checkout@v4
22+
23+
- name: Setup PHP
24+
uses: shivammathur/setup-php@v2
25+
with:
26+
php-version: ${{ matrix.php-version }}
27+
coverage: none
28+
tools: composer:v2
1129

1230
- name: Validate composer.json and composer.lock
1331
run: composer validate
1432

15-
- name: Caching Composer packages
33+
- name: Get Composer cache directory
1634
id: composer-cache
17-
uses: actions/cache@v2
35+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
36+
37+
- name: Caching Composer packages
38+
uses: actions/cache@v4
1839
with:
19-
path: vendor
20-
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
40+
path: ${{ steps.composer-cache.outputs.dir }}
41+
key: ${{ runner.os }}-php-${{ matrix.php-version }}-${{ hashFiles('**/composer.lock') }}
2142
restore-keys: |
22-
${{ runner.os }}-php-
43+
${{ runner.os }}-php-${{ matrix.php-version }}
2344
2445
- name: Install dependencies
25-
run: composer install --prefer-dist --no-progress --no-suggest
46+
run: composer install --prefer-dist --no-interaction --no-progress --optimize-autoloader
2647

2748
- name: Run test suite
2849
run: composer run-script test

0 commit comments

Comments
 (0)