Skip to content

Commit b0aaea8

Browse files
feat: support coverage ci for python sdk (#2025)
* feat: support coverage ci for python sdk Signed-off-by: mango <[email protected]> * use `pytest` to cover unit test Signed-off-by: mango <[email protected]> * remove empty blank Signed-off-by: mango <[email protected]> * fix coverage ci error Signed-off-by: mango <[email protected]> * consistent coverage name Signed-off-by: mango <[email protected]>
1 parent 306be5f commit b0aaea8

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

.github/workflows/sdk.yml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ jobs:
263263
pip install setuptools wheel twine
264264
yum install -y net-tools
265265
266-
- name: test sqlalchemy
266+
- name: test sqlalchemy and generate coverage report
267267
run: |
268268
bash steps/test_python.sh
269269
@@ -275,6 +275,14 @@ jobs:
275275
path: |
276276
python/openmldb/test/pytest.xml
277277
278+
- name: upload python coverage to codecov
279+
uses: codecov/codecov-action@v2
280+
with:
281+
name: coverage
282+
files: python/test/coverage.xml
283+
fail_ci_if_error: true
284+
verbose: true
285+
278286
- name: upload to pypi
279287
if: >
280288
github.repository == '4paradigm/OpenMLDB' && startsWith(github.ref, 'refs/tags/v')

steps/test_python.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,9 @@ cd "${ROOT_DIR}"/python/dist/
4343
whl_name=$(ls openmldb*.whl)
4444
echo "whl_name:${whl_name}"
4545
python3 -m pip install "${whl_name}" -i https://pypi.tuna.tsinghua.edu.cn/simple
46+
python3 -m pip install pytest-cov
4647

4748
cd "${ROOT_DIR}"/python/test
48-
pytest -vv --junit-xml=pytest.xml
49+
pytest -vv --junit-xml=pytest.xml --cov=./ --cov-report=xml
4950
cd "${ROOT_DIR}"/onebox && sh stop_all.sh && cd "$ROOT_DIR"
5051
cd "$THIRDSRC/zookeeper-3.4.14" && ./bin/zkServer.sh stop && cd "$ROOT_DIR"

0 commit comments

Comments
 (0)