-
Notifications
You must be signed in to change notification settings - Fork 1
87 lines (73 loc) · 2.11 KB
/
ci.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
86
87
name: CI
on:
pull_request: ~
push:
branches: [ main ]
jobs:
check-style:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cache dependencies
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-vendor-${{ hashFiles('**/composer.lock') }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
- name: Install dependencies
run: composer install
- name: Check code style
run: vendor/bin/phpcs
test-code:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
php:
- '8.2'
- '8.3'
minimum_versions: [false]
coverage: ['none']
include:
- description: 'Minimum version'
php: '8.2'
minimum_versions: true
- description: 'Code coverage'
php: '8.2'
coverage: 'pcov'
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Cache dependencies
uses: actions/cache@v3
with:
path: vendor
key: ${{ runner.os }}-vendor-${{ hashFiles('**/composer.lock') }}
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
coverage: ${{ matrix.coverage }}
- name: Install dependencies
run: composer install
if: matrix.minimum_versions == false
- name: Install dependencies (minimum versions)
run: composer update --no-interaction --prefer-lowest
if: matrix.minimum_versions == true
- name: Run tests
run: vendor/bin/phpunit --no-coverage
if: matrix.coverage == 'none'
- name: Run tests with code coverage
run: vendor/bin/phpunit
if: matrix.coverage == 'pcov'
- name: Upload code coverage report
uses: codecov/codecov-action@v4
if: matrix.coverage == 'pcov'
with:
file: build/coverage.xml
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }}