-
Notifications
You must be signed in to change notification settings - Fork 3
96 lines (79 loc) · 2.75 KB
/
test.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
88
89
90
91
92
93
94
95
96
name: Test
on:
# Run on pushes to `main` and `develop` and on all pull requests.
push:
branches:
- main
- develop
paths-ignore:
- '**.md'
pull_request:
# Allow manually triggering the workflow.
workflow_dispatch:
jobs:
#### TEST STAGE ####
test:
runs-on: ubuntu-latest
strategy:
matrix:
php: ['7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.5']
coverage: [false]
# Run code coverage only on high/low PHP.
include:
- php: 5.6
coverage: true
- php: 8.4
coverage: true
continue-on-error: ${{ matrix.php == '8.5' }}
name: "Tests: PHP ${{ matrix.php }}"
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
ini-values: error_reporting=E_ALL, display_errors=On
coverage: ${{ matrix.coverage == true && 'xdebug' || 'none' }}
# YoastCS 3.0 has a PHP 7.2 minimum which conflicts with the requirements of this package.
- name: 'Composer: remove YoastCS'
run: composer remove --dev yoast/yoastcs --no-update --no-interaction
# Install dependencies and handle caching in one go.
# @link https://github.com/marketplace/actions/install-php-dependencies-with-composer
- name: Install Composer dependencies - normal
if: matrix.php != '8.5'
uses: "ramsey/composer-install@v3"
with:
# Bust the cache at least once a month - output format: YYYY-MM.
custom-cache-suffix: $(date -u "+%Y-%m")
- name: Install Composer dependencies - ignore PHP restrictions
if: matrix.php == '8.5'
uses: "ramsey/composer-install@v3"
with:
composer-options: --ignore-platform-req=php+
# Bust the cache at least once a month - output format: YYYY-MM.
custom-cache-suffix: $(date -u "+%Y-%m")
- name: Lint PHP files against parse errors
run: composer lint
- name: Run the unit tests
if: ${{ matrix.coverage == false }}
run: composer test
- name: Run the unit tests with code coverage
if: ${{ matrix.coverage == true }}
run: composer coverage
- name: Upload coverage results to Coveralls
if: ${{ success() && matrix.coverage == true }}
uses: coverallsapp/github-action@v2
with:
format: clover
file: build/logs/clover.xml
flag-name: php-${{ matrix.php }}
parallel: true
coveralls-finish:
needs: test
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@v2
with:
parallel-finished: true