mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Add nox session to generate code coverage HTML reports
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
This commit is contained in:
parent
48bccb9e87
commit
142a6cb9e2
6 changed files with 40 additions and 0 deletions
4
.github/workflows/ci.yml
vendored
4
.github/workflows/ci.yml
vendored
|
@ -1327,6 +1327,10 @@ jobs:
|
|||
run: |
|
||||
nox --force-color -e combine-coverage
|
||||
|
||||
- name: Create Code Coverage HTML Report
|
||||
run: |
|
||||
nox --force-color -e create-html-coverage-report
|
||||
|
||||
set-pipeline-exit-status:
|
||||
# This step is just so we can make github require this step, to pass checks
|
||||
# on a pull request instead of requiring all
|
||||
|
|
4
.github/workflows/nightly.yml
vendored
4
.github/workflows/nightly.yml
vendored
|
@ -1382,6 +1382,10 @@ jobs:
|
|||
run: |
|
||||
nox --force-color -e combine-coverage
|
||||
|
||||
- name: Create Code Coverage HTML Report
|
||||
run: |
|
||||
nox --force-color -e create-html-coverage-report
|
||||
|
||||
build-src-repo:
|
||||
name: Build Source Repository
|
||||
environment: nightly
|
||||
|
|
4
.github/workflows/scheduled.yml
vendored
4
.github/workflows/scheduled.yml
vendored
|
@ -1361,6 +1361,10 @@ jobs:
|
|||
run: |
|
||||
nox --force-color -e combine-coverage
|
||||
|
||||
- name: Create Code Coverage HTML Report
|
||||
run: |
|
||||
nox --force-color -e create-html-coverage-report
|
||||
|
||||
set-pipeline-exit-status:
|
||||
# This step is just so we can make github require this step, to pass checks
|
||||
# on a pull request instead of requiring all
|
||||
|
|
4
.github/workflows/staging.yml
vendored
4
.github/workflows/staging.yml
vendored
|
@ -1377,6 +1377,10 @@ jobs:
|
|||
run: |
|
||||
nox --force-color -e combine-coverage
|
||||
|
||||
- name: Create Code Coverage HTML Report
|
||||
run: |
|
||||
nox --force-color -e create-html-coverage-report
|
||||
|
||||
build-src-repo:
|
||||
name: Build Source Repository
|
||||
environment: staging
|
||||
|
|
4
.github/workflows/templates/ci.yml.jinja
vendored
4
.github/workflows/templates/ci.yml.jinja
vendored
|
@ -338,4 +338,8 @@
|
|||
run: |
|
||||
nox --force-color -e combine-coverage
|
||||
|
||||
- name: Create Code Coverage HTML Report
|
||||
run: |
|
||||
nox --force-color -e create-html-coverage-report
|
||||
|
||||
<%- endblock jobs %>
|
||||
|
|
20
noxfile.py
20
noxfile.py
|
@ -1345,6 +1345,26 @@ def combine_coverage(session):
|
|||
pass
|
||||
|
||||
|
||||
@nox.session(python="3", name="create-html-coverage-report")
|
||||
def create_html_coverage_report(session):
|
||||
_install_coverage_requirement(session)
|
||||
env = {
|
||||
# The full path to the .coverage data file. Makes sure we always write
|
||||
# them to the same directory
|
||||
"COVERAGE_FILE": str(COVERAGE_FILE),
|
||||
}
|
||||
|
||||
# Generate html report for Salt and tests combined code coverage
|
||||
session.run(
|
||||
"coverage",
|
||||
"html",
|
||||
"-d",
|
||||
str(COVERAGE_OUTPUT_DIR.joinpath("html").relative_to(REPO_ROOT)),
|
||||
"--include=salt/*,tests/*",
|
||||
env=env,
|
||||
)
|
||||
|
||||
|
||||
class Tee:
|
||||
"""
|
||||
Python class to mimic linux tee behaviour
|
||||
|
|
Loading…
Add table
Reference in a new issue