Skip to content

Commit 0fbcc38

Browse files
Harshg999athithyaaselvam
authored andcommitted
[ci] Refactor backend Github Actions workflow and add pytest coverage PR comment (#4028)
1 parent c759a02 commit 0fbcc38

File tree

2 files changed

+25
-15
lines changed

2 files changed

+25
-15
lines changed

.github/workflows/commitflow-py3.yml

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
with:
2323
fetch-depth: 0
2424

25-
- name: run commit title format check
25+
- name: Check commit title format
2626
run: |
2727
./tools/ci/check_for_commit_message.sh
2828
@@ -47,7 +47,7 @@ jobs:
4747
node-version: 20
4848
cache: 'npm'
4949

50-
- name: compile
50+
- name: Build Hue
5151
run: |
5252
sudo apt-get update
5353
sudo apt-get install -y gcc g++ build-essential python${{ matrix.python-version }}-dev python${{ matrix.python-version }}-venv python${{ matrix.python-version }}-distutils asciidoc rsync curl sudo libkrb5-dev libldap2-dev libsasl2-dev libxml2-dev libxslt-dev libsasl2-modules-gssapi-mit libsnappy-dev libffi-dev # This should not be needed as some point
@@ -59,23 +59,32 @@ jobs:
5959
export ROOT=$PWD
6060
make test_prep
6161
62-
- name: run tests
62+
- name: Run python unit tests
6363
run: |
6464
./build/env/bin/pytest
6565
66-
- name: upload pytest report
67-
uses: actions/upload-artifact@v4
68-
with:
69-
name: hue-pytest-report-${{ matrix.python-version }}
70-
path: reports/pytest
71-
72-
- name: upload code coverage report
66+
- name: Upload pytest and code coverage reports
67+
if: matrix.python-version == '3.11'
7368
uses: actions/upload-artifact@v4
7469
with:
75-
name: hue-code-cov-report-${{ matrix.python-version }}
76-
path: reports/code-cov
70+
name: hue-test-reports
71+
path: ./reports
7772

78-
- name: Check and comment if no unit test files are modified
73+
- name: Add pytest and code coverage PR comment
74+
if: matrix.python-version == '3.11'
75+
uses: MishaKav/pytest-coverage-comment@v1
76+
with:
77+
pytest-xml-coverage-path: ./reports/code-cov/coverage.xml
78+
junitxml-path: ./reports/pytest/test_report.xml
79+
junitxml-title: Pytest Report
80+
title: Backend Code Coverage Report
81+
badge-title: Backend Codecov
82+
report-only-changed-files: true
83+
xml-skip-covered: true
84+
remove-link-from-badge: true
85+
default-branch: master
86+
87+
- name: Check and comment if no unit test files modified
7988
if: matrix.python-version == '3.11'
8089
run: |
8190
git fetch origin master
@@ -93,11 +102,11 @@ jobs:
93102
"https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}/comments"
94103
fi
95104
96-
- name: run python lints
105+
- name: Run python lints
97106
run: |
98107
PYTHONWARNINGS=always ./build/env/bin/hue runruff check
99108
100-
- name: run documentation lints
109+
- name: Run documentation lints
101110
run: |
102111
curl -O https://dl.google.com/go/go1.23.4.linux-amd64.tar.gz
103112
tar -xvf go1.23.4.linux-amd64.tar.gz

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ addopts = """
77
'not integration' \
88
--strict-markers \
99
--disable-warnings \
10+
--junit-xml=reports/pytest/test_report.xml \
1011
--html=reports/pytest/report.html \
1112
--self-contained-html \
1213
--cov=./ \

0 commit comments

Comments
 (0)