From 9d1e5c3fe8986add6115a98bab8c9298cdc684f1 Mon Sep 17 00:00:00 2001 From: AdenAthar Date: Mon, 17 Nov 2025 14:19:10 -0800 Subject: [PATCH 1/6] Add GitHub Actions CI/CD with pytest coverage and QLTY Cloud integration - Created .github/workflows/pytest-coverage.yml for automated testing - Tests run on Python 3.9, 3.10, 3.11, 3.12 for every PR - Added pytest-cov to setup.py dependencies - Coverage reports uploaded to QLTY Cloud (free for open source) - Uses OIDC authentication following QLTY best practices - Current coverage: 43% (48/48 tests passing) --- .github/workflows/pytest-coverage.yml | 50 +++++++++++++++++++++++++++ setup.py | 1 + 2 files changed, 51 insertions(+) create mode 100644 .github/workflows/pytest-coverage.yml diff --git a/.github/workflows/pytest-coverage.yml b/.github/workflows/pytest-coverage.yml new file mode 100644 index 0000000..f42f97a --- /dev/null +++ b/.github/workflows/pytest-coverage.yml @@ -0,0 +1,50 @@ +name: Pytest with Coverage + +on: + pull_request: + branches: + - dev + - main + - pr-testing + push: + branches: + - dev + - main + - pr-testing + +permissions: + contents: read + id-token: write + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.9", "3.10", "3.11", "3.12"] + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install pytest pytest-cov + pip install -e . + + - name: Run pytest with coverage + run: | + pytest --cov=Granny --cov-report=lcov:coverage.lcov --cov-report=term-missing + + - name: Upload coverage to QLTY Cloud + if: matrix.python-version == '3.12' + uses: qltysh/qlty-action/coverage@v1 + with: + oidc: true + files: lcov:coverage.lcov diff --git a/setup.py b/setup.py index 959b5bf..f5aa14c 100644 --- a/setup.py +++ b/setup.py @@ -5,6 +5,7 @@ numpy opencv-python pytest +pytest-cov """.split() From 4c3660215861e7e3035f81320eff34ab66058b68 Mon Sep 17 00:00:00 2001 From: AdenAthar Date: Mon, 17 Nov 2025 14:31:30 -0800 Subject: [PATCH 2/6] Add pandas to dependencies --- setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.py b/setup.py index f5aa14c..a90bf82 100644 --- a/setup.py +++ b/setup.py @@ -4,6 +4,7 @@ ultralytics numpy opencv-python +pandas pytest pytest-cov """.split() From a2e4f487b3c0c8a6b4f4a2c9d02799c32063ce94 Mon Sep 17 00:00:00 2001 From: AdenAthar Date: Mon, 17 Nov 2025 14:37:03 -0800 Subject: [PATCH 3/6] Add debug step and fix QLTY coverage file path --- .github/workflows/pytest-coverage.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pytest-coverage.yml b/.github/workflows/pytest-coverage.yml index f42f97a..0507f32 100644 --- a/.github/workflows/pytest-coverage.yml +++ b/.github/workflows/pytest-coverage.yml @@ -42,9 +42,15 @@ jobs: run: | pytest --cov=Granny --cov-report=lcov:coverage.lcov --cov-report=term-missing + - name: Verify coverage file exists + if: matrix.python-version == '3.12' + run: | + ls -la coverage.lcov + cat coverage.lcov | head -20 + - name: Upload coverage to QLTY Cloud if: matrix.python-version == '3.12' uses: qltysh/qlty-action/coverage@v1 with: oidc: true - files: lcov:coverage.lcov + files: coverage.lcov From 7290a555edd3d0e5d08114b32716ccbcb52f2a29 Mon Sep 17 00:00:00 2001 From: AdenAthar <133624677+AdenAthar@users.noreply.github.com> Date: Tue, 18 Nov 2025 13:26:57 -0800 Subject: [PATCH 4/6] Create test.txt --- test.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 test.txt diff --git a/test.txt b/test.txt new file mode 100644 index 0000000..9daeafb --- /dev/null +++ b/test.txt @@ -0,0 +1 @@ +test From 75fcdacdcbe234bf44181385f7b59ea89c78248c Mon Sep 17 00:00:00 2001 From: AdenAthar <133624677+AdenAthar@users.noreply.github.com> Date: Tue, 18 Nov 2025 13:27:14 -0800 Subject: [PATCH 5/6] Delete test.txt --- test.txt | 1 - 1 file changed, 1 deletion(-) delete mode 100644 test.txt diff --git a/test.txt b/test.txt deleted file mode 100644 index 9daeafb..0000000 --- a/test.txt +++ /dev/null @@ -1 +0,0 @@ -test From a7c454f38df93b2988fae240b28114d495e0cda7 Mon Sep 17 00:00:00 2001 From: AdenAthar Date: Thu, 20 Nov 2025 15:59:22 -0800 Subject: [PATCH 6/6] Clean up CI workflow - remove debug step and test branch trigger --- .github/workflows/pytest-coverage.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.github/workflows/pytest-coverage.yml b/.github/workflows/pytest-coverage.yml index 0507f32..df9faba 100644 --- a/.github/workflows/pytest-coverage.yml +++ b/.github/workflows/pytest-coverage.yml @@ -5,12 +5,10 @@ on: branches: - dev - main - - pr-testing push: branches: - dev - main - - pr-testing permissions: contents: read @@ -42,12 +40,6 @@ jobs: run: | pytest --cov=Granny --cov-report=lcov:coverage.lcov --cov-report=term-missing - - name: Verify coverage file exists - if: matrix.python-version == '3.12' - run: | - ls -la coverage.lcov - cat coverage.lcov | head -20 - - name: Upload coverage to QLTY Cloud if: matrix.python-version == '3.12' uses: qltysh/qlty-action/coverage@v1