-
Notifications
You must be signed in to change notification settings - Fork 90
104 lines (101 loc) · 4.14 KB
/
test-cog-validator.yml
File metadata and controls
104 lines (101 loc) · 4.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
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