Add Search Console verification (#28) #62
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: Data quality | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - main | |
| - "agent/**" | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| python-quality: | |
| name: Python quality | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Set up Python | |
| uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 | |
| with: | |
| python-version: "3.12" | |
| cache: pip | |
| cache-dependency-path: | | |
| requirements.txt | |
| requirements-dev.txt | |
| - name: Install runtime and quality dependencies | |
| run: python -m pip install -r requirements.txt -r requirements-dev.txt | |
| - name: Lint Python sources and tests | |
| run: ruff check scripts tests | |
| - name: Type-check all maintained Python scripts | |
| run: mypy | |
| - name: Enforce maintained-script test coverage | |
| run: | | |
| coverage run -m unittest discover -s tests | |
| coverage run --append scripts/build_dataset.py | |
| coverage run --append scripts/build_pages.py | |
| coverage run --append scripts/build_release.py | |
| coverage run --append scripts/validate_release.py | |
| coverage run --append scripts/build_geography.py --check | |
| coverage report | |
| coverage xml | |
| python-compatibility: | |
| name: Python ${{ matrix.python-version }} | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.11", "3.12", "3.13"] | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Set up Python | |
| uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: pip | |
| - name: Install pipeline dependency | |
| run: python -m pip install -r requirements.txt | |
| - name: Validate dataset | |
| run: python scripts/validate_dataset.py | |
| - name: Run Python test suite | |
| run: python -m unittest discover -s tests -v | |
| data-quality: | |
| name: Data quality gate | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 15 | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | |
| - name: Set up Python | |
| uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0 | |
| with: | |
| python-version: "3.12" | |
| cache: pip | |
| - name: Install pipeline dependency | |
| run: python -m pip install -r requirements.txt | |
| - name: Validate committed data and quality contracts | |
| run: python scripts/validate_dataset.py | |
| - name: Verify declared source snapshots and checksums | |
| run: >- | |
| python -c | |
| "import sys; sys.path.insert(0, 'scripts'); | |
| from source_data import validate_declared_sources; | |
| validate_declared_sources()" | |
| - name: Build twice and verify determinism | |
| run: python scripts/check_determinism.py | |
| - name: Validate rebuilt data and cross-format equivalence | |
| run: python scripts/validate_dataset.py | |
| - name: Run schema, integrity, coordinate and territorial tests | |
| run: python -m unittest discover -s tests -v | |
| - name: Test Pages search and map logic | |
| run: node --test tests/pages_core.test.mjs | |
| - name: Verify committed geographic base | |
| run: python scripts/build_geography.py --check | |
| - name: Build deterministic GitHub Pages site | |
| run: python scripts/build_pages.py | |
| - name: Validate Pages accessibility, links and budgets | |
| run: python scripts/validate_site.py dist/pages | |
| - name: Build versioned release assets | |
| run: python scripts/build_release.py | |
| - name: Validate versioned release assets | |
| run: python scripts/validate_release.py | |
| - name: Smoke-test release artifact upload | |
| if: github.event_name == 'pull_request' | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |
| with: | |
| name: "Italian_Cities-release-smoke-${{ github.sha }}" | |
| path: "dist/*/*" | |
| if-no-files-found: error | |
| retention-days: 1 | |
| - name: Reject stale, divergent or manually edited artifacts | |
| run: >- | |
| git diff --exit-code -- | |
| data | |
| ":(exclude)data/italian_locations.sqlite" | |
| reports/release-diff.json | |
| reports/build-metadata.json | |
| reports/legacy-comparison.json | |
| reports/reconciliation-backlog.json | |
| reports/export-manifest.json | |
| reports/determinism.json | |
| reports/quality-validation.json |