-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
84 lines (81 loc) · 3.27 KB
/
action.yml
File metadata and controls
84 lines (81 loc) · 3.27 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
name: 'php-coverage-badge'
author: 'Michel Bobillier athos99@bluewin.ch'
description: 'PHP-Coverage-Badge is a gitaction for creating an SVG coverage badge from a PHP Clover or Cobertura XML file.'
branding:
icon: 'book-open'
color: 'green'
inputs:
report:
description: 'The path to the report file.'
required: false
default: 'clover.xml'
report_type:
description: 'The type of the generated report. Currently supported: clover, cobertura.'
required: false
default: 'clover'
coverage_line_badge_name:
description: 'The name of the line coverage badge'
required: false
default: 'Line coverage'
coverage_branch_badge_name:
description: 'The name of the branch coverage badge'
required: false
default: 'Branch coverage'
coverage_line_badge_path:
description: 'The path of the line coverage badge'
required: false
default: 'coverage_line.svg'
coverage_branch_badge_path:
description: 'The path of the branch coverage badge'
required: false
default: 'coverage_breanche.svg'
coverage_line_percent_ok:
description: 'Acceptable limit of coverage line percent'
required: false
default: '80'
coverage_branch_percent_ok:
description: 'Acceptable limit of coverage barnch percent'
required: false
default: '60'
push_badge:
description: 'Defines whether the badges will be committed and pushed to the repository.'
required: false
default: 'false'
runs:
using: "composite"
steps:
- name: Checkout
uses: actions/checkout@v5
with:
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token.
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository.
repository: athos99/php-coverage-badge
path: php-coverage-badge
sparse-checkout: |
Build.php
sparse-checkout-cone-mode: false
- name: Setup PHP with tools
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
extensions: mbstring, xml
- name: build badge
shell: bash
env:
INPUT_REPORT: "${{ inputs.report }}"
INPUT_REPORT_TYPE: "${{ inputs.report_type }}"
INPUT_COVERAGE_LINE_BADGE_NAME: "${{ inputs.coverage_line_badge_name }}"
INPUT_COVERAGE_BRANCH_BADGE_NAME: "${{ inputs.coverage_branch_badge_name }}"
INPUT_COVERAGE_LINE_BADGE_PATH: "${{ inputs.coverage_line_badge_path }}"
INPUT_COVERAGE_BRANCH_BADGE_PATH: "${{ inputs.coverage_branch_badge_path }}"
INPUT_COVERAGE_LINE_PERCENT_OK: "${{ inputs.coverage_line_percent_ok }}"
INPUT_COVERAGE_BRANCH_PERCENT_OK: "${{ inputs.coverage_branch_percent_ok }}"
run: |
php php-coverage-badge/Build.php --report="$INPUT_REPORT" \
--report-type="$INPUT_REPORT_TYPE" \
--coverage-line-badge-name="$INPUT_COVERAGE_LINE_BADGE_NAME"\
--coverage-branch-badge-name="$INPUT_COVERAGE_BRANCH_BADGE_NAME" \
--coverage-line-badge-path="$INPUT_COVERAGE_LINE_BADGE_PATH" \
--coverage-branch-badge-path="$INPUT_COVERAGE_BRANCH_BADGE_PATH" \
--coverage-line-percent-ok="${INPUT_COVERAGE_LINE_PERCENT_OK}" \
--coverage-branch-percent-ok="${INPUT_COVERAGE_BRANCH_PERCENT_OK}" \