flexfloat 0.1.1__tar.gz → 0.1.3__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 (47) hide show
  1. flexfloat-0.1.3/.bumpversion.cfg +13 -0
  2. flexfloat-0.1.3/.github/workflows/build-check.yml +53 -0
  3. flexfloat-0.1.3/.github/workflows/manual-release.yml +137 -0
  4. flexfloat-0.1.3/.github/workflows/pr-labeler.yml +131 -0
  5. flexfloat-0.1.3/.github/workflows/release.yml +130 -0
  6. flexfloat-0.1.3/.github/workflows/test.yml +84 -0
  7. flexfloat-0.1.3/.github/workflows/version-check.yml +47 -0
  8. flexfloat-0.1.3/.gitignore +213 -0
  9. flexfloat-0.1.3/LICENSE +21 -0
  10. flexfloat-0.1.3/MANIFEST.in +19 -0
  11. flexfloat-0.1.3/PKG-INFO +340 -0
  12. flexfloat-0.1.3/README.md +306 -0
  13. flexfloat-0.1.3/flexfloat/__init__.py +32 -0
  14. flexfloat-0.1.3/flexfloat/bitarray/__init__.py +90 -0
  15. flexfloat-0.1.3/flexfloat/bitarray/bitarray.py +198 -0
  16. flexfloat-0.1.3/flexfloat/bitarray/bitarray_int64.py +308 -0
  17. flexfloat-0.1.1/flexfloat/bitarray.py → flexfloat-0.1.3/flexfloat/bitarray/bitarray_list.py +187 -257
  18. flexfloat-0.1.3/flexfloat/bitarray/bitarray_mixins.py +93 -0
  19. {flexfloat-0.1.1 → flexfloat-0.1.3}/flexfloat/core.py +1014 -728
  20. {flexfloat-0.1.1 → flexfloat-0.1.3}/flexfloat/types.py +5 -5
  21. flexfloat-0.1.3/flexfloat.egg-info/PKG-INFO +340 -0
  22. flexfloat-0.1.3/flexfloat.egg-info/SOURCES.txt +40 -0
  23. {flexfloat-0.1.1 → flexfloat-0.1.3}/flexfloat.egg-info/requires.txt +5 -0
  24. {flexfloat-0.1.1 → flexfloat-0.1.3}/pyproject.toml +79 -74
  25. flexfloat-0.1.3/scripts/validate_cicd.py +178 -0
  26. flexfloat-0.1.3/scripts/version_manager.py +209 -0
  27. {flexfloat-0.1.1 → flexfloat-0.1.3}/setup.cfg +4 -4
  28. {flexfloat-0.1.1 → flexfloat-0.1.3}/setup.py +3 -3
  29. flexfloat-0.1.3/tests/__init__.py +27 -0
  30. {flexfloat-0.1.1 → flexfloat-0.1.3}/tests/test_addition.py +252 -254
  31. {flexfloat-0.1.1 → flexfloat-0.1.3}/tests/test_bigfloat.py +149 -150
  32. {flexfloat-0.1.1 → flexfloat-0.1.3}/tests/test_bitarray.py +284 -278
  33. flexfloat-0.1.3/tests/test_bitarray_implementations.py +359 -0
  34. {flexfloat-0.1.1 → flexfloat-0.1.3}/tests/test_conversions.py +119 -119
  35. {flexfloat-0.1.1 → flexfloat-0.1.3}/tests/test_division.py +213 -217
  36. {flexfloat-0.1.1 → flexfloat-0.1.3}/tests/test_multiplication.py +267 -270
  37. flexfloat-0.1.3/tests/test_power.py +488 -0
  38. {flexfloat-0.1.1 → flexfloat-0.1.3}/tests/test_str_representation.py +280 -280
  39. {flexfloat-0.1.1 → flexfloat-0.1.3}/tests/test_subtraction.py +242 -243
  40. flexfloat-0.1.1/PKG-INFO +0 -82
  41. flexfloat-0.1.1/README.md +0 -55
  42. flexfloat-0.1.1/flexfloat/__init__.py +0 -13
  43. flexfloat-0.1.1/flexfloat.egg-info/PKG-INFO +0 -82
  44. flexfloat-0.1.1/flexfloat.egg-info/SOURCES.txt +0 -21
  45. {flexfloat-0.1.1 → flexfloat-0.1.3}/flexfloat/py.typed +0 -0
  46. {flexfloat-0.1.1 → flexfloat-0.1.3}/flexfloat.egg-info/dependency_links.txt +0 -0
  47. {flexfloat-0.1.1 → flexfloat-0.1.3}/flexfloat.egg-info/top_level.txt +0 -0
