Skip to content

Merge pull request #10 from seanpedrick-case/dev #34

Merge pull request #10 from seanpedrick-case/dev

Merge pull request #10 from seanpedrick-case/dev #34

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
permissions:
contents: read
actions: read
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Install lint tools
run: |
python -m pip install --upgrade pip
pip install ruff black
- name: Ruff
run: ruff check app.py fuzzy_address_matcher/gradio_app.py .github/scripts/setup_test_data.py test/test_data_fixtures.py test/test_extract_street_name.py test/test_fuzzy_address_match_fixtures.py test/test_smoke_match.py test/test_app_entrypoints.py test/test_integration_match.py
- name: Black
run: black --check app.py fuzzy_address_matcher/gradio_app.py .github/scripts/setup_test_data.py test/test_data_fixtures.py test/test_extract_street_name.py test/test_fuzzy_address_match_fixtures.py test/test_smoke_match.py test/test_app_entrypoints.py test/test_integration_match.py
test-unit:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12", "3.13"]
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip
uses: actions/cache@v5
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('requirements.txt', 'pyproject.toml') }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -e ".[test]"
- name: Prepare fixture data
run: python .github/scripts/setup_test_data.py
- name: Run unit and smoke tests
run: pytest -m "not integration" --junitxml=test-results.xml --cov=fuzzy_address_matcher --cov-report=xml --cov-report=html --cov-report=term
- name: Upload test artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results-python-${{ matrix.python-version }}
path: |
test-results.xml
coverage.xml
htmlcov/
test-integration:
needs: [lint, test-unit]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -e ".[test]"
- name: Prepare fixture data
run: python .github/scripts/setup_test_data.py
- name: Run integration tests
run: pytest -m integration -v --tb=short
security:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Install security tools
run: |
python -m pip install --upgrade pip
pip install bandit
- name: Run Bandit
run: bandit -r . -f json -o bandit-report.json || true
- name: Upload security report
if: always()
uses: actions/upload-artifact@v4
with:
name: security-report
path: bandit-report.json
build:
needs: [lint, test-unit]
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Set up Python
uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Build package
run: |
python -m pip install --upgrade pip
pip install build twine
python -m build
twine check dist/*