Skip to content

Commit ce3fbe7

Browse files
Use scripts/gen_coverage.py in generate-coverage workflow
Convert two .lcov files from different runs into 2 json files, combine them in Python and then use coveralls to merge the combined result with coverage data and upload
1 parent 8974e9e commit ce3fbe7

File tree

1 file changed

+13
-27
lines changed

1 file changed

+13
-27
lines changed

.github/workflows/generate-coverage.yaml

Lines changed: 13 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -85,30 +85,7 @@ jobs:
8585
shell: bash -l {0}
8686
run: |
8787
source /opt/intel/oneapi/setvars.sh
88-
export _SAVED_PATH=${PATH}
89-
export PATH=$(dirname $(dirname $(which icx)))/bin-llvm:${PATH}
90-
python setup.py develop -- \
91-
-G "Ninja" \
92-
-DCMAKE_BUILD_TYPE=Debug \
93-
-DCMAKE_C_COMPILER:PATH=icx \
94-
-DCMAKE_CXX_COMPILER:PATH=icpx \
95-
-DDPCTL_ENABLE_L0_PROGRAM_CREATION=ON \
96-
-DDPCTL_GENERATE_COVERAGE=ON \
97-
-DDPCTL_BUILD_CAPI_TESTS=ON \
98-
-DDPCTL_COVERAGE_REPORT_OUTPUT_DIR=$(pwd)
99-
pushd $(find _skbuild -name cmake-build)
100-
cmake --build . --target lcov-genhtml || exit 1
101-
popd
102-
export PATH=${_SAVED_PATH}
103-
unset _SAVED_PATH
104-
python -c "import dpctl; print(dpctl.__version__); dpctl.lsplatform()" || exit 1
105-
export LLVM_PROFILE_FILE="dpctl_pytest.profraw"
106-
pytest -q -ra --disable-warnings --cov-config pyproject.toml --cov dpctl \
107-
--cov-report term-missing --pyargs dpctl -vv \
108-
--ignore=dpctl/tensor/libtensor/tests || exit 1
109-
$(dirname $(dirname $(which icx)))/bin-llvm/llvm-profdata merge \
110-
-sparse ${LLVM_PROFILE_FILE} -o dpctl_pytest.profdata || exit 1
111-
88+
python scripts/gen_coverage.py
11289
11390
- name: Install coverall dependencies
11491
shell: bash -l {0}
@@ -120,9 +97,18 @@ jobs:
12097
shell: bash -l {0}
12198
run: |
12299
coveralls-lcov -v -n \
123-
$(find _skbuild -name dpctl.lcov) \
124-
$(find . -name dpctl_pytest.lcov) > dpctl-c-api-coverage.json
125-
coveralls --service=github --merge=dpctl-c-api-coverage.json
100+
$(find _skbuild -name dpctl.lcov) > dpctl-c-api-coverage.json
101+
coveralls-lcov -v -n \
102+
$(find . -name dpctl_pytest.lcov) > pytest-dpctl-c-api-coverage.json
103+
# merge json files
104+
python -c "import json; \
105+
f1 = json.load('dpctl-c-api-coverage.json"); \
106+
f2 = json.load('pytest-dpctl-c-api-coverage.json"); \
107+
f3 = {'source_files': f1['source_files'] + f2['source_files']}; \
108+
fh = open('combined-dpctl-c-api-coverage.json', 'w'); \
109+
json.dump(f3, fh); fh.close()" || exit 1
110+
# merge combined file with coverage data and upload
111+
coveralls --service=github --merge=combined-dpctl-c-api-coverage.json
126112
env:
127113
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
128114
COVERALLS_PARALLEL: true

0 commit comments

Comments
 (0)