-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (44 loc) · 1.87 KB
/
build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
name: build
on:
push:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
php: ['8.1', '8.2', '8.3']
composer: ['--prefer-lowest', '']
steps:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: curl, json, mbstring
coverage: xdebug
- name: Git checkout
uses: actions/checkout@v4
- name: Validate composer.json and composer.lock
run: composer validate
- name: Prepare Composer cache vars
id: composer
run: |
echo "cache_dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
echo "cache_key=composer-$(date +'%Y-%m-%d')-${{ matrix.php }}${{ matrix.composer }}-" >> $GITHUB_OUTPUT
- name: Cache Composer dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer.outputs.cache_dir }}
key: ${{ steps.composer.outputs.cache_key }}${{ hashFiles('**/composer.json') }}
restore-keys: ${{ steps.composer.outputs.cache_key }}
- name: Update Composer dependencies
run: composer update ${{ matrix.composer }} --prefer-dist --no-progress --no-suggest --no-interaction
- name: Run PHP Code Sniffer
run: composer run-script test:phpcs
if: success()
- name: Run PHPStan
run: composer run-script test:phpstan
if: success() || failure()
- name: Run PHPUnit with coverage
run: composer run-script test:phpunit
if: success() || failure()