diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 9282a6c1..34629bd8 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -2,11 +2,10 @@ name: Planetary Computer APIs PR CI on: pull_request: - branches: [ main ] + branches: [main] jobs: build: - runs-on: ubuntu-latest steps: @@ -14,3 +13,14 @@ jobs: - 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 diff --git a/scripts/validate b/scripts/validate new file mode 100755 index 00000000..57e0cd94 --- /dev/null +++ b/scripts/validate @@ -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