flexfloat 0.1.1__tar.gz → 0.1.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. flexfloat-0.1.2/.bumpversion.cfg +13 -0
  2. flexfloat-0.1.2/.github/workflows/build-check.yml +53 -0
  3. flexfloat-0.1.2/.github/workflows/manual-release.yml +137 -0
  4. flexfloat-0.1.2/.github/workflows/pr-labeler.yml +130 -0
  5. flexfloat-0.1.2/.github/workflows/release.yml +146 -0
  6. flexfloat-0.1.2/.github/workflows/test.yml +84 -0
  7. flexfloat-0.1.2/.github/workflows/version-check.yml +47 -0
  8. flexfloat-0.1.2/.gitignore +213 -0
  9. flexfloat-0.1.2/LICENSE +21 -0
  10. flexfloat-0.1.2/MANIFEST.in +19 -0
  11. {flexfloat-0.1.1 → flexfloat-0.1.2}/PKG-INFO +147 -82
  12. flexfloat-0.1.2/README.md +113 -0
  13. {flexfloat-0.1.1 → flexfloat-0.1.2}/flexfloat/__init__.py +13 -13
  14. {flexfloat-0.1.1 → flexfloat-0.1.2}/flexfloat/bitarray.py +257 -257
  15. {flexfloat-0.1.1 → flexfloat-0.1.2}/flexfloat/core.py +728 -728
  16. {flexfloat-0.1.1 → flexfloat-0.1.2}/flexfloat/types.py +5 -5
  17. {flexfloat-0.1.1 → flexfloat-0.1.2}/flexfloat.egg-info/PKG-INFO +147 -82
  18. {flexfloat-0.1.1 → flexfloat-0.1.2}/flexfloat.egg-info/SOURCES.txt +13 -0
  19. {flexfloat-0.1.1 → flexfloat-0.1.2}/flexfloat.egg-info/requires.txt +5 -0
  20. {flexfloat-0.1.1 → flexfloat-0.1.2}/pyproject.toml +79 -74
  21. flexfloat-0.1.2/scripts/validate_cicd.py +178 -0
  22. flexfloat-0.1.2/scripts/version_manager.py +209 -0
  23. {flexfloat-0.1.1 → flexfloat-0.1.2}/setup.cfg +4 -4
  24. {flexfloat-0.1.1 → flexfloat-0.1.2}/setup.py +3 -3
  25. flexfloat-0.1.2/tests/__init__.py +7 -0
  26. {flexfloat-0.1.1 → flexfloat-0.1.2}/tests/test_addition.py +254 -254
  27. {flexfloat-0.1.1 → flexfloat-0.1.2}/tests/test_bigfloat.py +150 -150
  28. {flexfloat-0.1.1 → flexfloat-0.1.2}/tests/test_bitarray.py +278 -278
  29. {flexfloat-0.1.1 → flexfloat-0.1.2}/tests/test_conversions.py +119 -119
  30. {flexfloat-0.1.1 → flexfloat-0.1.2}/tests/test_division.py +217 -217
  31. {flexfloat-0.1.1 → flexfloat-0.1.2}/tests/test_multiplication.py +270 -270
  32. {flexfloat-0.1.1 → flexfloat-0.1.2}/tests/test_str_representation.py +280 -280
  33. {flexfloat-0.1.1 → flexfloat-0.1.2}/tests/test_subtraction.py +243 -243
  34. flexfloat-0.1.1/README.md +0 -55
  35. {flexfloat-0.1.1 → flexfloat-0.1.2}/flexfloat/py.typed +0 -0
  36. {flexfloat-0.1.1 → flexfloat-0.1.2}/flexfloat.egg-info/dependency_links.txt +0 -0
  37. {flexfloat-0.1.1 → flexfloat-0.1.2}/flexfloat.egg-info/top_level.txt +0 -0
