Skip to content

Commit e8a7afa

Browse files
committed
Introduce code coverage workflow
1 parent beb7ed6 commit e8a7afa

2 files changed

Lines changed: 61 additions & 1 deletion

File tree

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: "Code coverage"
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
php-version:
7+
description: "The PHP version to use when running the job"
8+
default: "8.0"
9+
required: false
10+
type: "string"
11+
php-extensions:
12+
description: "The php extensions to install, allowing composer to pass"
13+
default: "none, ctype, dom, json, mbstring, phar, simplexml, tokenizer, xml, xmlwriter, fileinfo"
14+
required: false
15+
type: "string"
16+
composer-root-version:
17+
description: "The version of the package being tested, in case of circular dependencies."
18+
required: false
19+
type: "string"
20+
composer-options:
21+
description: "Additional flags for the composer install command."
22+
default: "--prefer-dist"
23+
required: false
24+
type: "string"
25+
composer-dependencies:
26+
description: "Composer dependency level to install"
27+
default: "locked"
28+
required: false
29+
type: "string"
30+
31+
jobs:
32+
code-coverage:
33+
name: "Code Coverage"
34+
runs-on: "ubuntu-latest"
35+
steps:
36+
- name: "Checkout"
37+
uses: "actions/checkout@v3"
38+
39+
- name: "Set up PHP"
40+
uses: "shivammathur/setup-php@2.18.0"
41+
with:
42+
coverage: "xdebug"
43+
extensions: "${{ inputs.php-extensions }}"
44+
php-version: "${{ inputs.php-version }}"
45+
46+
- name: "Install dependencies with Composer"
47+
uses: "ramsey/composer-install@v1"
48+
with:
49+
dependency-versions: "${{ inputs.composer-dependencies }}"
50+
composer-options: "${{ inputs.composer-options }}"
51+
52+
- name: "Collect code coverage with Xdebug and phpunit/phpunit"
53+
env:
54+
XDEBUG_MODE: "coverage"
55+
run: "vendor/bin/phpunit --colors=always --coverage-clover=.build/phpunit/logs/clover.xml"

.github/workflows/coding-standards.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ on:
2222
default: "--prefer-dist"
2323
required: false
2424
type: "string"
25+
composer-dependencies:
26+
description: "Composer dependency level to install"
27+
default: "locked"
28+
required: false
29+
type: "string"
2530

2631
jobs:
2732
coding-standards:
@@ -53,7 +58,7 @@ jobs:
5358
- name: "Install dependencies with Composer"
5459
uses: "ramsey/composer-install@v1"
5560
with:
56-
dependency-versions: "highest"
61+
dependency-versions: "${{ inputs.composer-dependencies }}"
5762
composer-options: "${{ inputs.composer-options }}"
5863

5964
- name: "Code style check"

0 commit comments

Comments
 (0)