Skip to content

Commit 2762bd7

Browse files
author
github-actions
committed
feat: integrate abstract-validation-base library
- Add abstract-validation-base as dependency for validation infrastructure - Replace local validation classes with library imports (BaseValidator, CompositeValidator, ValidatorProtocol, ValidationResult, ProcessLog, ProcessEntry) - Delete redundant local files: core/validation/*.py, core/process_log.py, core/results.py - Add new composable validators: Zip5FormatValidator, Zip4FormatValidator - Update create_default_validators to use ValidatorPipelineBuilder - Update Python requirement to >=3.12.8 (required by abstract-validation-base) - Update all workflows to Python 3.12, tests run on 3.12/3.13 only - Add version-check.yml workflow for automatic tag creation - Update release.yml with version bump support (patch/minor/major/alpha/beta/rc) - Simplify Codecov integration to match abstract-validation-base pattern - Fix ruff linting issues (use Python 3.12+ type parameter syntax)
1 parent a7a1df4 commit 2762bd7

27 files changed

Lines changed: 1532 additions & 1444 deletions

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
cache-dependency-glob: "pyproject.toml"
2525

2626
- name: Set up Python
27-
run: uv python install 3.9
27+
run: uv python install 3.12
2828

2929
- name: Install dependencies
3030
run: uv sync --group dev

.github/workflows/release.yml

Lines changed: 78 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,105 @@
11
name: Release
22

33
on:
4-
push:
5-
tags:
6-
- "v*"
74
workflow_dispatch:
5+
inputs:
6+
bump:
7+
description: 'Version bump type'
8+
required: true
9+
default: 'patch'
10+
type: choice
11+
options:
12+
- patch
13+
- minor
14+
- major
15+
- alpha
16+
- beta
17+
- rc
18+
prerelease:
19+
description: 'Mark as pre-release'
20+
required: false
21+
default: false
22+
type: boolean
823

924
permissions:
1025
contents: write
11-
packages: write
1226

1327
jobs:
1428
release:
15-
name: Create Release
1629
runs-on: ubuntu-latest
1730
steps:
1831
- uses: actions/checkout@v4
1932
with:
2033
fetch-depth: 0
34+
token: ${{ secrets.GITHUB_TOKEN }}
2135

2236
- name: Install uv
2337
uses: astral-sh/setup-uv@v4
2438
with:
2539
version: "latest"
26-
enable-cache: true
27-
cache-dependency-glob: "pyproject.toml"
2840

2941
- name: Set up Python
30-
run: uv python install 3.9
42+
run: uv python install 3.12
3143

32-
- name: Install dependencies
33-
run: uv sync --group dev
44+
- name: Configure git
45+
run: |
46+
git config user.name "github-actions[bot]"
47+
git config user.email "github-actions[bot]@users.noreply.github.com"
3448
35-
- name: Run tests
36-
run: uv run pytest tests/ -v --tb=short
49+
- name: Bump version with uv
50+
id: bump
51+
run: |
52+
BUMP_TYPE="${{ inputs.bump }}"
3753
38-
- name: Build distribution packages
39-
run: uv pip install build && uv run python -m build
54+
# For alpha/beta/rc, we need to bump minor first if not already a prerelease
55+
if [[ "$BUMP_TYPE" =~ ^(alpha|beta|rc)$ ]]; then
56+
CURRENT_VERSION=$(uv version --short)
57+
if [[ ! "$CURRENT_VERSION" =~ (a|b|rc)[0-9]+ ]]; then
58+
# Not a prerelease, bump minor first
59+
uv version --bump minor
60+
fi
61+
uv version --bump "$BUMP_TYPE"
62+
else
63+
uv version --bump "$BUMP_TYPE"
64+
fi
4065
41-
- name: Publish GitHub release from tag
42-
env:
43-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
66+
# Get the new version
67+
NEW_VERSION=$(uv version --short)
68+
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
69+
echo "New version: $NEW_VERSION"
70+
71+
# Check if it's a prerelease version
72+
if [[ "$NEW_VERSION" =~ (a|b|rc)[0-9]+ ]]; then
73+
echo "is_prerelease=true" >> $GITHUB_OUTPUT
74+
else
75+
echo "is_prerelease=${{ inputs.prerelease }}" >> $GITHUB_OUTPUT
76+
fi
77+
78+
- name: Sync version to __init__.py
79+
run: |
80+
VERSION="${{ steps.bump.outputs.new_version }}"
81+
sed -i "s/__version__ = \".*\"/__version__ = \"$VERSION\"/" src/ryandata_address_utils/__init__.py
82+
echo "Updated __init__.py to version $VERSION"
83+
cat src/ryandata_address_utils/__init__.py | grep __version__
84+
85+
- name: Commit version bump
86+
run: |
87+
VERSION="${{ steps.bump.outputs.new_version }}"
88+
git add pyproject.toml uv.lock src/ryandata_address_utils/__init__.py
89+
git commit -m "chore: bump version to $VERSION"
90+
91+
- name: Create and push tag
4492
run: |
45-
TAG_NAME="${GITHUB_REF##*/}"
46-
gh release create "$TAG_NAME" dist/*.whl dist/*.tar.gz --generate-notes --latest --verify-tag
93+
VERSION="${{ steps.bump.outputs.new_version }}"
94+
git tag -a "v$VERSION" -m "Release v$VERSION"
95+
git push origin main --follow-tags
96+
97+
- name: Create GitHub Release
98+
uses: softprops/action-gh-release@v2
99+
with:
100+
tag_name: v${{ steps.bump.outputs.new_version }}
101+
name: Release v${{ steps.bump.outputs.new_version }}
102+
generate_release_notes: true
103+
prerelease: ${{ steps.bump.outputs.is_prerelease == 'true' }}
104+
env:
105+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/tests.yml

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,30 @@ name: Tests
22

33
on:
44
push:
5-
branches: [main]
5+
branches: [main, master]
66
pull_request:
7-
branches: [main]
8-
9-
permissions:
10-
contents: read
11-
pull-requests: write
7+
branches: [main, master]
128

139
jobs:
1410
test:
15-
name: Pytest - Python ${{ matrix.python-version }}
11+
name: Run tests - Python ${{ matrix.python-version }}
1612
runs-on: ubuntu-latest
1713
strategy:
1814
matrix:
19-
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
15+
python-version: ["3.12", "3.13"]
16+
2017
steps:
21-
- uses: actions/checkout@v4
18+
- name: Checkout
19+
uses: actions/checkout@v4
20+
with:
21+
fetch-depth: 2
2222

2323
- name: Install uv
2424
uses: astral-sh/setup-uv@v4
2525
with:
2626
version: "latest"
27-
enable-cache: true
28-
cache-dependency-glob: "pyproject.toml"
2927

30-
- name: Set up Python
28+
- name: Set up Python ${{ matrix.python-version }}
3129
run: uv python install ${{ matrix.python-version }}
3230

3331
- name: Cache libpostal
@@ -52,26 +50,22 @@ jobs:
5250
5351
- name: Setup libpostal environment
5452
run: |
55-
# Export paths so subsequent steps can find libpostal
5653
echo "LIBPOSTAL_DATA_DIR=$HOME/.local/share/libpostal" >> "$GITHUB_ENV"
5754
echo "LD_LIBRARY_PATH=$HOME/.local/lib:${LD_LIBRARY_PATH:-}" >> "$GITHUB_ENV"
5855
echo "PKG_CONFIG_PATH=$HOME/.local/lib/pkgconfig:${PKG_CONFIG_PATH:-}" >> "$GITHUB_ENV"
5956
echo "CPATH=$HOME/.local/include:${CPATH:-}" >> "$GITHUB_ENV"
6057
6158
- name: Install dependencies
62-
run: uv sync --group dev --all-extras
59+
run: uv sync --all-extras --dev
6360

64-
- name: Run tests
65-
run: uv run pytest tests/ --cov --junitxml=junit.xml -o junit_family=legacy --cov=src/ryandata_address_utils --cov-report=xml --cov-report=term
61+
- name: Test with pytest
62+
run: |
63+
uv run pytest --cov --cov-report=xml --junitxml=junit.xml
6664
6765
- name: Upload coverage to Codecov
6866
uses: codecov/codecov-action@v5
6967
with:
7068
token: ${{ secrets.CODECOV_TOKEN }}
71-
file: ./coverage.xml
72-
flags: unittests
73-
name: codecov-umbrella
74-
fail_ci_if_error: false
7569

7670
- name: Upload test results to Codecov
7771
if: ${{ !cancelled() }}

.github/workflows/typecheck.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
cache-dependency-glob: "pyproject.toml"
2525

2626
- name: Set up Python
27-
run: uv python install 3.9
27+
run: uv python install 3.12
2828

2929
- name: Install dependencies
3030
run: uv sync --group dev

.github/workflows/version-bump.yml

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

0 commit comments

Comments
 (0)