docs: use the glossary's terms for collections and locations #1420
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
| # This workflow will install Python dependencies, run tests and lint with a variety of Python versions | |
| # For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
| name: Python package | |
| on: | |
| push: | |
| branches: ['main'] | |
| pull_request: | |
| branches: ['main'] | |
| jobs: | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Python 3.14 | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.14" | |
| cache: "pip" | |
| - name: Install ruff | |
| # Keep this version aligned with the ruff-pre-commit revision. | |
| run: pip install ruff==0.16.1 | |
| - name: Lint with ruff | |
| run: | | |
| ruff check . --output-format=github | |
| ruff format --check . | |
| complexity: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| # wily needs history to compare against the base; the gate itself | |
| # only needs the working tree. | |
| fetch-depth: 0 | |
| - name: Set up Python 3.14 | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.14" | |
| cache: "pip" | |
| - name: Install metrics tooling | |
| # Versions pinned in the extra so CI and pre-commit grade identically. | |
| run: pip install -e .[metrics] | |
| # Ratchets, not aspirations: thresholds sit where the package already is, | |
| # so they fail on regression rather than demanding a refactor. Each | |
| # mirrors a pre-commit hook, so a clean local run means CI agrees. | |
| - name: Complexity gate | |
| run: xenon --max-absolute C --max-modules B --max-average A dataretrieval | |
| - name: Cognitive complexity gate | |
| run: complexipy dataretrieval | |
| - name: Dependency-direction contracts | |
| # Rules and rationale live in .importlinter and the ADRs it cites. | |
| run: lint-imports | |
| - name: Complexity trend vs base | |
| # Advisory: reports which files moved and by how much, so a reviewer | |
| # can see direction rather than a pass/fail. Never fails the build -- | |
| # the gate above is what blocks. | |
| if: github.event_name == 'pull_request' | |
| continue-on-error: true | |
| run: | | |
| base="${{ github.event.pull_request.base.sha }}" | |
| git fetch --quiet origin "$base" || true | |
| wily build dataretrieval --max-revisions 40 >/dev/null 2>&1 || true | |
| echo '### Complexity trend' >> "$GITHUB_STEP_SUMMARY" | |
| echo '```' >> "$GITHUB_STEP_SUMMARY" | |
| wily diff dataretrieval --revision "$base" 2>&1 | tail -40 \ | |
| >> "$GITHUB_STEP_SUMMARY" || echo 'no comparable revision' \ | |
| >> "$GITHUB_STEP_SUMMARY" | |
| echo '```' >> "$GITHUB_STEP_SUMMARY" | |
| package-artifact: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Python 3.13 | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.13" | |
| cache: "pip" | |
| - name: Build wheel | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip wheel --no-deps --wheel-dir wheelhouse . | |
| - name: Smoke test installed wheel outside the checkout | |
| run: | | |
| venv="$RUNNER_TEMP/dataretrieval-wheel-smoke" | |
| python -m venv "$venv" | |
| "$venv/bin/python" -m pip install "$GITHUB_WORKSPACE"/wheelhouse/*.whl | |
| cd "$RUNNER_TEMP" | |
| "$venv/bin/python" -I - <<'PY' | |
| import os | |
| from importlib.resources import files | |
| from pathlib import Path | |
| import dataretrieval | |
| import dataretrieval.transport | |
| from dataretrieval import ngwmn, waterdata, wateruse | |
| from dataretrieval.ogc import engine | |
| checkout = Path(os.environ["GITHUB_WORKSPACE"]).resolve() | |
| installed = Path(dataretrieval.__file__).resolve() | |
| assert not installed.is_relative_to(checkout), (installed, checkout) | |
| assert files("dataretrieval").joinpath("py.typed").is_file() | |
| assert waterdata.get_daily | |
| assert ngwmn.get_sites | |
| assert wateruse.get_wateruse | |
| assert engine.get_ogc_data | |
| PY | |
| type-check: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Python 3.13 | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.13" | |
| cache: "pip" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install .[type-check] | |
| - name: Type-check with mypy | |
| run: mypy | |
| test: | |
| needs: lint | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, windows-latest] | |
| python-version: ["3.10", "3.13", "3.14"] | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: "pip" | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install .[test,nldi] | |
| - name: Test with pytest | |
| # Pinned to bash on every OS. The default Windows shell is PowerShell, | |
| # which does not stop on a failing native command and takes the step's | |
| # exit code from the last one -- so a pytest failure was masked by the | |
| # coverage report that followed it, and the Windows matrix reported | |
| # success while tests were red. | |
| shell: bash | |
| run: coverage run -m pytest tests/ | |
| - name: Coverage ratchet | |
| # Windows skips POSIX-only tests, so its number measures a smaller | |
| # suite. Negative condition: a matrix edit cannot silently unenforce it. | |
| if: runner.os != 'Windows' | |
| shell: bash | |
| run: coverage report | |
| - name: Coverage report (informational) | |
| if: runner.os == 'Windows' | |
| shell: bash | |
| run: coverage report -m --fail-under=0 |