|
| 1 | +name: pytest-geotiff-corpus |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - main |
| 6 | + pull_request: |
| 7 | + branches: |
| 8 | + - '*' |
| 9 | + # Nightly cron so the full corpus (slow lane included) runs at |
| 10 | + # least once a day against rasterio from conda-forge. PR runs stay |
| 11 | + # on the fast lane via `-m "not slow"`. See issue #2289 for why |
| 12 | + # this workflow exists separately from `test.yml`: the geotiff |
| 13 | + # golden_corpus tests all start with `pytest.importorskip("rasterio")`, |
| 14 | + # and the pip-based job in `test.yml` cannot install rasterio |
| 15 | + # reliably across the OS matrix because of the GDAL build chain. |
| 16 | + # GitHub Actions only fires `schedule` triggers on the workflow |
| 17 | + # file in the default branch -- use `workflow_dispatch` for an |
| 18 | + # on-demand run from a feature branch. |
| 19 | + schedule: |
| 20 | + # 03:30 UTC daily. Offset from `test.yml` (03:00) so the two |
| 21 | + # nightlies do not contend for runner capacity at the same time. |
| 22 | + - cron: '30 3 * * *' |
| 23 | + workflow_dispatch: |
| 24 | + |
| 25 | +jobs: |
| 26 | + run: |
| 27 | + runs-on: ${{ matrix.os }} |
| 28 | + # PR runs stick to ubuntu only to keep CI cost down; the nightly |
| 29 | + # / push-to-main runs widen to macos + windows so the parity |
| 30 | + # oracle exercises the full OS matrix against rasterio. |
| 31 | + strategy: |
| 32 | + fail-fast: false |
| 33 | + matrix: |
| 34 | + os: ${{ github.event_name == 'pull_request' && fromJson('["ubuntu-latest"]') || fromJson('["ubuntu-latest", "macos-latest", "windows-latest"]') }} |
| 35 | + python: ${{ github.event_name == 'pull_request' && fromJson('["3.14"]') || fromJson('["3.12", "3.14"]') }} |
| 36 | + defaults: |
| 37 | + run: |
| 38 | + # `-el` so micromamba's activation hooks fire and `rasterio` |
| 39 | + # resolves to the conda-forge env in every step. |
| 40 | + shell: bash -el {0} |
| 41 | + steps: |
| 42 | + - uses: actions/checkout@v4 |
| 43 | + - name: Set up micromamba env (conda-forge rasterio + GDAL) |
| 44 | + uses: mamba-org/setup-micromamba@v1 |
| 45 | + with: |
| 46 | + environment-name: xrspatial-geotiff |
| 47 | + create-args: >- |
| 48 | + python=${{ matrix.python }} |
| 49 | + rasterio |
| 50 | + gdal |
| 51 | + pyyaml |
| 52 | + tifffile |
| 53 | + condarc: | |
| 54 | + channels: |
| 55 | + - conda-forge |
| 56 | + channel_priority: strict |
| 57 | + cache-environment: true |
| 58 | + - name: Install xrspatial (test extras) |
| 59 | + run: | |
| 60 | + python -m pip install --upgrade pip |
| 61 | + pip install -e .[tests] |
| 62 | + - name: Verify rasterio still imports after pip step |
| 63 | + # `pip install -e .[tests]` can pull PyPI wheels (pyproj, numpy) on |
| 64 | + # top of the conda-forge env and shadow the GDAL/proj stack that |
| 65 | + # rasterio links against. Re-import here so a broken env fails |
| 66 | + # this step with a clear message instead of mid-pytest. |
| 67 | + run: | |
| 68 | + python -c "import sys, rasterio, numpy; print('python', sys.version.split()[0]); print('rasterio', rasterio.__version__); print('gdal', rasterio.__gdal_version__); print('numpy', numpy.__version__)" |
| 69 | + - name: Run geotiff golden_corpus tests (fast lane) |
| 70 | + # PR triggers run the fast lane: `-m "not slow"` deselects the |
| 71 | + # heavier corpus cells tagged via `_marks.fast_slow_marks_for`. |
| 72 | + # push-to-main and the nightly schedule run the full set. |
| 73 | + # Target is scoped to `golden_corpus/` to match the issue (#2289); |
| 74 | + # broader geotiff integration tests stay on the `test.yml` job. |
| 75 | + # |
| 76 | + # `test_corpus_determinism.py` is deselected here: it asserts md5 |
| 77 | + # equality between committed fixtures and bytes regenerated by |
| 78 | + # `generate.py`, which depends on the exact GDAL / libjpeg the |
| 79 | + # corpus was produced against. Conda-forge ships different |
| 80 | + # versions than the developer machine that originally built the |
| 81 | + # fixtures (today: COG-with-overview and JPEG-YCbCr drift), so |
| 82 | + # this check is fundamentally toolchain-coupled. Tracking the |
| 83 | + # cleanup in a follow-up issue; the oracle and nodata tests -- |
| 84 | + # which compare semantic output, not byte exactness -- still run. |
| 85 | + if: github.event_name == 'pull_request' |
| 86 | + run: pytest xrspatial/geotiff/tests/golden_corpus/ -m "not slow" --ignore=xrspatial/geotiff/tests/golden_corpus/test_corpus_determinism.py |
| 87 | + - name: Run geotiff golden_corpus tests (full) |
| 88 | + if: github.event_name != 'pull_request' |
| 89 | + run: pytest xrspatial/geotiff/tests/golden_corpus/ --ignore=xrspatial/geotiff/tests/golden_corpus/test_corpus_determinism.py |
0 commit comments