forked from exelearning/moodle-mod_exelearning
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcodecov.yml
More file actions
88 lines (84 loc) · 3.82 KB
/
Copy pathcodecov.yml
File metadata and controls
88 lines (84 loc) · 3.82 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
# Codecov configuration for mod_exelearning.
# The project/patch status checks report the coverage percentage on every
# commit/PR (not informational, so the figure shows and the check passes/fails),
# like exelearning/exelearning. See https://docs.codecov.com/docs/codecovyml-reference
#
# The project gate uses `target: auto`: it locks coverage in at whatever level
# `main` currently reaches and FAILS any PR that drops below it (minus a small
# noise threshold) — a ratchet that can only go up. To enforce it as a merge
# requirement, add `codecov/project` to the required status checks in the GitHub
# branch-protection rule for `main` (Settings -> Branches).
#
# Both languages upload under a flag now: the PHP coverage job tags `php`, the jsunit job
# tags `javascript`. Flagging both keeps each visible as its own flag/component in the
# dashboard and PR comment (an unflagged report is absent from those breakdowns even though
# it still counts toward the total).
#
# moodle-plugin-ci installs the plugin under moodle/mod/exelearning/, so the PHP report paths
# are prefixed with that. Strip it so coverage maps onto the repository tree (classes/,
# lib.php) instead of phantom paths — otherwise Codecov shows 0 files / no percentage. This
# `fixes` strip runs before the `php` flag is associated, so the flag picks up the
# repo-relative paths (the `php` flag below deliberately has no `paths:` filter: an earlier
# filter like `classes/` matched nothing and yielded "No coverage data available"; without a
# filter the flag simply includes every file in the PHP upload). The coverage scope is
# already limited in tests/coverage.php. The `javascript` flag is unaffected: the jsunit job
# checks out at the repo root, so its js/ paths need no fix.
fixes:
- "moodle/mod/exelearning/::"
coverage:
status:
project:
default:
# Lock in the level main reaches; fail PRs that regress beyond the noise
# threshold. This is the "requirement at whatever level we achieve" gate.
target: auto
threshold: 0.5%
patch:
default:
# New/changed lines in a PR must be at least 80% covered.
target: 80%
# PHP (PHPUnit, whole plugin) and JS (Vitest, the grade-critical SCORM tracker
# js/scorm_tracker.js) upload under their own flag so each is tracked separately. The `php`
# flag has no `paths:` filter on purpose (see the note on `fixes` above); `carryforward: true`
# on both means a commit that has not finished/skipped one job's upload reuses that flag's
# coverage from the parent commit instead of momentarily showing only the other language
# (the PHP coverage job is slow — full Moodle install + PHPUnit + Behat — so it lands well
# after the fast jsunit job).
flags:
php:
carryforward: true
javascript:
paths:
- js/
carryforward: true
# Surface each language as its own component in the dashboard and PR comment, and gate it
# with project/patch statuses mirroring the repo-wide gates above. PHP and JS each get a
# `codecov/project/<component>` and `codecov/patch/<component>` check; add them to the `main`
# branch-protection required checks to make them blocking.
component_management:
individual_components:
- component_id: php
name: PHP (server-side)
flag_regexes:
- php
statuses:
- type: project
target: auto
threshold: 0.5%
- type: patch
target: 80%
- component_id: javascript
name: JavaScript (SCORM tracker)
flag_regexes:
- javascript
statuses:
- type: project
target: auto
threshold: 0.5%
- type: patch
target: 80%
# Show the coverage percentage and the diff in the PR comment, with a per-flag and
# per-component breakdown so PHP and JS both appear.
comment:
layout: "condensed_header, diff, flags, components, files"
require_changes: false