Skip to content

Merge pull request #276 from hotosm/actions/black #990

Merge pull request #276 from hotosm/actions/black

Merge pull request #276 from hotosm/actions/black #990

Workflow file for this run

name: Unit Test
on:
push:
paths-ignore:
- "infra/**"
branches:
- master
- develop
pull_request:
branches:
- master
- develop
jobs:
deploy:
runs-on: ubuntu-latest
services:
postgres:
image: postgis/postgis:14-3.3
env:
POSTGRES_PASSWORD: admin
POSTGRES_DB: raw
ports:
- 5434:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 2
env:
PGPASSWORD: admin
PGDATABASE: raw
PGPORT: 5434
PGHOST: localhost
PGUSER: postgres
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
ALLOW_BIND_ZIP_FILTER: ${{ secrets.ALLOW_BIND_ZIP_FILTER }}
APP_SECRET_KEY: ${{ secrets.APP_SECRET_KEY }}
ENABLE_HDX_EXPORTS: ${{ secrets.ENABLE_HDX_EXPORTS }}
ENABLE_CUSTOM_EXPORTS: True
ENABLE_POLYGON_STATISTICS_ENDPOINTS: ${{ secrets.ENABLE_POLYGON_STATISTICS_ENDPOINTS }}
POLYGON_STATISTICS_API_URL: ${{ secrets.POLYGON_STATISTICS_API_URL }}
HDX_API_KEY: ${{ secrets.HDX_API_KEY }}
HDX_MAINTAINER: ${{ secrets.HDX_MAINTAINER }}
HDX_OWNER_ORG: ${{ secrets.HDX_OWNER_ORG }}
LOGIN_REDIRECT_URI: ${{ secrets.LOGIN_REDIRECT_URI }}
OSM_CLIENT_ID: ${{ secrets.OSM_CLIENT_ID }}
OSM_CLIENT_SECRET: ${{ secrets.OSM_CLIENT_SECRET }}
FILE_UPLOAD_METHOD: ${{ secrets.FILE_UPLOAD_METHOD }}
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.11
uses: actions/setup-python@v1
with:
python-version: 3.11
- name: Insert sample db data
run: |
export PGPASSWORD='admin';
psql -U postgres -h localhost -p 5434 raw < tests/fixtures/pokhara.sql
psql -U postgres -h localhost -p 5434 raw < backend/sql/countries.sql
psql -U postgres -h localhost -p 5434 raw < API/data/tables.sql
psql -U postgres -h localhost -p 5434 raw < API/data/hdx.sql
- name: Install gdal
run: sudo apt-get update && 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: |
python -m pip install --upgrade pip
pip install -r requirements.txt
python setup.py install
- name: Launch ondemand Worker
run: |
celery --app API.api_worker worker --loglevel=INFO --queues='raw_ondemand' &
- name: Launch daemon Worker
run: |
celery --app API.api_worker worker --loglevel=INFO --queues='raw_daemon' &
- name: Run Tests
run: |
python -m pytest -v -s