chore: Add type annotations to test_batch_find_matches_backward_compatibility() and test_n_jobs_parameter()
#62
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: PR to Dev CI | |
| on: | |
| pull_request: | |
| types: [opened, synchronize, reopened, labeled, unlabeled] | |
| branches: [dev] | |
| jobs: | |
| test: | |
| # run only when PR has 'under-review' label (maintainer-controlled CI to save resources) | |
| if: github.event.pull_request.head.ref != 'dev' && !github.event.pull_request.draft && contains(github.event.pull_request.labels.*.name, 'under-review') | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ['3.9', '3.11', '3.12'] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Cache pip dependencies | |
| uses: actions/cache@v3 | |
| with: | |
| path: ~/.cache/pip | |
| key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('**/requirements.txt') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pip-${{ matrix.python-version }}- | |
| ${{ runner.os }}-pip- | |
| - name: Install core dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| pip install -e . | |
| - name: Install test dependencies | |
| run: | | |
| pip install -e ".[test]" | |
| - name: Run tests | |
| run: | | |
| pytest tests/ -v --tb=short | |
| - name: Basic lint check | |
| run: | | |
| python -m py_compile src/company_name_matcher/*.py | |
| python -m py_compile tests/*.py | |
| lint: | |
| # run only when PR has 'under-review' label (maintainer-controlled CI to save resources) | |
| if: github.event.pull_request.head.ref != 'dev' && !github.event.pull_request.draft && contains(github.event.pull_request.labels.*.name, 'under-review') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.11' | |
| - name: Install linting dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install black flake8 bandit | |
| - name: Check code formatting with Black | |
| run: | | |
| black --check --diff src/ tests/ --config pyproject.toml | |
| - name: Run basic linting | |
| run: | | |
| flake8 src/ tests/ --count --select=E9,F63,F7,F82 --show-source --statistics | |
| flake8 src/ tests/ --count --exit-zero --statistics | |
| - name: Run security check | |
| run: | | |
| bandit -r src/ -c .bandit | |
| validate-data: | |
| # run only when PR has 'under-review' label and contains data changes | |
| if: github.event.pull_request.head.ref != 'dev' && !github.event.pull_request.draft && contains(github.event.pull_request.labels.*.name, 'under-review') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| # fetch full history for duplicate checking ... | |
| fetch-depth: 0 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.9' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install polars | |
| - name: Validate data files | |
| id: validate | |
| run: | | |
| # Get list of changed parquet files | |
| CHANGED_FILES=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }} -- 'data/**/*.parquet' | tr '\n' ' ') | |
| if [ -z "$CHANGED_FILES" ]; then | |
| echo "No parquet files changed in this PR" | |
| exit 0 | |
| fi | |
| echo "Validating changed parquet files: $CHANGED_FILES" | |
| # Run validation and capture output | |
| python scripts/validate_data.py 2>&1 | tee validation_output.txt | |
| # Store the output in a GitHub Actions output variable | |
| { | |
| echo "result<<EOF" | |
| cat validation_output.txt | |
| echo "EOF" | |
| } >> "$GITHUB_OUTPUT" | |
| - name: Comment on PR | |
| if: failure() | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const output = `${{ steps.validate.outputs.result }}`.slice(0, 60000); // trim just in case | |
| github.rest.issues.createComment({ | |
| issue_number: context.issue.number, | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| body: | |
| '❌ **Data Validation Failed**\n\n' + | |
| 'Your parquet data contribution has validation errors.\n\n' + | |
| '### Validation Output\n' + | |
| '```\n' + output + '\n```\n' + | |
| '### Fix checklist\n' + | |
| '- Check for duplicate entries\n' + | |
| '- Ensure proper parquet formatting and UTF-8 encoding\n' + | |
| '- Verify country codes are valid\n' + | |
| '- Confirm business logic (canonical_name ≠ variation for positive data)\n\n' + | |
| 'You can run validation locally: `python scripts/validate_data.py`' | |
| }); | |