From 54c87c5ee764d14c35bd4d8677fd80b1b2918605 Mon Sep 17 00:00:00 2001 From: Kai Chappell Date: Thu, 23 Jan 2025 12:27:02 +0000 Subject: [PATCH] Add versioning strategy and CI/CD pipeline - Add semantic versioning section to development plan - Map sprint milestones to version tags - Create Gitea Actions CI workflow (lint, typecheck, test, release) - Add CHANGELOG.md following Keep a Changelog format --- .gitea/workflows/ci.yaml | 97 ++++++++++++++++++++++++++++++++++++ CHANGELOG.md | 36 ++++++++++++++ docs/04_development_plan.md | 99 +++++++++++++++++++++++++++++++++---- 3 files changed, 223 insertions(+), 9 deletions(-) create mode 100644 .gitea/workflows/ci.yaml create mode 100644 CHANGELOG.md diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml new file mode 100644 index 0000000..416398b --- /dev/null +++ b/.gitea/workflows/ci.yaml @@ -0,0 +1,97 @@ +name: CI + +on: + push: + branches: [master, main] + tags: ['v*'] + pull_request: + branches: [master, main] + +jobs: + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.11' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install ruff + + - name: Run Ruff + run: ruff check src/ tests/ + + typecheck: + name: Type Check + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.11' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -e ".[dev]" + + - name: Run mypy + run: mypy src/ + + test: + name: Test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.11' + + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -e ".[dev]" + + - name: Run pytest + run: pytest --cov=src/py_dvt_ate --cov-report=xml + + - name: Check coverage + run: | + coverage report --fail-under=80 || echo "Coverage below 80% - will enforce after MVP" + + release: + name: Release + needs: [lint, typecheck, test] + if: startsWith(github.ref, 'refs/tags/v') + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.11' + + - name: Install build tools + run: | + python -m pip install --upgrade pip + pip install build + + - name: Build package + run: python -m build + + - name: Create Release + uses: softprops/action-gh-release@v1 + with: + files: dist/* + generate_release_notes: true diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..51e5512 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,36 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [Unreleased] + +### Added +- Project documentation (requirements, technical specification, architecture decisions) +- Development plan with vertical slice approach +- CI/CD pipeline configuration + +## [0.0.1] - TBD + +### Added +- Initial project scaffolding +- pyproject.toml with dependencies +- Package directory structure +- Development tooling configuration (ruff, mypy, pytest) +- CLI entry point stub + +--- + +## Version History + +| Version | Date | Milestone | +|---------|------|-----------| +| 0.1.0 | TBD | MVP Complete | +| 0.1.0-beta.2 | TBD | First DVT test runs | +| 0.1.0-beta.1 | TBD | HAL complete | +| 0.1.0-alpha.3 | TBD | Network ready | +| 0.1.0-alpha.2 | TBD | Visual demo | +| 0.1.0-alpha.1 | TBD | Physics engine | +| 0.0.1 | TBD | Project scaffolding | diff --git a/docs/04_development_plan.md b/docs/04_development_plan.md index 82ccea0..06f80fc 100644 --- a/docs/04_development_plan.md +++ b/docs/04_development_plan.md @@ -555,17 +555,98 @@ dashboard/app.py → hal/factory.py (Sprint 17, upgraded) --- +## Versioning Strategy + +### Semantic Versioning + +This project follows [Semantic Versioning 2.0.0](https://semver.org/): + +``` +MAJOR.MINOR.PATCH[-PRERELEASE] + +- MAJOR: Breaking API changes +- MINOR: New features, backwards compatible +- PATCH: Bug fixes, backwards compatible +- PRERELEASE: alpha.N, beta.N, rc.N +``` + +### Phase 1 Version Progression + +| Sprint | Version Tag | Milestone | Release Type | +|--------|-------------|-----------|--------------| +| 1 | `v0.0.1` | Project scaffolding | Internal | +| 3 | `v0.1.0-alpha.1` | Physics engine working | Pre-release | +| 4 | `v0.1.0-alpha.2` | Visual demo (dashboard) | Pre-release | +| 8 | `v0.1.0-alpha.3` | Network ready (TCP server) | Pre-release | +| 11 | `v0.1.0-beta.1` | HAL complete | Pre-release | +| 15 | `v0.1.0-beta.2` | First DVT test runs | Pre-release | +| 17 | `v0.1.0` | **MVP Complete** | Release | + +### Tagging Convention + +```bash +# After completing a milestone sprint: +git tag -a v0.1.0-alpha.1 -m "Physics engine working" +git push origin v0.1.0-alpha.1 +``` + +### Version Location + +The version is defined in **one place** and read elsewhere: + +``` +src/py_dvt_ate/__init__.py: + __version__ = "0.1.0-alpha.1" + +pyproject.toml: + [project] + dynamic = ["version"] + + [tool.hatch.version] + path = "src/py_dvt_ate/__init__.py" +``` + +### CI/CD Pipeline + +On every push: +- Run `ruff check` (linting) +- Run `mypy` (type checking) +- Run `pytest` (tests) + +On tag push (`v*`): +- All of the above +- Build package +- Create release + +### CHANGELOG + +Maintain `CHANGELOG.md` following [Keep a Changelog](https://keepachangelog.com/): + +```markdown +## [Unreleased] +### Added +- ... + +## [0.1.0-alpha.1] - 2025-12-XX +### Added +- Physics engine with thermal-electrical coupling +- LDO DUT model with temperature coefficient +``` + +--- + ## Milestone Summary -| Sprint | Milestone | What You Can Demo | -|--------|-----------|-------------------| -| 3 | Physics Working | Unit tests prove thermal coupling | -| 4 | **Visual Demo!** | Interactive Streamlit showing physics | -| 7 | Instruments Done | SCPI simulators respond to commands | -| 8 | Network Ready | TCP server accepts connections | -| 11 | HAL Complete | Abstraction layer swappable | -| 15 | First Test | TempCo characterisation runs | -| 17 | **MVP Complete** | Full end-to-end workflow | +| Sprint | Version | Milestone | What You Can Demo | +|--------|---------|-----------|-------------------| +| 1 | `v0.0.1` | Scaffolding | Package installs | +| 3 | `v0.1.0-alpha.1` | Physics Working | Unit tests prove thermal coupling | +| 4 | `v0.1.0-alpha.2` | **Visual Demo!** | Interactive Streamlit showing physics | +| 7 | - | Instruments Done | SCPI simulators respond to commands | +| 8 | `v0.1.0-alpha.3` | Network Ready | TCP server accepts connections | +| 11 | `v0.1.0-beta.1` | HAL Complete | Abstraction layer swappable | +| 15 | `v0.1.0-beta.2` | First Test | TempCo characterisation runs | +| 17 | `v0.1.0` | **MVP Complete** | Full end-to-end workflow | ---