Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 96 additions & 0 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: Python Package CI/CD

on:
push:
branches:
- main
tags:
- "v*"
pull_request:
branches:
- main

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest ruff build

- name: Lint
run: |
ruff check .

- name: Run tests
run: |
pytest

build:
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Install build tools
run: |
python -m pip install --upgrade pip
pip install build twine

- name: Clean old build artifacts (Just in case)
run: |
rm -rf dist/ build/ *.egg-info

- name: Build package
run: |
python -m build

- name: Check package
run: |
twine check dist/*

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: python-package
path: dist/*
retention-days: 1

publish:
if: startsWith(github.ref, 'refs/tags/')
needs: build
runs-on: ubuntu-latest
permissions:
id-token: write

environment:
name: pypi

steps:
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: python-package
path: dist

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,3 @@ flowchart TD
## 13. License

This project is released under the MIT License. See [LICENSE](./LICENSE).

---

If you plan to publish on GitHub, recommended next step is to add a small `CHANGELOG.md` and one architecture diagram image under `docs/` for faster onboarding.
Loading