-
Notifications
You must be signed in to change notification settings - Fork 7
135 lines (112 loc) · 4.38 KB
/
Copy pathtest.yml
File metadata and controls
135 lines (112 loc) · 4.38 KB
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
124
125
126
127
128
129
130
131
132
133
134
135
name: Test
on:
pull_request:
push:
# Allow manually triggering the workflow.
workflow_dispatch:
# Cancels all previous workflow runs for the same branch that have not yet completed.
concurrency:
# The concurrency group contains the workflow name and the branch name.
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
php:
- '5.3'
- '5.4'
- '5.5'
- '5.6'
- '7.0'
- '7.1'
- '7.2'
- '7.3'
# PHP 7.4 is tested in coverage section
- '8.0'
- '8.1'
- '8.2'
- '8.3'
- '8.4'
- '8.5'
experimental: [false]
include:
- php: '8.6'
experimental: true
name: "Test on PHP ${{ matrix.php }}"
continue-on-error: ${{ matrix.experimental }}
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Setup PHP
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # 2.37.2
with:
php-version: ${{ matrix.php }}
ini-values: zend.assertions=1, error_reporting=-1, display_errors=On, display_startup_errors=On
coverage: none
tools: cs2pr
# Remove the PHPCS standard as it has a minimum PHP requirements of PHP 5.4 and would block install on PHP 5.3.
- name: 'Composer: remove PHPCS'
if: ${{ matrix.php < 5.4 }}
run: composer remove --dev php-parallel-lint/php-code-style --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.experimental == false }}
uses: "ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda" # 4.0.0
with:
# Bust the cache at least once a month - output format: YYYY-MM.
custom-cache-suffix: $(date -u "+%Y-%m")
# For the PHP "nightly", we need to install with ignore platform reqs as not all dependencies allow it.
- name: Install Composer dependencies - with ignore platform
if: ${{ matrix.experimental == true }}
uses: "ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda" # 4.0.0
with:
composer-options: --ignore-platform-reqs
custom-cache-suffix: $(date -u "+%Y-%m")
- name: Lint
run: composer phplint -- --checkstyle | cs2pr
- name: Grab PHPUnit version
id: phpunit_version
run: echo "VERSION=$(vendor/bin/phpunit --version | grep --only-matching --max-count=1 --extended-regexp '\b[0-9]+\.[0-9]+')" >> $GITHUB_OUTPUT
- name: "Run unit tests (PHPUnit < 10)"
if: ${{ ! startsWith( steps.phpunit_version.outputs.VERSION, '10.' ) }}
run: composer phpunit
- name: "Run unit tests (PHPUnit 10+)"
if: ${{ startsWith( steps.phpunit_version.outputs.VERSION, '10.' ) }}
run: composer phpunit10
coverage:
needs: test
runs-on: ubuntu-latest
strategy:
matrix:
php:
- '7.4'
name: "Coverage on PHP ${{ matrix.php }}"
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Setup PHP
uses: shivammathur/setup-php@f3e473d116dcccaddc5834248c87452386958240 # 2.37.2
with:
php-version: ${{ matrix.php }}
ini-values: zend.assertions=1, error_reporting=-1, display_errors=On, display_startup_errors=On
coverage: xdebug
- name: Install Composer dependencies - normal
uses: "ramsey/composer-install@65e4f84970763564f46a70b8a54b90d033b3bdda" # 4.0.0
with:
# Bust the cache at least once a month - output format: YYYY-MM.
custom-cache-suffix: $(date -u "+%Y-%m")
- name: Run the unit tests with code coverage
run: composer coverage
- name: Upload coverage results to Coveralls
if: ${{ success() }}
uses: coverallsapp/github-action@8d6379e14d29928660c4ba802d8e85393440b329 # v2.3.8
with:
format: clover
file: build/logs/clover.xml