-
Notifications
You must be signed in to change notification settings - Fork 7
85 lines (71 loc) · 2.45 KB
/
php.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
name: Test Symfony bundle
on: [push, pull_request]
jobs:
test:
name: Test Symfony bundle using PHP ${{ matrix.php-versions }} and ${{ matrix.dependencies }} dependencies
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php-versions:
- '7.4'
- '8.0'
- '8.1'
- '8.2'
- '8.3'
dependencies:
- "lowest"
- "highest"
steps:
- uses: actions/checkout@v3
- name: Setup PHP, with composer and extensions
uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php
with:
php-version: ${{ matrix.php-versions }}
extensions: dom, json, tokenizer, mbstring, xml, ctype, iconv, intl, curl
coverage: xdebug #optional
tools: php-cs-fixer, phpunit, phpstan
- name: Setup problem matchers for PHP
run: echo "::add-matcher::${{ runner.tool_cache }}/php.json"
- name: Setup problem matchers for PHPUnit
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
- name: Get composer cache directory
id: composer-cache
run: echo "DIR=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- name: Cache composer dependencies
uses: actions/cache@v3
with:
path: ${{ steps.composer-cache.outputs.DIR }}
key: ${{ runner.os }}-composer-${{ matrix.php-versions }}-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-
- uses: "ramsey/composer-install@v2"
name: Install Composer dependencies
with:
dependency-versions: "${{ matrix.dependencies }}"
- name: Run PHPUnit Tests
uses: php-actions/phpunit@v3
env:
XDEBUG_MODE: coverage
with:
version: 9.6
php_version: "${{ matrix.php-versions }}"
bootstrap: "vendor/autoload.php"
configuration: "./phpunit.xml"
php_extensions: "xdebug"
coverage_clover: "coverage.xml"
args: --coverage-text
- name: Upload to Codecov
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: unittests
files: ./coverage.xml
verbose: true
- name: Run PHPStan
env:
XDEBUG_MODE: off
run: php vendor/bin/phpstan analyse --no-progress
- name: Run php-cs-fixer
env:
PHP_CS_FIXER_IGNORE_ENV: true
run: php vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php --diff --dry-run