Skip to content

Commit 95190c5

Browse files
gadomskimmcfarland
andauthored
ci: add stac-api-validator (#148)
Doesn't include features and item-search validation, but includes comments in the validation script saying why. Co-authored-by: Matt McFarland <[email protected]>
1 parent c6e85dc commit 95190c5

File tree

2 files changed

+42
-2
lines changed

2 files changed

+42
-2
lines changed

.github/workflows/pr.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,25 @@ name: Planetary Computer APIs PR CI
22

33
on:
44
pull_request:
5-
branches: [ main ]
5+
branches: [main]
66

77
jobs:
88
build:
9-
109
runs-on: ubuntu-latest
1110

1211
steps:
1312
- uses: actions/checkout@v3
1413

1514
- name: Run cibuild
1615
run: ./scripts/cibuild
16+
17+
validate:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v3
21+
- uses: actions/setup-python@v4
22+
with:
23+
python-version: "3.10" # stac-api-validator requires >= 3.10
24+
cache: "pip"
25+
- name: Validate
26+
run: ./scripts/validate

scripts/validate

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
if [[ "${CI}" ]]; then
6+
set -x
7+
fi
8+
9+
function usage() {
10+
echo -n \
11+
"Usage: $(basename "$0") [url]
12+
Run stac-api-validator on the local server
13+
"
14+
}
15+
16+
geometry='{"type":"Polygon","coordinates":[[[-85.3125,30.9375],[-85.3125,31],[-85.375,31],[-85.375,30.9375],[-85.3125,30.9375]]]}'
17+
18+
if [ "${BASH_SOURCE[0]}" = "${0}" ]; then
19+
scripts/setup
20+
which stac-api-validator >/dev/null || pip install stac-api-validator==0.4.1
21+
stac-api-validator --root-url http://localhost:8080/stac/ \
22+
--conformance collections \
23+
--conformance core \
24+
--collection naip \
25+
--geometry "$geometry"
26+
27+
# Currently broken:
28+
# - `--conformance features`: needs https://github.com/stac-utils/stac-fastapi/pull/508
29+
# - `--conformance item-search`: needs https://github.com/stac-utils/stac-api-validator/pull/237 and *not* stac-api-validate v0.4.2 (https://github.com/stac-utils/stac-api-validator/issues/240)
30+
fi

0 commit comments

Comments
 (0)