Skip to content

Commit 0ef9a4f

Browse files
committed
Feature/Updated license to MIT and modified project metadata in pyproject.toml
1 parent c89e9f8 commit 0ef9a4f

9 files changed

Lines changed: 400 additions & 326 deletions

File tree

.github/workflows/publish.yml

Lines changed: 0 additions & 33 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*.*.*"
7+
8+
jobs:
9+
validate:
10+
name: Validate Release
11+
runs-on: ubuntu-latest
12+
13+
outputs:
14+
version: ${{ steps.version.outputs.version }}
15+
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Validate Branch
23+
run: |
24+
TAG_COMMIT=$(git rev-list -n 1 ${{ github.ref_name }})
25+
26+
if ! git merge-base --is-ancestor $TAG_COMMIT origin/main; then
27+
echo "❌ ERROR: Tag ${{ github.ref_name }} is not on main branch"
28+
echo "Tags must be created from commits that are on main."
29+
exit 1
30+
fi
31+
32+
echo "✅ Tag ${{ github.ref_name }} is on main branch"
33+
34+
- name: Extract Version
35+
id: version
36+
run: |
37+
VERSION="${{ github.ref_name }}"
38+
VERSION="${VERSION#v}"
39+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
40+
echo "📦 Version: $VERSION"
41+
42+
- name: Validate Version Format
43+
run: |
44+
VERSION="${{ steps.version.outputs.version }}"
45+
if ! echo "$VERSION" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?$'; then
46+
echo "❌ ERROR: Invalid version format: $VERSION"
47+
echo "Expected: X.Y.Z or X.Y.Z-suffix"
48+
exit 1
49+
fi
50+
echo "✅ Version format valid: $VERSION"
51+
52+
build:
53+
name: Build Package
54+
runs-on: ubuntu-latest
55+
needs: [validate]
56+
57+
steps:
58+
- name: Checkout
59+
uses: actions/checkout@v4
60+
61+
- name: Install uv
62+
uses: astral-sh/setup-uv@v5
63+
64+
- name: Set up Python
65+
uses: actions/setup-python@v5
66+
with:
67+
python-version: "3.12"
68+
69+
- name: Update Version
70+
run: |
71+
sed -i 's/version = ".*"/version = "${{ needs.validate.outputs.version }}"/' pyproject.toml
72+
73+
- name: Build Package
74+
run: uv build
75+
76+
- name: Verify Package
77+
run: |
78+
echo "📦 Built packages:"
79+
ls -la dist/
80+
81+
- name: Upload Artifacts
82+
uses: actions/upload-artifact@v4
83+
with:
84+
name: dist
85+
path: dist/
86+
retention-days: 5
87+
88+
test-install:
89+
name: Test Install (py${{ matrix.python-version }})
90+
runs-on: ubuntu-latest
91+
needs: [build]
92+
93+
strategy:
94+
matrix:
95+
python-version: ["3.11", "3.12", "3.13"]
96+
97+
steps:
98+
- name: Set up Python ${{ matrix.python-version }}
99+
uses: actions/setup-python@v5
100+
with:
101+
python-version: ${{ matrix.python-version }}
102+
103+
- name: Download Artifacts
104+
uses: actions/download-artifact@v4
105+
with:
106+
name: dist
107+
path: dist/
108+
109+
- name: Install Package
110+
run: |
111+
pip install dist/*.whl
112+
pip show complexheart-domain-model
113+
114+
publish-pypi:
115+
name: Publish to PyPI
116+
runs-on: ubuntu-latest
117+
needs: [validate, build, test-install]
118+
environment: pypi
119+
120+
permissions:
121+
id-token: write
122+
123+
steps:
124+
- name: Download Artifacts
125+
uses: actions/download-artifact@v4
126+
with:
127+
name: dist
128+
path: dist/
129+
130+
- name: Publish to PyPI
131+
uses: pypa/gh-action-pypi-publish@release/v1
132+
with:
133+
print-hash: true
134+
135+
github-release:
136+
name: Create GitHub Release
137+
runs-on: ubuntu-latest
138+
needs: [validate, publish-pypi]
139+
140+
permissions:
141+
contents: write
142+
143+
steps:
144+
- name: Checkout
145+
uses: actions/checkout@v4
146+
147+
- name: Download Artifacts
148+
uses: actions/download-artifact@v4
149+
with:
150+
name: dist
151+
path: dist/
152+
153+
- name: Create Release
154+
uses: softprops/action-gh-release@v2
155+
with:
156+
tag_name: ${{ github.ref_name }}
157+
name: Release ${{ needs.validate.outputs.version }}
158+
draft: false
159+
prerelease: ${{ contains(github.ref_name, '-') }}
160+
generate_release_notes: true
161+
files: dist/*

.github/workflows/test.yml

Lines changed: 129 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2,47 +2,153 @@ name: Test
22

33
on:
44
push:
5-
branches: [ 'main' ]
5+
branches: [main]
66
pull_request:
7-
types: [ 'opened', 'synchronize', 'reopened' ]
7+
branches: [main]
8+
types: [opened, synchronize, reopened]
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
813

914
jobs:
15+
lint:
16+
name: Lint
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
23+
- name: Install uv
24+
uses: astral-sh/setup-uv@v5
25+
26+
- name: Set up Python
27+
uses: actions/setup-python@v5
28+
with:
29+
python-version: "3.12"
30+
31+
- name: Install dependencies
32+
run: uv sync --all-extras
33+
34+
- name: Check formatting
35+
run: uv run ruff format --check complexheart/ tests/
36+
37+
- name: Check linting
38+
run: uv run ruff check complexheart/ tests/
39+
40+
typecheck:
41+
name: Type Check
42+
runs-on: ubuntu-latest
43+
44+
steps:
45+
- name: Checkout
46+
uses: actions/checkout@v4
47+
48+
- name: Install uv
49+
uses: astral-sh/setup-uv@v5
50+
51+
- name: Set up Python
52+
uses: actions/setup-python@v5
53+
with:
54+
python-version: "3.12"
55+
56+
- name: Install dependencies
57+
run: uv sync --all-extras
58+
59+
- name: Run mypy
60+
run: uv run mypy complexheart/
61+
continue-on-error: true
62+
1063
test:
64+
name: Test (py${{ matrix.python-version }})
1165
runs-on: ubuntu-latest
66+
needs: [lint]
67+
1268
strategy:
69+
fail-fast: false
1370
matrix:
14-
python-version: [ '3.8', '3.9', '3.10', '3.11' ]
71+
python-version: ["3.11", "3.12", "3.13"]
1572

1673
steps:
17-
- name: Checkout Source Code
18-
uses: actions/checkout@v2
19-
with:
20-
fetch-depth: 0
74+
- name: Checkout
75+
uses: actions/checkout@v4
76+
77+
- name: Install uv
78+
uses: astral-sh/setup-uv@v5
2179

22-
- name: Setup Python ${{ matrix.python-version }}
23-
uses: actions/setup-python@v4
80+
- name: Set up Python ${{ matrix.python-version }}
81+
uses: actions/setup-python@v5
2482
with:
2583
python-version: ${{ matrix.python-version }}
2684

2785
- name: Install dependencies
28-
run: |
29-
python -m pip install --upgrade pip
30-
pip install poetry
31-
poetry check
32-
poetry install
86+
run: uv sync --all-extras
3387

34-
- name: Linting
35-
run: poetry run flake8
88+
- name: Run tests
89+
run: uv run pytest --cov=complexheart --cov-report=term-missing --cov-report=xml:coverage.xml
3690

37-
- name: Execute Unit, Integration and Acceptance Tests
38-
run: poetry run pytest
91+
- name: Upload coverage artifact
92+
if: matrix.python-version == '3.13'
93+
uses: actions/upload-artifact@v4
94+
with:
95+
name: coverage-report
96+
path: coverage.xml
3997

40-
- name: Fix coverage.xml for Sonar
41-
run: |
42-
sed -i 's@'$GITHUB_WORKSPACE'@/github/workspace/@g' coverage.xml
98+
sonarcloud:
99+
name: SonarCloud Analysis
100+
runs-on: ubuntu-latest
101+
needs: [test]
102+
103+
steps:
104+
- name: Checkout
105+
uses: actions/checkout@v4
106+
with:
107+
fetch-depth: 0
108+
109+
- name: Download coverage artifact
110+
uses: actions/download-artifact@v4
111+
with:
112+
name: coverage-report
43113

44114
- name: SonarCloud Scan
45-
uses: SonarSource/sonarcloud-github-action@master
115+
uses: SonarSource/sonarqube-scan-action@v6
46116
env:
47-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48117
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
118+
119+
ci-success:
120+
name: CI Success
121+
runs-on: ubuntu-latest
122+
needs: [lint, typecheck, test, sonarcloud]
123+
if: always()
124+
125+
steps:
126+
- name: Check all jobs
127+
run: |
128+
echo "===== Job Results ====="
129+
echo "Lint: ${{ needs.lint.result }}"
130+
echo "Typecheck: ${{ needs.typecheck.result }}"
131+
echo "Test: ${{ needs.test.result }}"
132+
echo "SonarCloud: ${{ needs.sonarcloud.result }}"
133+
echo "======================="
134+
135+
if [ "${{ needs.lint.result }}" != "success" ]; then
136+
echo "❌ Lint failed"
137+
exit 1
138+
fi
139+
140+
if [ "${{ needs.test.result }}" != "success" ]; then
141+
echo "❌ Tests failed"
142+
exit 1
143+
fi
144+
145+
if [ "${{ needs.typecheck.result }}" == "failure" ]; then
146+
echo "⚠️ Typecheck failed (non-blocking)"
147+
fi
148+
149+
if [ "${{ needs.sonarcloud.result }}" != "success" ]; then
150+
echo "❌ SonarCloud failed"
151+
exit 1
152+
fi
153+
154+
echo "✅ All required checks passed!"

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,3 +130,4 @@ dmypy.json
130130
.idea/
131131
*nogit*
132132
poetry.lock
133+
uv.lock

0 commit comments

Comments
 (0)