-
Notifications
You must be signed in to change notification settings - Fork 1
123 lines (105 loc) · 3.47 KB
/
ci.yaml
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
name: CI
on:
push:
branches:
- main
- develop
pull_request:
branches:
- main
- develop
jobs:
test:
name: "PHP ${{ matrix.env.php }} - Symfony ${{ matrix.env.symfony }}"
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.env.experimental == true }}
strategy:
fail-fast: false
matrix:
env:
- { php: 7.4, symfony: 5.4 }
- { php: 8.0, symfony: 5.4 }
- { php: 8.1, symfony: 5.4 }
- { php: 8.2, symfony: 5.4 }
- { php: 8.1, symfony: 6.4 }
- { php: 8.2, symfony: 6.4 }
- { php: 8.3, symfony: 6.4 }
- { php: 8.4, symfony: 6.4, experimental: true }
- { php: 8.2, symfony: 7.1, experimental: true }
- { php: 8.3, symfony: 7.1, experimental: true }
- { php: 8.4, symfony: 7.1, experimental: true }
steps:
- uses: actions/checkout@v3
- name: Composer cache
uses: actions/cache@v3
with:
path: "vendor"
key: ${{ runner.os }}-${{ matrix.env.php }}-composer-${{ hashFiles('composer.json') }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.env.php }}
coverage: pcov
- name: Configure Symfony
run: composer config extra.symfony.require "${{ matrix.env.symfony }}"
- name: Install composer
run: composer update --no-progress --ansi --prefer-stable
- name: Validate composer.json and composer.lock
run: composer validate --no-interaction --ansi
- name: PHPUnit tests
uses: php-actions/phpunit@v3
with:
version: "9.5"
coverage_php: "coverage/test.${{ matrix.env.php }}.${{ matrix.env.symfony }}.cov"
php_version: "${{ matrix.env.php }}"
configuration: "phpunit.xml.dist"
- name: upload coverage file
if: "${{github.event_name}} == 'pull_request'"
uses: actions/upload-artifact@v3
with:
name: coverage
path: "coverage/test.${{ matrix.env.php }}.${{ matrix.env.symfony }}.cov"
- name: upload composer.lock on fail
if: ${{ failure() }}
uses: actions/upload-artifact@v3
with:
name: "composer.php-${{ matrix.env.php }}.symfony-${{ matrix.env.symfony }}"
path: |
composer.json
composer.lock
coverage_report:
needs: test
runs-on: ubuntu-latest
if: "${{ github.event_name }} == 'pull_request'"
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: coverage
path: coverage
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
coverage: pcov
- name: Install phpcov
run: composer req --no-progress -n phpunit/phpcov
- name: 'merge coverage files'
run: vendor/bin/phpcov merge --cobertura cobertura.xml ./coverage
- name: "Code Coverage Report"
uses: irongut/[email protected]
with:
filename: cobertura.xml
badge: true
fail_below_min: true
format: markdown
hide_branch_rate: false
hide_complexity: true
indicators: true
output: both
thresholds: '60 80'
- name: Add Coverage PR Comment
uses: marocchino/sticky-pull-request-comment@v2
with:
recreate: true
path: code-coverage-results.md