Skip to content

Commit 73a3b22

Browse files
committed
feat[CI]: Expand CI to support Python version matrix and add coverage thresholds.
1 parent 44d3e75 commit 73a3b22

File tree

2 files changed

+51
-9
lines changed

2 files changed

+51
-9
lines changed

.github/workflows/ci.yml

Lines changed: 49 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,38 +2,80 @@ name: CI Pipeline
22

33
on:
44
push:
5-
branches: [ main, develop ]
5+
branches: [ main, develop, feature/* ]
66
pull_request:
77
branches: [ main, develop ]
88
workflow_dispatch:
99

1010
jobs:
1111
test:
12+
name: Tests (Python ${{ matrix.python-version }})
1213
runs-on: ubuntu-latest
14+
15+
strategy:
16+
matrix:
17+
python-version: ["3.11", "3.12", "3.13"]
18+
1319
steps:
1420
- name: Checkout code
1521
uses: actions/checkout@v4
1622

17-
- name: Set up Python 3.13
23+
- name: Set up Python ${{ matrix.python-version }}
1824
uses: actions/setup-python@v5
1925
with:
20-
python-version: "3.13"
26+
python-version: ${{ matrix.python-version }}
2127
cache: 'pip'
2228

2329
- name: Install dependencies
2430
run: |
2531
python -m pip install --upgrade pip
2632
pip install -r requirements.txt
2733
28-
- name: Run tests with coverage
34+
- name: Run unit tests with coverage
35+
env:
36+
USE_REAL_OPENSTACK: "False"
37+
ENVIRONMENT: "test"
38+
run: |
39+
pytest --cov=app --cov-report=term --cov-report=xml --cov-report=html
40+
41+
- name: Check coverage threshold
42+
run: |
43+
coverage report --fail-under=85
44+
45+
- name: Upload coverage reports to Codecov
46+
if: matrix.python-version == '3.13'
47+
uses: codecov/codecov-action@v4
48+
with:
49+
file: ./coverage.xml
50+
flags: unittests
51+
name: codecov-umbrella
52+
fail_ci_if_error: false
53+
token: ${{ secrets.CODECOV_TOKEN }}
54+
55+
lint:
56+
name: Code Quality Checks
57+
runs-on: ubuntu-latest
58+
59+
steps:
60+
- name: Checkout code
61+
uses: actions/checkout@v4
62+
63+
- name: Set up Python
64+
uses: actions/setup-python@v5
65+
with:
66+
python-version: "3.13"
67+
cache: 'pip'
68+
69+
- name: Install dependencies
2970
run: |
30-
pytest tests/ -v --cov=app --cov-report=term-missing
71+
python -m pip install --upgrade pip
72+
pip install -r requirements.txt
3173
3274
- name: Check code formatting (Black)
3375
run: black --check app/ tests/ main.py
3476

3577
- name: Run type checking (Mypy)
36-
run: mypy app/ main.py
78+
run: mypy app/ main.py --ignore-missing-imports
3779

3880
- name: Run linting (Flake8)
39-
run: flake8 app/ tests/ main.py --max-line-length=120
81+
run: flake8 app/ tests/ main.py --max-line-length=120 --extend-ignore=E203,W503

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
[![CI Pipeline](https://github.com/ibmgeniuz/openstack-vm-lifecycle-api/actions/workflows/ci.yml/badge.svg)](https://github.com/ibmgeniuz/openstack-vm-lifecycle-api/actions/workflows/ci.yml)
44
[![Python 3.13](https://img.shields.io/badge/python-3.13-blue.svg)](https://www.python.org)
5-
[![Coverage](https://img.shields.io/badge/coverage-90%25-green)](#testing)
5+
[![Coverage](https://img.shields.io/badge/coverage-95.34%25-green)](#testing)
66

7-
**Status:****COMPLETE & PRODUCTION READY** | **Tests:** 53/53 Passed (90% Coverage) | **Build:** CLEAN
7+
**Status:****COMPLETE & PRODUCTION READY** | **Tests:** 53/53 Passed (>95% Coverage) | **Build:** CLEAN
88

99

1010
A REST API for managing OpenStack virtual machine lifecycle operations, built with FastAPI as a proof-of-concept demonstrating API design, Python best practices, and software engineering principles.

0 commit comments

Comments
 (0)