Skip to content

fix(features): fillnan='nearest' leaves points with a NaN coordinate NaN #312

fix(features): fillnan='nearest' leaves points with a NaN coordinate NaN

fix(features): fillnan='nearest' leaves points with a NaN coordinate NaN #312

Workflow file for this run

name: "📦 Workspace packages"
# Stage 2 of ROADMAP.md (outcome 2): loop_common/loop_interpolation live under
# packages/ as independent uv-workspace members so the interpolation code is
# usable outside the LoopStructural framework. Stage 4 (outcomes 5, 7) added
# loopstructural_visualisation (packages-test matrix, below) and map2loop
# (map2loop-test, its own job: map2loop hard-depends on GDAL bindings, which
# aren't pip-installable on Windows/macOS the way this matrix installs
# everything else, so it only runs on ubuntu with an apt-installed libgdal —
# matching map2loop's own upstream CI, which uses conda for the same reason).
# This job installs and tests packages on their own, separately from the root
# LoopStructural test suite in tester.yml. loopstructural-test waits on both
# jobs (needs:) so the root suite only runs once every workspace package is
# confirmed working.
#
# On a pull request, only the jobs whose code changed run (see the `changes`
# job). A change in a package also runs the packages and the root suite that
# depend on it:
#
# loop_common -> loop_interpolation, LoopStructural, visualisation
# loop_interpolation -> LoopStructural, visualisation
# LoopStructural -> visualisation
# map2loop -> (nothing; it does not depend on the others)
#
# A change in uv.lock or in this file runs everything. A push to master and a
# manual run always run everything.
on:
push:
branches:
- master
paths:
- 'packages/**'
- 'LoopStructural/**'
- 'tests/**'
- pyproject.toml
- uv.lock
- .github/workflows/packages.yml
pull_request:
branches:
- master
paths:
- 'packages/**'
- 'LoopStructural/**'
- 'tests/**'
- pyproject.toml
- uv.lock
- .github/workflows/packages.yml
workflow_dispatch:
permissions:
contents: read
jobs:
changes:
# Decides which test jobs run. It writes one flag for each job group and
# the list of workspace packages for the packages-test matrix.
name: Changed code
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
outputs:
packages: ${{ steps.decide.outputs.packages }}
map2loop: ${{ steps.decide.outputs.map2loop }}
root: ${{ steps.decide.outputs.root }}
steps:
- uses: actions/checkout@v4
- name: Find the changed paths
id: filter
uses: dorny/paths-filter@v3
with:
filters: |
common:
- 'packages/loop_common/**'
interpolation:
- 'packages/loop_interpolation/**'
visualisation:
- 'packages/loopstructural_visualisation/**'
map2loop:
- 'packages/map2loop/**'
root:
- 'LoopStructural/**'
- 'tests/**'
- 'pyproject.toml'
shared:
- 'uv.lock'
- '.github/workflows/packages.yml'
- name: Decide which tests run
id: decide
env:
EVENT: ${{ github.event_name }}
COMMON: ${{ steps.filter.outputs.common }}
INTERPOLATION: ${{ steps.filter.outputs.interpolation }}
VISUALISATION: ${{ steps.filter.outputs.visualisation }}
MAP2LOOP: ${{ steps.filter.outputs.map2loop }}
ROOT: ${{ steps.filter.outputs.root }}
SHARED: ${{ steps.filter.outputs.shared }}
run: |
set -euo pipefail
is() { [ "$1" = "true" ]; }
# Everything runs for a push, a manual run, and a shared change.
everything=false
if [ "$EVENT" != "pull_request" ] || is "$SHARED"; then everything=true; fi
run_common=$everything
run_interpolation=$everything
run_visualisation=$everything
run_map2loop=$everything
run_root=$everything
# A change runs the code that depends on it (see the header comment).
if is "$COMMON"; then
run_common=true; run_interpolation=true; run_root=true; run_visualisation=true
fi
if is "$INTERPOLATION"; then
run_interpolation=true; run_root=true; run_visualisation=true
fi
if is "$ROOT"; then run_root=true; run_visualisation=true; fi
if is "$VISUALISATION"; then run_visualisation=true; fi
if is "$MAP2LOOP"; then run_map2loop=true; fi
packages=""
add() {
packages="${packages:+$packages,}{\"name\":\"$1\",\"dir\":\"$2\"}"
}
if is "$run_common"; then add loop_common loop_common; fi
if is "$run_interpolation"; then add loop_interpolation loop_interpolation; fi
if is "$run_visualisation"; then add loopstructuralvisualisation loopstructural_visualisation; fi
packages="[$packages]"
{
echo "packages=$packages"
echo "map2loop=$run_map2loop"
echo "root=$run_root"
} >> "$GITHUB_OUTPUT"
echo "packages=$packages map2loop=$run_map2loop root=$run_root"
packages-test:
needs: changes
if: needs.changes.outputs.packages != '[]'
# matrix.package.name is the uv/PyPI package name (as declared in each
# package's pyproject.toml `[project] name`); matrix.package.dir is its
# directory under packages/. These differ for loopstructuralvisualisation:
# its published/import name has no separator, but its directory uses an
# underscore, and `uv --package` matches on the declared name (with only
# hyphen/underscore treated as equivalent, not a missing separator).
name: ${{ matrix.package.name }} (python ${{ matrix.python-version }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
package: ${{ fromJSON(needs.changes.outputs.packages) }}
os: ${{ fromJSON(vars.BUILD_OS)}}
python-version: ${{ fromJSON(vars.PYTHON_VERSIONS)}}
steps:
- uses: actions/checkout@v4
- name: Set up uv
uses: astral-sh/setup-uv@v3
with:
version: "latest"
- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}
- name: Install package with test extras
run: |
uv sync --package ${{ matrix.package.name }} --extra tests --python ${{ matrix.python-version }}
- name: pytest
run: |
uv run --package ${{ matrix.package.name }} pytest packages/${{ matrix.package.dir }}/tests
map2loop-test:
needs: changes
if: needs.changes.outputs.map2loop == 'true'
# Separate job (not part of the packages-test matrix above): map2loop
# imports osgeo/gdal at module load time, which has no pip-installable
# wheel on Windows/macOS (confirmed: building GDAL from the PyPI sdist
# fails without system libgdal headers). Scoped to ubuntu-latest only,
# installing libgdal via apt, mirroring how map2loop's own upstream CI
# special-cases GDAL per-OS (it uses conda-forge everywhere). Revisit
# widening the OS matrix if/when a reliable cross-platform GDAL install
# path is found.
name: map2loop (python ${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ${{ fromJSON(vars.PYTHON_VERSIONS) }}
steps:
- uses: actions/checkout@v4
- name: Install GDAL system libraries
run: |
sudo apt-get update
sudo apt-get install -y gdal-bin libgdal-dev
echo "CPLUS_INCLUDE_PATH=/usr/include/gdal" >> "$GITHUB_ENV"
echo "C_INCLUDE_PATH=/usr/include/gdal" >> "$GITHUB_ENV"
- name: Set up uv
uses: astral-sh/setup-uv@v3
with:
version: "latest"
- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}
- name: Install package with test extras
run: |
uv sync --package map2loop --extra tests --python ${{ matrix.python-version }}
GDAL_VERSION=$(gdal-config --version)
uv pip install setuptools
uv pip install "gdal==${GDAL_VERSION}" --no-build-isolation-package gdal
- name: pytest
run: |
uv run --package map2loop pytest packages/map2loop/tests
loop-link-test:
# Separate job (not part of the packages-test matrix above): packages/loop_link
# is listed in the uv workspace `exclude` list, so `uv sync --package loop-link`
# cannot resolve it as a workspace member. Install it into its own venv with
# uv pip instead. The package needs Python 3.10 or later.
name: loop-link (python ${{ matrix.python-version }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ${{ fromJSON(vars.BUILD_OS) }}
python-version: ["3.10", "3.11", "3.12"]
# The real-codec test (tests/test_codec_real.py) needs the private geoviewer repository.
# The secret GEOVIEWER_READ_TOKEN gives read access to it. If the secret does not exist
# (for example in a pull request from a fork), the steps for geoviewer do not run and the
# real-codec test skips. All other tests run in both cases.
env:
GEOVIEWER_REPO_TOKEN: ${{ secrets.GEOVIEWER_READ_TOKEN }}
steps:
- uses: actions/checkout@v4
- name: Set up uv
uses: astral-sh/setup-uv@v3
with:
version: "latest"
- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}
- name: Create virtual environment
run: uv venv --python ${{ matrix.python-version }} .venv-loop-link
- name: Install package with test extras
run: |
uv pip install --python .venv-loop-link -e "packages/loop_link[tests]" -e packages/loop_common
- name: Check out geoviewer (for the real-codec test)
if: env.GEOVIEWER_REPO_TOKEN != ''
uses: actions/checkout@v4
with:
repository: lachlangrose/geoviewer
token: ${{ secrets.GEOVIEWER_READ_TOKEN }}
path: geoviewer-src
ref: b938de0ff522a6cba7b79cf2bb4b3739bb88efc0
- name: Set up Rust (geoviewer needs Rust 1.95)
if: env.GEOVIEWER_REPO_TOKEN != ''
uses: dtolnay/rust-toolchain@stable
- name: Cache the codec validator build
if: env.GEOVIEWER_REPO_TOKEN != ''
uses: actions/cache@v4
with:
path: packages/loop_link/.codec-validator-build/target
key: codec-validator-${{ runner.os }}-b938de0ff522a6cba7b79cf2bb4b3739bb88efc0
- name: pytest
env:
LOOP_LINK_GEOVIEWER_REPO: ${{ env.GEOVIEWER_REPO_TOKEN != '' && format('{0}/geoviewer-src', github.workspace) || '' }}
run: |
uv run --no-project --python .venv-loop-link python -m pytest packages/loop_link/tests
loopstructural-test:
name: LoopStructural (python ${{ matrix.python-version }})
needs: [changes, packages-test, map2loop-test]
# always(): a skipped job in `needs` would otherwise skip this job too. The
# root suite still waits for the jobs that ran, and stops if one failed.
if: >-
${{ always()
&& needs.changes.outputs.root == 'true'
&& !contains(needs.*.result, 'failure')
&& !contains(needs.*.result, 'cancelled') }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ${{ fromJSON(vars.BUILD_OS)}}
python-version: ${{ fromJSON(vars.PYTHON_VERSIONS)}}
steps:
- uses: actions/checkout@v4
- name: Set up uv
uses: astral-sh/setup-uv@v3
with:
version: "latest"
- name: Set up Python ${{ matrix.python-version }}
run: uv python install ${{ matrix.python-version }}
- name: Install package with test extras
run: |
uv sync --extra tests --python ${{ matrix.python-version }}
- name: pytest
run: |
uv run pytest tests