@@ -0,0 +1,13 @@
1
+ [bumpversion]
2
+ current_version = 0.1.2
3
+ commit = False
4
+ tag = False
5
+ allow_dirty = True
6
+
7
+ [bumpversion:file:pyproject.toml]
8
+ search = version = "{current_version}"
9
+ replace = version = "{new_version}"
10
+
11
+ [bumpversion:file:flexfloat/__init__.py]
12
+ search = __version__ = "{current_version}"
13
+ replace = __version__ = "{new_version}"
@@ -0,0 +1,53 @@
1
+ name: Package Build Check
2
+
3
+ on:
4
+ push:
5
+ branches: [main, develop]
6
+ pull_request:
7
+ branches: [main, develop]
8
+
9
+ jobs:
10
+ build-check:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ matrix:
14
+ python-version: ["3.11", "3.12", "3.13"]
15
+
16
+ steps:
17
+ - name: Checkout code
18
+ uses: actions/checkout@v4
19
+
20
+ - name: Set up Python ${{ matrix.python-version }}
21
+ uses: actions/setup-python@v5
22
+ with:
23
+ python-version: ${{ matrix.python-version }}
24
+
25
+ - name: Install build tools
26
+ run: |
27
+ python -m pip install --upgrade pip
28
+ pip install build twine check-manifest
29
+
30
+ - name: Check manifest
31
+ run: |
32
+ check-manifest
33
+
34
+ - name: Build package
35
+ run: |
36
+ python -m build
37
+
38
+ - name: Check package
39
+ run: |
40
+ twine check dist/*
41
+
42
+ - name: Test installation
43
+ run: |
44
+ pip install dist/*.whl
45
+ python -c "import flexfloat; print(f'FlexFloat version: {flexfloat.__version__}')"
46
+
47
+ - name: Upload build artifacts
48
+ uses: actions/upload-artifact@v4
49
+ if: matrix.python-version == '3.11'
50
+ with:
51
+ name: package-artifacts
52
+ path: dist/
53
+ retention-days: 7
@@ -0,0 +1,137 @@
1
+ name: Manual Release
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ inputs:
6
+ version_bump:
7
+ description: "Version bump type"
8
+ required: true
9
+ default: "patch"
10
+ type: choice
11
+ options:
12
+ - patch
13
+ - minor
14
+ - major
15
+ custom_version:
16
+ description: "Custom version (optional, overrides version bump)"
17
+ required: false
18
+ type: string
19
+ release_notes:
20
+ description: "Release notes (optional)"
21
+ required: false
22
+ type: string
23
+
24
+ jobs:
25
+ manual-release:
26
+ runs-on: ubuntu-latest
27
+ permissions:
28
+ contents: write
29
+ id-token: write # For trusted publishing to PyPI
30
+
31
+ steps:
32
+ - name: Checkout code
33
+ uses: actions/checkout@v4
34
+ with:
35
+ fetch-depth: 0
36
+ token: ${{ secrets.GITHUB_TOKEN }}
37
+
38
+ - name: Set up Python
39
+ uses: actions/setup-python@v5
40
+ with:
41
+ python-version: "3.11"
42
+
43
+ - name: Install dependencies
44
+ run: |
45
+ python -m pip install --upgrade pip
46
+ pip install build twine bump2version
47
+
48
+ - name: Configure Git
49
+ run: |
50
+ git config --local user.email "action@github.com"
51
+ git config --local user.name "GitHub Action"
52
+
53
+ - name: Get current version
54
+ id: current_version
55
+ run: |
56
+ VERSION=$(grep -E '^version = ' pyproject.toml | cut -d'"' -f2)
57
+ echo "version=$VERSION" >> $GITHUB_OUTPUT
58
+ echo "Current version: $VERSION"
59
+
60
+ - name: Set new version
61
+ id: set_new_version
62
+ run: |
63
+ if [ -n "${{ github.event.inputs.custom_version }}" ]; then
64
+ echo "new_version=${{ github.event.inputs.custom_version }}" >> $GITHUB_OUTPUT
65
+ echo "Using custom version: ${{ github.event.inputs.custom_version }}"
66
+ else
67
+ echo "new_version=" >> $GITHUB_OUTPUT
68
+ fi
69
+
70
+ - name: Bump or set version
71
+ id: bump_version
72
+ run: |
73
+ # Update current version in .bumpversion.cfg
74
+ # sed -i "s/current_version = .*/current_version = ${{ steps.current_version.outputs.version }}/" .bumpversion.cfg
75
+
76
+ if [ -n "${{ steps.set_new_version.outputs.new_version }}" ]; then
77
+ # Set version directly
78
+ bump2version --new-version ${{ steps.set_new_version.outputs.new_version }} patch
79
+ else
80
+ # Bump version as per input
81
+ bump2version ${{ github.event.inputs.version_bump }}
82
+ fi
83
+
84
+ # Get new version
85
+ NEW_VERSION=$(grep -E '^version = ' pyproject.toml | cut -d'"' -f2)
86
+ echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
87
+ echo "New version: $NEW_VERSION"
88
+
89
+ - name: Run tests
90
+ run: |
91
+ pip install -e ".[dev]"
92
+ pytest tests/
93
+
94
+ - name: Build package
95
+ run: |
96
+ python -m build
97
+
98
+ - name: Commit version bump
99
+ run: |
100
+ git add pyproject.toml flexfloat/__init__.py
101
+ git commit -m "Bump version to ${{ steps.bump_version.outputs.new_version }} [skip ci]"
102
+ git push origin main
103
+
104
+ - name: Create Git tag
105
+ run: |
106
+ git tag -a "v${{ steps.bump_version.outputs.new_version }}" -m "Release v${{ steps.bump_version.outputs.new_version }}"
107
+ git push origin "v${{ steps.bump_version.outputs.new_version }}"
108
+
109
+ - name: Create GitHub Release
110
+ id: create_release
111
+ uses: softprops/action-gh-release@v2
112
+ with:
113
+ tag_name: "v${{ steps.bump_version.outputs.new_version }}"
114
+ name: "Release v${{ steps.bump_version.outputs.new_version }}"
115
+ body: |
116
+ ## Changes in v${{ steps.bump_version.outputs.new_version }}
117
+
118
+ This is a manual release triggered by: ${{ github.actor }}
119
+
120
+ ### Release Notes
121
+ ${{ github.event.inputs.release_notes || 'No release notes provided.' }}
122
+
123
+ ### Artifacts
124
+ - **Python Wheel**: `flexfloat-${{ steps.bump_version.outputs.new_version }}-py3-none-any.whl`
125
+ - **Source Distribution**: `flexfloat-${{ steps.bump_version.outputs.new_version }}.tar.gz`
126
+
127
+ The package has been automatically published to [PyPI](https://pypi.org/project/flexfloat/${{ steps.bump_version.outputs.new_version }}/).
128
+ draft: false
129
+ prerelease: false
130
+ files: |
131
+ ./dist/flexfloat-${{ steps.bump_version.outputs.new_version }}-py3-none-any.whl
132
+ ./dist/flexfloat-${{ steps.bump_version.outputs.new_version }}.tar.gz
133
+
134
+ - name: Publish to PyPI
135
+ uses: pypa/gh-action-pypi-publish@v1.12.4
136
+ with:
137
+ verbose: true
@@ -0,0 +1,130 @@
1
+ name: PR Labeler
2
+
3
+ on:
4
+ pull_request:
5
+ types: [opened, edited, synchronize]
6
+
7
+ jobs:
8
+ label-pr:
9
+ runs-on: ubuntu-latest
10
+ permissions:
11
+ pull-requests: write
12
+ contents: read
13
+
14
+ steps:
15
+ - name: Checkout code
16
+ uses: actions/checkout@v4
17
+ with:
18
+ fetch-depth: 0
19
+
20
+ - name: Analyze commits for version bump
21
+ id: analyze
22
+ run: |
23
+ # Get commits in this PR
24
+ git fetch origin main
25
+ COMMITS=$(git rev-list origin/main..HEAD --oneline)
26
+
27
+ echo "Commits in PR:"
28
+ echo "$COMMITS"
29
+
30
+ # Analyze commit messages for conventional commit patterns
31
+ BUMP_TYPE="patch" # default
32
+
33
+ # Check for breaking changes or major updates
34
+ if echo "$COMMITS" | grep -iE "(BREAKING CHANGE|breaking:)" || \
35
+ echo "${{ github.event.pull_request.title }}" | grep -iE "(BREAKING|major:)" || \
36
+ echo "${{ github.event.pull_request.body }}" | grep -iE "BREAKING CHANGE"; then
37
+ BUMP_TYPE="major"
38
+ # Check for new features
39
+ elif echo "$COMMITS" | grep -iE "(feat:|feature:)" || \
40
+ echo "${{ github.event.pull_request.title }}" | grep -iE "(feat:|feature:|minor:)"; then
41
+ BUMP_TYPE="minor"
42
+ # Everything else is a patch (fix:, docs:, style:, refactor:, test:, chore:)
43
+ fi
44
+
45
+ echo "bump_type=$BUMP_TYPE" >> $GITHUB_OUTPUT
46
+ echo "Recommended version bump: $BUMP_TYPE"
47
+
48
+ - name: Add version bump label
49
+ uses: actions/github-script@v7
50
+ with:
51
+ script: |
52
+ const bumpType = '${{ steps.analyze.outputs.bump_type }}';
53
+
54
+ // Remove existing version bump labels
55
+ const existingLabels = ['major', 'minor', 'patch'];
56
+ for (const label of existingLabels) {
57
+ try {
58
+ await github.rest.issues.removeLabel({
59
+ owner: context.repo.owner,
60
+ repo: context.repo.repo,
61
+ issue_number: context.issue.number,
62
+ name: label
63
+ });
64
+ } catch (error) {
65
+ // Label might not exist, ignore
66
+ }
67
+ }
68
+
69
+ // Add the appropriate version bump label
70
+ await github.rest.issues.addLabels({
71
+ owner: context.repo.owner,
72
+ repo: context.repo.repo,
73
+ issue_number: context.issue.number,
74
+ labels: [bumpType]
75
+ });
76
+
77
+ console.log(`Added label: ${bumpType}`);
78
+
79
+ - name: Comment on PR
80
+ uses: actions/github-script@v7
81
+ with:
82
+ script: |
83
+ const bumpType = '${{ steps.analyze.outputs.bump_type }}';
84
+
85
+ const body = `**Automatic Version Bump Detection**
86
+
87
+ Based on the commit messages and PR title, this PR will trigger a **${bumpType}** version bump when merged to main.
88
+
89
+ | Bump Type | Description |
90
+ |-----------|-------------|
91
+ | patch | Bug fixes, documentation updates, code style changes |
92
+ | minor | New features, non-breaking changes |
93
+ | major | Breaking changes, major updates |
94
+
95
+ If this is incorrect, you can manually change the label on this PR:
96
+ - Add \`major\` label for breaking changes
97
+ - Add \`minor\` label for new features
98
+ - Add \`patch\` label for bug fixes
99
+
100
+ The version will be automatically updated across all files when this PR is merged.`;
101
+
102
+ // Check if we already commented
103
+ const comments = await github.rest.issues.listComments({
104
+ owner: context.repo.owner,
105
+ repo: context.repo.repo,
106
+ issue_number: context.issue.number,
107
+ });
108
+
109
+ const botComment = comments.data.find(comment =>
110
+ comment.user.type === 'Bot' &&
111
+ comment.body.includes('Automatic Version Bump Detection')
112
+ );
113
+
114
+ if (botComment) {
115
+ // Update existing comment
116
+ await github.rest.issues.updateComment({
117
+ owner: context.repo.owner,
118
+ repo: context.repo.repo,
119
+ comment_id: botComment.id,
120
+ body: body
121
+ });
122
+ } else {
123
+ // Create new comment
124
+ await github.rest.issues.createComment({
125
+ owner: context.repo.owner,
126
+ repo: context.repo.repo,
127
+ issue_number: context.issue.number,
128
+ body: body
129
+ });
130
+ }
@@ -0,0 +1,146 @@
1
+ name: Release
2
+
3
+ on:
4
+ pull_request:
5
+ types: [closed]
6
+ branches: [main]
7
+
8
+ jobs:
9
+ release:
10
+ # Only run if the PR was merged (not just closed)
11
+ if: github.event.pull_request.merged == true
12
+ runs-on: ubuntu-latest
13
+ permissions:
14
+ contents: write
15
+ id-token: write # For trusted publishing to PyPI
16
+
17
+ steps:
18
+ - name: Checkout code
19
+ uses: actions/checkout@v4
20
+ with:
21
+ fetch-depth: 0
22
+ token: ${{ secrets.GITHUB_TOKEN }}
23
+
24
+ - name: Set up Python
25
+ uses: actions/setup-python@v5
26
+ with:
27
+ python-version: "3.11"
28
+
29
+ - name: Install dependencies
30
+ run: |
31
+ python -m pip install --upgrade pip
32
+ pip install build twine bump2version
33
+
34
+ - name: Configure Git
35
+ run: |
36
+ git config --local user.email "action@github.com"
37
+ git config --local user.name "GitHub Action"
38
+
39
+ - name: Get current version
40
+ id: current_version
41
+ run: |
42
+ # Extract version from pyproject.toml
43
+ VERSION=$(grep -E '^version = ' pyproject.toml | cut -d'"' -f2)
44
+ echo "version=$VERSION" >> $GITHUB_OUTPUT
45
+ echo "Current version: $VERSION"
46
+
47
+ - name: Determine version bump type
48
+ id: bump_type
49
+ run: |
50
+ # Check PR labels to determine bump type
51
+ # Default to patch if no labels found
52
+ BUMP_TYPE="patch"
53
+
54
+ # Check for version bump labels in PR
55
+ if echo "${{ github.event.pull_request.labels.*.name }}" | grep -q "major"; then
56
+ BUMP_TYPE="major"
57
+ elif echo "${{ github.event.pull_request.labels.*.name }}" | grep -q "minor"; then
58
+ BUMP_TYPE="minor"
59
+ elif echo "${{ github.event.pull_request.labels.*.name }}" | grep -q "patch"; then
60
+ BUMP_TYPE="patch"
61
+ fi
62
+
63
+ echo "bump_type=$BUMP_TYPE" >> $GITHUB_OUTPUT
64
+ echo "Version bump type: $BUMP_TYPE"
65
+
66
+ - name: Bump version
67
+ id: bump_version
68
+ run: |
69
+ # Install bump2version if not already installed
70
+ pip install bump2version
71
+
72
+ # Create .bumpversion.cfg
73
+ cat > .bumpversion.cfg << EOF
74
+ [bumpversion]
75
+ current_version = ${{ steps.current_version.outputs.version }}
76
+ commit = False
77
+ tag = False
78
+
79
+ [bumpversion:file:pyproject.toml]
80
+ search = version = "{current_version}"
81
+ replace = version = "{new_version}"
82
+
83
+ [bumpversion:file:flexfloat/__init__.py]
84
+ search = __version__ = "{current_version}"
85
+ replace = __version__ = "{new_version}"
86
+ EOF
87
+
88
+ # Bump version
89
+ bump2version ${{ steps.bump_type.outputs.bump_type }}
90
+
91
+ # Get new version
92
+ NEW_VERSION=$(grep -E '^version = ' pyproject.toml | cut -d'"' -f2)
93
+ echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
94
+ echo "New version: $NEW_VERSION"
95
+
96
+ - name: Run tests
97
+ run: |
98
+ pip install -e ".[dev]"
99
+ pytest tests/
100
+
101
+ - name: Build package
102
+ run: |
103
+ python -m build
104
+
105
+ - name: Commit version bump
106
+ run: |
107
+ git add pyproject.toml flexfloat/__init__.py
108
+ git commit -m "Bump version to ${{ steps.bump_version.outputs.new_version }} [skip ci]"
109
+ git push origin main
110
+
111
+ - name: Create Git tag
112
+ run: |
113
+ git tag -a "v${{ steps.bump_version.outputs.new_version }}" -m "Release v${{ steps.bump_version.outputs.new_version }}"
114
+ git push origin "v${{ steps.bump_version.outputs.new_version }}"
115
+
116
+ - name: Create GitHub Release
117
+ id: create_release
118
+ uses: softprops/action-gh-release@v2
119
+ with:
120
+ tag_name: "v${{ steps.bump_version.outputs.new_version }}"
121
+ name: "Release v${{ steps.bump_version.outputs.new_version }}"
122
+ body: |
123
+ ## Changes in v${{ steps.bump_version.outputs.new_version }}
124
+
125
+ This release was automatically created from PR #${{ github.event.pull_request.number }}: ${{ github.event.pull_request.title }}
126
+
127
+ ### Pull Request Details
128
+ ${{ github.event.pull_request.body }}
129
+
130
+ ### Artifacts
131
+ - **Python Wheel**: `flexfloat-${{ steps.bump_version.outputs.new_version }}-py3-none-any.whl`
132
+ - **Source Distribution**: `flexfloat-${{ steps.bump_version.outputs.new_version }}.tar.gz`
133
+
134
+ The package has been automatically published to [PyPI](https://pypi.org/project/flexfloat/${{ steps.bump_version.outputs.new_version }}/).
135
+ draft: false
136
+ prerelease: false
137
+ files: |
138
+ ./dist/flexfloat-${{ steps.bump_version.outputs.new_version }}-py3-none-any.whl
139
+ ./dist/flexfloat-${{ steps.bump_version.outputs.new_version }}.tar.gz
140
+
141
+ - name: Publish to PyPI
142
+ uses: pypa/gh-action-pypi-publish@v1.12.4
143
+ with:
144
+ # Uses trusted publishing - no API token needed
145
+ # You need to configure this in PyPI project settings
146
+ verbose: true
@@ -0,0 +1,84 @@
1
+ name: Tests
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ matrix:
14
+ python-version: ["3.11", "3.12", "3.13"]
15
+
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+
19
+ - name: Set up Python ${{ matrix.python-version }}
20
+ uses: actions/setup-python@v5
21
+ with:
22
+ python-version: ${{ matrix.python-version }}
23
+
24
+ - name: Install dependencies
25
+ run: |
26
+ python -m pip install --upgrade pip
27
+ pip install -e ".[dev]"
28
+
29
+ - name: Lint with flake8
30
+ run: |
31
+ # stop the build if there are Python syntax errors or undefined names
32
+ flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
33
+ # exit-zero treats all errors as warnings
34
+ flake8 . --count --exit-zero
35
+
36
+ - name: Check code formatting with black
37
+ run: |
38
+ black --check --diff .
39
+
40
+ - name: Check import sorting with isort
41
+ run: |
42
+ isort --check-only --diff .
43
+
44
+ - name: Type checking with mypy
45
+ run: |
46
+ mypy flexfloat/
47
+
48
+ - name: Lint with pylint
49
+ run: |
50
+ pylint flexfloat/ --fail-under=9
51
+
52
+ - name: Test with pytest
53
+ run: |
54
+ pytest tests/
55
+
56
+ coverage:
57
+ runs-on: ubuntu-latest
58
+ needs: test
59
+
60
+ steps:
61
+ - uses: actions/checkout@v4
62
+
63
+ - name: Set up Python 3.11
64
+ uses: actions/setup-python@v5
65
+ with:
66
+ python-version: "3.11"
67
+
68
+ - name: Install dependencies
69
+ run: |
70
+ python -m pip install --upgrade pip
71
+ pip install -e ".[dev]"
72
+
73
+ - name: Test with pytest and generate coverage
74
+ run: |
75
+ pytest tests/ --cov=flexfloat --cov-report=xml --cov-report=term-missing
76
+
77
+ - name: Upload coverage to Codecov
78
+ uses: codecov/codecov-action@v5
79
+ with:
80
+ files: ./coverage.xml
81
+ flags: unittests
82
+ name: codecov-umbrella
83
+ fail_ci_if_error: false
84
+ token: ${{ secrets.CODECOV_TOKEN }}
@@ -0,0 +1,47 @@
1
+ name: Version Check
2
+
3
+ on:
4
+ push:
5
+ branches: [main, develop]
6
+ pull_request:
7
+ branches: [main, develop]
8
+
9
+ jobs:
10
+ version-check:
11
+ runs-on: ubuntu-latest
12
+
13
+ steps:
14
+ - name: Checkout code
15
+ uses: actions/checkout@v4
16
+
17
+ - name: Check version consistency
18
+ run: |
19
+ # Extract versions from different files
20
+ PYPROJECT_VERSION=$(grep -E '^version = ' pyproject.toml | cut -d'"' -f2)
21
+ INIT_VERSION=$(grep -E '^__version__ = ' flexfloat/__init__.py | cut -d'"' -f2)
22
+
23
+ echo "pyproject.toml version: $PYPROJECT_VERSION"
24
+ echo "flexfloat/__init__.py version: $INIT_VERSION"
25
+
26
+ # Check if versions match
27
+ if [ "$PYPROJECT_VERSION" != "$INIT_VERSION" ]; then
28
+ echo "[NO] Version mismatch detected!"
29
+ echo "pyproject.toml has version $PYPROJECT_VERSION"
30
+ echo "flexfloat/__init__.py has version $INIT_VERSION"
31
+ echo "Please ensure all version references are synchronized."
32
+ exit 1
33
+ else
34
+ echo "[OK] All versions are synchronized: $PYPROJECT_VERSION"
35
+ fi
36
+
37
+ - name: Validate version format
38
+ run: |
39
+ VERSION=$(grep -E '^version = ' pyproject.toml | cut -d'"' -f2)
40
+
41
+ # Check if version follows semantic versioning (X.Y.Z)
42
+ if [[ ! $VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
43
+ echo "[NO] Version $VERSION does not follow semantic versioning format (X.Y.Z)"
44
+ exit 1
45
+ else
46
+ echo "[OK] Version format is valid: $VERSION"
47
+ fi