H3 Index Support & Cron Table #1107
This file contains hidden or 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: Check Build | |
| on: | |
| push: | |
| paths-ignore: | |
| - "infra/**" | |
| branches: | |
| - stage | |
| - develop | |
| pull_request: | |
| branches: | |
| - stage | |
| - develop | |
| jobs: | |
| build: | |
| timeout-minutes: 10 | |
| runs-on: ubuntu-latest | |
| env: | |
| PGPASSWORD: admin | |
| PGDATABASE: raw | |
| PGPORT: 5434 | |
| PGHOST: localhost | |
| PGUSER: postgres | |
| services: | |
| postgres: | |
| image: ghcr.io/hotosm/postgis-h3:latest | |
| credentials: | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| env: | |
| POSTGRES_PASSWORD: admin | |
| POSTGRES_DB: raw | |
| ports: | |
| - 5434:5432 | |
| options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 2 | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - name: Set up Python 3.12 | |
| uses: actions/setup-python@v1 | |
| with: | |
| python-version: 3.12 | |
| - name: Install uv | |
| run: pip install uv | |
| - name: Install necessary dependecies for rawdata loading | |
| run: sudo apt-get update && sudo apt-get install osm2pgsql | |
| - name: check version | |
| run: osm2pgsql --version | |
| - name: Create H3 extensions | |
| run: | | |
| psql -U postgres -h localhost -p 5434 -d raw -c "CREATE EXTENSION IF NOT EXISTS h3;" | |
| psql -U postgres -h localhost -p 5434 -d raw -c "CREATE EXTENSION IF NOT EXISTS h3_postgis CASCADE;" | |
| - name: Install python requirements for load | |
| run: uv sync --group backend | |
| - name: Start Loading | |
| run: uv run raw-backend --insert --fq m | |
| - name: Install gdal | |
| run: | | |
| sudo apt-get -y install gdal-bin python3-gdal && sudo apt-get -y autoremove && sudo apt-get clean | |
| - name: Install redis | |
| run: | | |
| sudo apt install lsb-release | |
| curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg | |
| echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/redis.list | |
| sudo apt-get update | |
| sudo apt-get install redis | |
| redis-cli ping | |
| - name: Install Dependencies | |
| run: uv sync | |
| - name: Run uvicorn server | |
| run: | | |
| export OSM_CLIENT_ID=thisisfakeosmcliendid | |
| export OSM_CLIENT_SECRET=thisisclientosm | |
| export APP_SECRET_KEY=thisissecretkey | |
| uvicorn API.main:app &> uvicorn.log & | |
| env: | |
| PORT: 8000 | |
| - name: Run celery server | |
| run: | | |
| export OSM_CLIENT_ID=thisisfakeosmcliendid | |
| export OSM_CLIENT_SECRET=thisisclientosm | |
| export APP_SECRET_KEY=thisissecretkey | |
| celery --app API.api_worker worker --loglevel=DEBUG &> worker.log & | |
| - name: Run flower dashboard | |
| run: | | |
| celery --app API.api_worker flower --port=5555 --broker=redis://localhost:6379/ & | |
| - name: Run rawdata current snapshot | |
| run: | | |
| result=$(curl -s -d '{"geometry":{"type":"Polygon","coordinates":[[[83.96919250488281,28.194446860487773],[83.99751663208006,28.194446860487773],[83.99751663208006,28.214869548073377],[83.96919250488281,28.214869548073377],[83.96919250488281,28.194446860487773]]]}}' -H 'Content-Type: application/json' http://127.0.0.1:8000/v1/snapshot/) | |
| echo $result | |
| tail uvicorn.log | |
| tail worker.log | |
| task_link=$(echo "$result" | jq -r .track_link) | |
| echo curl "http://127.0.0.1:8000/v1${task_link}" | |
| curl "http://127.0.0.1:8000/v1${task_link}" |