Make corpus determinism check toolchain-agnostic (#2299) (#2377) #144
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: pytest-cog-validator | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - '*' | |
| # Daily run so a regression in the rio-cogeo / GDAL toolchain is | |
| # caught even when no PR is open. Issue #2302 (part of #2286 -- | |
| # production-readiness wave) stood up this gate so the optional | |
| # external interop validator in | |
| # ``xrspatial/geotiff/tests/test_cog_writer_compliance.py`` is no | |
| # longer silent-skip on CI. | |
| # | |
| # GitHub Actions only fires `schedule` from the default branch -- | |
| # use `workflow_dispatch` for an on-demand run from a feature branch. | |
| schedule: | |
| # 04:00 UTC daily. Offset from `test.yml` (03:00) and the | |
| # geotiff-corpus job (03:30) so the three nightlies do not | |
| # contend for runner capacity. | |
| - cron: '0 4 * * *' | |
| workflow_dispatch: | |
| # Cancel older runs on the same ref. The micromamba env build is the | |
| # expensive part of this job; queueing a fresh one for every push on a | |
| # busy PR is wasteful. | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| # Least privilege: this job only reads the repo. No write scopes | |
| # needed. | |
| permissions: | |
| contents: read | |
| jobs: | |
| run: | |
| # Linux-only by design: rio-cogeo and the GDAL Python bindings | |
| # are simplest to provision through conda-forge on Linux. | |
| # Widening to macOS / Windows is a separate follow-up. | |
| runs-on: ubuntu-latest | |
| # 20 minutes is plenty for the compliance + parity subset on a | |
| # warm conda cache and well above the headroom for the cold-cache | |
| # case. Without this cap a hung `to_geotiff` or validator would | |
| # hold the runner for the 6h default. | |
| timeout-minutes: 20 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| # Pin to a python version where conda-forge ships a stable | |
| # rio-cogeo + GDAL combo. 3.12 is the safest target today; | |
| # 3.14 wheels for some of the GDAL stack are not yet | |
| # universally available, and the gate has to install reliably | |
| # to be a useful required check. Add 3.13 / 3.14 here once | |
| # conda-forge has caught up with stable rio-cogeo + GDAL | |
| # builds for those interpreters. | |
| python: ['3.12'] | |
| defaults: | |
| run: | |
| # `-el` so micromamba activation hooks fire and rio-cogeo / | |
| # GDAL resolve to the conda-forge env in every step. | |
| shell: bash -el {0} | |
| env: | |
| # Promotes the optional validator block in | |
| # `test_cog_writer_compliance.py` from silent-skip to hard-fail | |
| # when the dependency is missing. A misconfigured install step | |
| # cannot quietly pass the gate. | |
| XRSPATIAL_REQUIRE_COG_VALIDATOR: '1' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up micromamba env (conda-forge rio-cogeo + GDAL) | |
| uses: mamba-org/setup-micromamba@v1 | |
| with: | |
| environment-name: xrspatial-cog-validator | |
| create-args: >- | |
| python=${{ matrix.python }} | |
| rasterio | |
| gdal | |
| rio-cogeo | |
| pyyaml | |
| tifffile | |
| condarc: | | |
| channels: | |
| - conda-forge | |
| channel_priority: strict | |
| cache-environment: true | |
| - name: Install xrspatial (test extras) | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e .[tests] | |
| - name: Verify rio-cogeo + GDAL import after pip step | |
| # `pip install -e .[tests]` can pull PyPI wheels on top of the | |
| # conda-forge env and shadow the GDAL stack rio-cogeo links | |
| # against. Re-import here so a broken env fails this step with | |
| # a clear message instead of mid-pytest. | |
| run: | | |
| python -c "import sys, rasterio, rio_cogeo; from osgeo_utils.samples import validate_cloud_optimized_geotiff; print('python', sys.version.split()[0]); print('rasterio', rasterio.__version__); print('rio_cogeo', rio_cogeo.__version__); print('gdal', rasterio.__gdal_version__)" | |
| - name: Run COG validator compliance suite (strict) | |
| # `XRSPATIAL_REQUIRE_COG_VALIDATOR=1` (set above) makes a | |
| # missing rio-cogeo / GDAL install fail the suite instead of | |
| # skipping it -- the whole point of this gate. | |
| run: | | |
| pytest xrspatial/geotiff/tests/test_cog_writer_compliance.py xrspatial/geotiff/tests/test_cog_parity_2286.py -x |