Skip to content

Commit

Permalink
ci: add stac-api-validator (#148)
Browse files Browse the repository at this point in the history
Doesn't include features and item-search validation, but includes comments in
the validation script saying why.

Co-authored-by: Matt McFarland <[email protected]>
  • Loading branch information
gadomski and mmcfarland authored Jan 31, 2023
1 parent c6e85dc commit 95190c5
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 2 deletions.
14 changes: 12 additions & 2 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,25 @@ name: Planetary Computer APIs PR CI

on:
pull_request:
branches: [ main ]
branches: [main]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- name: Run cibuild
run: ./scripts/cibuild

validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: "3.10" # stac-api-validator requires >= 3.10
cache: "pip"
- name: Validate
run: ./scripts/validate
30 changes: 30 additions & 0 deletions scripts/validate
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

set -e

if [[ "${CI}" ]]; then
set -x
fi

function usage() {
echo -n \
"Usage: $(basename "$0") [url]
Run stac-api-validator on the local server
"
}

geometry='{"type":"Polygon","coordinates":[[[-85.3125,30.9375],[-85.3125,31],[-85.375,31],[-85.375,30.9375],[-85.3125,30.9375]]]}'

if [ "${BASH_SOURCE[0]}" = "${0}" ]; then
scripts/setup
which stac-api-validator >/dev/null || pip install stac-api-validator==0.4.1
stac-api-validator --root-url http://localhost:8080/stac/ \
--conformance collections \
--conformance core \
--collection naip \
--geometry "$geometry"

# Currently broken:
# - `--conformance features`: needs https://github.com/stac-utils/stac-fastapi/pull/508
# - `--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)
fi

0 comments on commit 95190c5

Please sign in to comment.