Skip to content

Commit dfcf00a

Browse files
authored
feat: Enhance repository with professional metadata, badges, and CI/CD
feat: Add professional metadata, badges, and unified CI/CD workflow This commit professionalizes the repository by adding rich project metadata, status badges, and a new, unified CI/CD pipeline. Key changes: - **Metadata:** Updates `pyproject.toml` with PyPI classifiers, keywords, project URLs, and configures pytest for coverage reporting. - **README:** Enhances `README.md` with a full suite of status badges (PyPI, build status, code coverage, etc.). - **CI/CD:** Implements a new, unified workflow in `.github/workflows/ci-cd.yml` that replaces the old CI. This pipeline: - Triggers on pushes and pull requests to `main` and `develop`. - Handles linting and testing on multiple Python versions. - Uploads code coverage reports to Codecov. - Automates publishing to PyPI on new version tags. - **Fix:** Resolves Codecov integration failures by updating the `codecov/codecov-action` to a valid commit SHA and explicitly setting the repository slug to fix "Repository not found" errors.
1 parent 48efbc2 commit dfcf00a

4 files changed

Lines changed: 191 additions & 4 deletions

File tree

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
name: CI
1+
name: CI/CD
22

33
on:
44
push:
55
branches:
66
- main
77
- develop
8+
tags:
9+
- 'v*.*.*'
810
pull_request:
911
branches:
1012
- main
@@ -60,3 +62,35 @@ jobs:
6062

6163
- name: Run tests
6264
run: poetry run pytest
65+
66+
- name: Upload coverage to Codecov
67+
uses: codecov/codecov-action@5a1091511ad55cbe89839c7260b706298ca349f7
68+
with:
69+
token: ${{ secrets.CODECOV_TOKEN }}
70+
slug: ${{ github.repository }}
71+
fail_ci_if_error: true
72+
verbose: true
73+
74+
release:
75+
if: startsWith(github.ref, 'refs/tags/v')
76+
needs: test
77+
runs-on: ubuntu-latest
78+
permissions:
79+
id-token: write
80+
steps:
81+
- uses: actions/checkout@ff7abcd0c3c05ccf6adc123a8cd1fd4fb30fb493
82+
- name: Set up Python
83+
uses: actions/setup-python@cfd55ca82492758d853442341ad4d8010466803a
84+
with:
85+
python-version: '3.12'
86+
87+
- name: Install Poetry
88+
uses: snok/install-poetry@ff8a7d7de27005376176819789742a2280cc35e2
89+
- name: Build package
90+
run: poetry build
91+
92+
- name: Publish to PyPI
93+
uses: pypa/gh-action-pypi-publish@2f6f737ca5f74c637829c0f5c3acd0e29ea5e8bf
94+
with:
95+
user: __token__
96+
password: ${{ secrets.PYPI_API_TOKEN }}

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# my_python_project
22

3+
[![PyPI Version](https://img.shields.io/pypi/v/my_python_project)](https://pypi.org/project/my_python_project/)
4+
[![Build Status](https://img.shields.io/github/actions/workflow/status/[USERNAME]/[REPO_NAME]/ci-cd.yml?branch=main)](https://github.com/[USERNAME]/[REPO_NAME]/actions/workflows/ci-cd.yml)
5+
[![Codecov](https://img.shields.io/codecov/c/github/[USERNAME]/[REPO_NAME])](https://codecov.io/gh/[USERNAME]/[REPO_NAME])
6+
[![License](https://img.shields.io/badge/License-Prosperity%203.0.0-blue.svg)](LICENSE)
7+
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
8+
[![Python Versions](https://img.shields.io/pypi/pyversions/my_python_project)](https://pypi.org/project/my_python_project)
9+
310
This is a best-in-class Python package template.
411

512
## Getting Started

poetry.lock

Lines changed: 129 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,24 @@
11
[tool.poetry]
22
name = "my_python_project"
33
version = "0.1.0"
4-
description = ""
4+
description = "A best-in-class Python package template."
55
authors = ["CoReason, Inc. <gowtham.rao@coreason.ai>"]
66
readme = "README.md"
7+
license = "Prosperity-3.0.0"
8+
homepage = "https://github.com/[USERNAME]/[REPO_NAME]"
9+
repository = "https://github.com/[USERNAME]/[REPO_NAME]"
10+
documentation = "https://github.com/[USERNAME]/[REPO_NAME]"
11+
keywords = ["template", "poetry", "python"]
12+
classifiers = [
13+
"Development Status :: 3 - Alpha",
14+
"Intended Audience :: Developers",
15+
"License :: Other/Proprietary License",
16+
"Operating System :: OS Independent",
17+
"Programming Language :: Python :: 3",
18+
"Programming Language :: Python :: 3.10",
19+
"Programming Language :: Python :: 3.11",
20+
"Programming Language :: Python :: 3.12",
21+
]
722

823
[tool.poetry.dependencies]
924
python = "^3.10"
@@ -13,7 +28,11 @@ pytest = "^8.4.2"
1328
ruff = "^0.14.2"
1429
mypy = "^1.18.2"
1530
pre-commit = "^4.3.0"
31+
pytest-cov = "^5.0.0"
1632

1733
[build-system]
1834
requires = ["poetry-core"]
1935
build-backend = "poetry.core.masonry.api"
36+
37+
[tool.pytest.ini_options]
38+
addopts = "--cov=src --cov-report=xml"

0 commit comments

Comments
 (0)