Update titiler-mosaic requirement from <0.19,>=0.18.0 to >=0.18.0,<0.20 #474
This file contains 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: CI | |
# On every pull request, but only on push to main | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- '*' | |
paths: | |
- 'tests/**' | |
- 'titiler/**' | |
- 'pyproject.toml' | |
- '.github/workflows/ci.yml' | |
pull_request: | |
env: | |
LATEST_PY_VERSION: '3.12' | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: | |
- '3.8' | |
- '3.9' | |
- '3.10' | |
- '3.11' | |
- '3.12' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: install lib postgres | |
uses: nyurik/action-setup-postgis@v2 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install -e .["test,psycopg"] | |
- name: Run pre-commit | |
if: ${{ matrix.python-version == env.LATEST_PY_VERSION }} | |
run: | | |
python -m pip install pre-commit | |
pre-commit run --all-files | |
- name: Run tests | |
run: python -m pytest --cov titiler.pgstac --cov-report xml --cov-report term-missing --asyncio-mode=strict -s -vv | |
- name: Upload Results | |
if: ${{ matrix.python-version == env.LATEST_PY_VERSION }} | |
uses: codecov/codecov-action@v4 | |
with: | |
file: ./coverage.xml | |
flags: unittests | |
name: ${{ matrix.python-version }} | |
fail_ci_if_error: false | |
benchmark: | |
needs: [tests] | |
runs-on: ubuntu-latest | |
env: | |
PGSTAC_VERSION: '0.9.1' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ env.LATEST_PY_VERSION }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.LATEST_PY_VERSION }} | |
- name: Launch services | |
run: docker compose up -d tiler-uvicorn | |
env: | |
PGSTAC_VERSION: ${{ env.PGSTAC_VERSION }} | |
- name: install lib postgres | |
uses: nyurik/action-setup-postgis@v2 | |
- name: Install python dependencies | |
run: | | |
python -m pip install pypgstac==${{ env.PGSTAC_VERSION }} psycopg[pool] httpx pytest pytest-benchmark rasterio | |
- name: Ingest Stac Items/Collection | |
run: | | |
pypgstac pgready --dsn postgresql://username:[email protected]:5439/postgis | |
pypgstac load collections benchmark/stac/collection.json --dsn postgresql://username:[email protected]:5439/postgis --method insert_ignore | |
pypgstac load items benchmark/stac/items.json --dsn postgresql://username:[email protected]:5439/postgis --method insert_ignore | |
- name: Sleep for 10 seconds | |
run: sleep 10s | |
shell: bash | |
- name: Run Benchmark | |
run: | | |
python -m pytest .github/workflows/tests/benchmarks.py --benchmark-only --benchmark-columns 'min, max, mean, median' --benchmark-json output.json | |
- name: Store and benchmark result | |
uses: benchmark-action/github-action-benchmark@v1 | |
with: | |
name: TiTiler-pgSTAC Benchmarks | |
tool: 'pytest' | |
output-file-path: output.json | |
alert-threshold: '130%' | |
comment-on-alert: true | |
fail-on-alert: false | |
# GitHub API token to make a commit comment | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
gh-pages-branch: 'gh-benchmarks' | |
# Make a commit only if main | |
auto-push: ${{ github.ref == 'refs/heads/main' }} | |
- name: Stop services | |
run: docker compose stop | |
publish: | |
needs: [tests] | |
runs-on: ubuntu-latest | |
if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.LATEST_PY_VERSION }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install wheel twine build | |
python -m pip install . | |
- name: Set tag version | |
id: tag | |
run: | | |
echo "version=${GITHUB_REF#refs/*/}" | |
echo "version=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT | |
- name: Set module version | |
id: module | |
run: | | |
echo version=$(python -c'import titiler.pgstac; print(titiler.pgstac.__version__)') >> $GITHUB_OUTPUT | |
- name: Build and publish | |
if: ${{ steps.tag.outputs.version }} == ${{ steps.module.outputs.version}} | |
env: | |
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | |
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | |
run: | | |
rm -rf dist | |
python -m build | |
twine upload dist/* | |
publish-docker: | |
needs: [tests] | |
if: github.ref == 'refs/heads/main' || startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release' | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
image-version: | |
- 'uvicorn' | |
- 'gunicorn' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Github | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set tag version | |
id: tag | |
run: | | |
echo "version=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT | |
- name: Image name | |
id: image | |
run: | | |
if [ ${{ matrix.image-version }} = 'uvicorn' ]; then | |
echo "name=titiler-pgstac:uvicorn-" >> $GITHUB_OUTPUT | |
else | |
echo "name=titiler-pgstac:" >> $GITHUB_OUTPUT | |
fi | |
# Push `latest` when comiting to main | |
- name: Build and push latest | |
if: github.ref == 'refs/heads/main' | |
uses: docker/build-push-action@v6 | |
with: | |
platforms: linux/amd64 | |
context: . | |
file: Dockerfile.${{ matrix.image-version }} | |
push: true | |
tags: | | |
ghcr.io/stac-utils/${{ steps.image.outputs.name }}latest | |
# Push `{VERSION}` when pushing a new tag | |
- name: Build and push tag | |
if: startsWith(github.event.ref, 'refs/tags') || github.event_name == 'release' | |
uses: docker/build-push-action@v6 | |
with: | |
platforms: linux/amd64 | |
context: . | |
file: Dockerfile.${{ matrix.image-version }} | |
push: true | |
tags: | | |
ghcr.io/stac-utils/${{ steps.image.outputs.name }}${{ steps.tag.outputs.version }} |