-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
86 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,6 @@ jobs: | |
matrix: | ||
os: [ubuntu-latest] | ||
env: | ||
build-folder: build | ||
OS: ${{ matrix.os }} | ||
# PYTHON: '3.10' | ||
steps: | ||
|
@@ -22,24 +21,27 @@ jobs: | |
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y autopoint meson ninja-build gettext libunwind-dev libefl-all-dev libeet1 libeet-bin | ||
sudo apt-get install -y check | ||
- name: Setup python | ||
uses: actions/setup-python@master | ||
sudo apt-get install -y check lcov | ||
# - name: Setup python | ||
# uses: actions/setup-python@master | ||
# with: | ||
# python-version: 3.10 | ||
- name: Install coverage | ||
run: | | ||
pip install coverage -i ${{ env.build-folder }} | ||
export PATH=~/.local/bin:"$PATH" | ||
# - name: Install coverage | ||
# run: | | ||
# pip install coverage | ||
# export PATH=~/.local/bin:"$PATH" | ||
- name: Setup project (meson) | ||
run: meson setup . build -Db_coverage=true -Dbuild-tests=true | ||
- name: Build project (ninja) | ||
run: ninja -C build | ||
- name: Run tests (ninja) | ||
run: ninja -C build test | ||
- name: Generate coverage report | ||
run: ninja -C build coverage | ||
run: ./scripts/generate_coverage_report.sh | ||
- name: Upload to Codecov | ||
uses: codecov/[email protected] | ||
env: | ||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | ||
directory: ./build/meson-logs/ | ||
files: ./coverage.xml | ||
verbose: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import os | ||
import subprocess | ||
from lxml import html | ||
|
||
proj_root = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) | ||
print("Project root:", proj_root) | ||
|
||
print("Generating coverage report...") | ||
subprocess.call(["ninja", "-C", "build", "-j", "1", "clean"]) | ||
subprocess.call(["ninja", "-C", "build", "-j", "1", "test"]) | ||
|
||
# Run lcov | ||
outfiles = [] | ||
build_root = os.path.join(proj_root, 'build') | ||
log_dir = os.path.join(build_root, 'meson-logs') | ||
source_root = os.path.join(proj_root, 'src') | ||
subproject_root = os.path.join(proj_root, 'subprojects') | ||
lcov_exe = 'lcov' | ||
genhtml_exe = 'genhtml' | ||
htmloutdir = os.path.join(log_dir, 'coveragereport') | ||
html_index = os.path.join(htmloutdir, 'index.html') | ||
covinfo = os.path.join(log_dir, 'coverage.info') | ||
initial_tracefile = covinfo + '.initial' | ||
run_tracefile = covinfo + '.run' | ||
raw_tracefile = covinfo + '.raw' | ||
subprocess.check_call([lcov_exe, | ||
'--directory', build_root, | ||
'--capture', | ||
'--initial', | ||
'--output-file', | ||
initial_tracefile]) | ||
subprocess.check_call([lcov_exe, | ||
'--directory', build_root, | ||
'--capture', | ||
'--output-file', run_tracefile, | ||
'--no-checksum', | ||
'--rc', 'lcov_branch_coverage=1', | ||
]) | ||
# Join initial and test results. | ||
subprocess.check_call([lcov_exe, | ||
'-a', initial_tracefile, | ||
'-a', run_tracefile, | ||
'--rc', 'lcov_branch_coverage=1', | ||
'-o', raw_tracefile]) | ||
# Remove all directories outside the source_root from the covinfo | ||
subprocess.check_call([lcov_exe, | ||
'--extract', raw_tracefile, | ||
os.path.join(source_root, '*'), | ||
'--rc', 'lcov_branch_coverage=1', | ||
'--output-file', covinfo]) | ||
# Remove all directories inside subproject dir | ||
subprocess.check_call([lcov_exe, | ||
'--remove', covinfo, | ||
os.path.join(subproject_root, '*'), | ||
'--rc', 'lcov_branch_coverage=1', | ||
'--output-file', covinfo]) | ||
subprocess.check_call([genhtml_exe, | ||
'--prefix', build_root, | ||
'--prefix', source_root, | ||
'--output-directory', htmloutdir, | ||
'--title', 'Code coverage', | ||
'--legend', | ||
'--show-details', | ||
'--branch-coverage', | ||
covinfo]) | ||
|
||
outfiles.append(('Html', html_index)) | ||
|
||
if outfiles: | ||
print('') | ||
for (filetype, path) in outfiles: | ||
print(filetype + ' coverage report can be found at', path) | ||
|