@@ -0,0 +1,13 @@
1
+ [bumpversion]
2
+ current_version = 0.1.3
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,131 @@
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
+ issues: write
14
+
15
+ steps:
16
+ - name: Checkout code
17
+ uses: actions/checkout@v4
18
+ with:
19
+ fetch-depth: 0
20
+
21
+ - name: Analyze commits for version bump
22
+ id: analyze
23
+ run: |
24
+ # Get commits in this PR
25
+ git fetch origin main
26
+ COMMITS=$(git rev-list origin/main..HEAD --oneline)
27
+
28
+ echo "Commits in PR:"
29
+ echo "$COMMITS"
30
+
31
+ # Analyze commit messages for conventional commit patterns
32
+ BUMP_TYPE="patch" # default
33
+
34
+ # Check for breaking changes or major updates
35
+ if echo "$COMMITS" | grep -iE "(BREAKING CHANGE|breaking:)" || \
36
+ echo "${{ github.event.pull_request.title }}" | grep -iE "(BREAKING|major:)" || \
37
+ echo "${{ github.event.pull_request.body }}" | grep -iE "BREAKING CHANGE"; then
38
+ BUMP_TYPE="major"
39
+ # Check for new features
40
+ elif echo "$COMMITS" | grep -iE "(feat:|feature:)" || \
41
+ echo "${{ github.event.pull_request.title }}" | grep -iE "(feat:|feature:|minor:)"; then
42
+ BUMP_TYPE="minor"
43
+ # Everything else is a patch (fix:, docs:, style:, refactor:, test:, chore:)
44
+ fi
45
+
46
+ echo "bump_type=$BUMP_TYPE" >> $GITHUB_OUTPUT
47
+ echo "Recommended version bump: $BUMP_TYPE"
48
+
49
+ - name: Add version bump label
50
+ uses: actions/github-script@v7
51
+ with:
52
+ script: |
53
+ const bumpType = '${{ steps.analyze.outputs.bump_type }}';
54
+
55
+ // Remove existing version bump labels
56
+ const existingLabels = ['major', 'minor', 'patch'];
57
+ for (const label of existingLabels) {
58
+ try {
59
+ await github.rest.issues.removeLabel({
60
+ owner: context.repo.owner,
61
+ repo: context.repo.repo,
62
+ issue_number: context.issue.number,
63
+ name: label
64
+ });
65
+ } catch (error) {
66
+ // Label might not exist, ignore
67
+ }
68
+ }
69
+
70
+ // Add the appropriate version bump label
71
+ await github.rest.issues.addLabels({
72
+ owner: context.repo.owner,
73
+ repo: context.repo.repo,
74
+ issue_number: context.issue.number,
75
+ labels: [bumpType]
76
+ });
77
+
78
+ console.log(`Added label: ${bumpType}`);
79
+
80
+ - name: Comment on PR
81
+ uses: actions/github-script@v7
82
+ with:
83
+ script: |
84
+ const bumpType = '${{ steps.analyze.outputs.bump_type }}';
85
+
86
+ const body = `**Automatic Version Bump Detection**
87
+
88
+ Based on the commit messages and PR title, this PR will trigger a **${bumpType}** version bump when merged to main.
89
+
90
+ | Bump Type | Description |
91
+ |-----------|-------------|
92
+ | patch | Bug fixes, documentation updates, code style changes |
93
+ | minor | New features, non-breaking changes |
94
+ | major | Breaking changes, major updates |
95
+
96
+ If this is incorrect, you can manually change the label on this PR:
97
+ - Add \`major\` label for breaking changes
98
+ - Add \`minor\` label for new features
99
+ - Add \`patch\` label for bug fixes
100
+
101
+ The version will be automatically updated across all files when this PR is merged.`;
102
+
103
+ // Check if we already commented
104
+ const comments = await github.rest.issues.listComments({
105
+ owner: context.repo.owner,
106
+ repo: context.repo.repo,
107
+ issue_number: context.issue.number,
108
+ });
109
+
110
+ const botComment = comments.data.find(comment =>
111
+ comment.user.type === 'Bot' &&
112
+ comment.body.includes('Automatic Version Bump Detection')
113
+ );
114
+
115
+ if (botComment) {
116
+ // Update existing comment
117
+ await github.rest.issues.updateComment({
118
+ owner: context.repo.owner,
119
+ repo: context.repo.repo,
120
+ comment_id: botComment.id,
121
+ body: body
122
+ });
123
+ } else {
124
+ // Create new comment
125
+ await github.rest.issues.createComment({
126
+ owner: context.repo.owner,
127
+ repo: context.repo.repo,
128
+ issue_number: context.issue.number,
129
+ body: body
130
+ });
131
+ }
@@ -0,0 +1,130 @@
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
+ # Bump version
73
+ bump2version ${{ steps.bump_type.outputs.bump_type }}
74
+
75
+ # Get new version
76
+ NEW_VERSION=$(grep -E '^version = ' pyproject.toml | cut -d'"' -f2)
77
+ echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
78
+ echo "New version: $NEW_VERSION"
79
+
80
+ - name: Run tests
81
+ run: |
82
+ pip install -e ".[dev]"
83
+ pytest tests/
84
+
85
+ - name: Build package
86
+ run: |
87
+ python -m build
88
+
89
+ - name: Commit version bump
90
+ run: |
91
+ git add pyproject.toml flexfloat/__init__.py
92
+ git commit -m "Bump version to ${{ steps.bump_version.outputs.new_version }} [skip ci]"
93
+ git push origin main
94
+
95
+ - name: Create Git tag
96
+ run: |
97
+ git tag -a "v${{ steps.bump_version.outputs.new_version }}" -m "Release v${{ steps.bump_version.outputs.new_version }}"
98
+ git push origin "v${{ steps.bump_version.outputs.new_version }}"
99
+
100
+ - name: Create GitHub Release
101
+ id: create_release
102
+ uses: softprops/action-gh-release@v2
103
+ with:
104
+ tag_name: "v${{ steps.bump_version.outputs.new_version }}"
105
+ name: "Release v${{ steps.bump_version.outputs.new_version }}"
106
+ body: |
107
+ ## Changes in v${{ steps.bump_version.outputs.new_version }}
108
+
109
+ This release was automatically created from PR #${{ github.event.pull_request.number }}: ${{ github.event.pull_request.title }}
110
+
111
+ ### Pull Request Details
112
+ ${{ github.event.pull_request.body }}
113
+
114
+ ### Artifacts
115
+ - **Python Wheel**: `flexfloat-${{ steps.bump_version.outputs.new_version }}-py3-none-any.whl`
116
+ - **Source Distribution**: `flexfloat-${{ steps.bump_version.outputs.new_version }}.tar.gz`
117
+
118
+ The package has been automatically published to [PyPI](https://pypi.org/project/flexfloat/${{ steps.bump_version.outputs.new_version }}/).
119
+ draft: false
120
+ prerelease: false
121
+ files: |
122
+ ./dist/flexfloat-${{ steps.bump_version.outputs.new_version }}-py3-none-any.whl
123
+ ./dist/flexfloat-${{ steps.bump_version.outputs.new_version }}.tar.gz
124
+
125
+ - name: Publish to PyPI
126
+ uses: pypa/gh-action-pypi-publish@v1.12.4
127
+ with:
128
+ # Uses trusted publishing - no API token needed
129
+ # You need to configure this in PyPI project settings
130
+ 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