Skip to content

fix(tasks): enhanced model training zipping by adding input image pa… #588

fix(tasks): enhanced model training zipping by adding input image pa…

fix(tasks): enhanced model training zipping by adding input image pa… #588

Workflow file for this run

name: Backend Build and Tests
on:
push:
branches:
- master
- develop
paths:
- "backend/**"
- ".github/workflows/backend_build.yml"
pull_request:
branches:
- master
paths:
- "backend/**"
- ".github/workflows/backend_build.yml"
jobs:
Build_on_ubuntu:
runs-on: ubuntu-latest
services:
postgres:
image: postgis/postgis:14-3.2
env:
# must specify password for PG Docker container image, see: https://registry.hub.docker.com/_/postgres?tab=description&page=1&name=10
POSTGRES_USER: admin
POSTGRES_PASSWORD: password
POSTGRES_DB: ai
ports:
- 5432:5432
# needed because the postgres container does not provide a healthcheck
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 2
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.8
uses: actions/setup-python@v5
with:
python-version: 3.8
- name: Clone Ramp
run: git clone https://github.com/kshitijrajsharma/ramp-code-fAIr.git ramp-code
- name: Install gdown
run: pip install gdown
- name: Download Basemodel
run: gdown --fuzzy https://drive.google.com/file/d/1YQsY61S_rGfJ_f6kLQq4ouYE2l3iRe1k/view?usp=sharing
- name: Unzip and Move Basemodel
run: unzip checkpoint.tf.zip -d ramp-code/ramp
- name: Install gdal
run: |
sudo apt-get update && sudo apt-get -y install gdal-bin libgdal-dev python3-gdal && sudo apt-get -y autoremove && sudo apt-get clean
pip install GDAL==$(gdal-config --version)
- name: Install ramp dependecies
run: |
cd ramp-code && cd colab && make install
- name: Install tensorflow
run: pip install tensorflow==2.9.2
- name: Install fair utilities
run: pip install hot-fair-utilities
- name: Install Psycopg2
run: |
sudo apt-get install python3-psycopg2
- 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: |
cd backend/
pip install -r requirements.txt
pip install coverage
pip install factory-boy
- name: Create env
run: |
cd backend/
export DATABASE_URL=postgis://admin:password@localhost:5432/ai
export RAMP_HOME="/home/runner/work/fAIr/fAIr"
export TRAINING_WORKSPACE="/home/runner/work/fAIr/fAIr/backend/training"
- name: Run celery worker
run: |
cd backend/
celery -A aiproject worker --loglevel=debug &
- name: Run flower dashboard
run: |
cd backend/
celery -A aiproject --broker=redis://localhost:6379/ flower &
- name: Fix gdal array
run: |
pip uninstall -y gdal
pip install numpy
pip install GDAL==$(gdal-config --version) --global-option=build_ext --global-option="-I/usr/include/gdal"
- name: Check Opencv version
run: |
pip freeze | grep opencv
pip install opencv-python-headless==4.7.0.68
- name: Run migrations
env:
TESTING_TOKEN: ${{ secrets.TESTING_TOKEN }}
OSM_CLIENT_ID: ${{ secrets.OSM_CLIENT_ID }}
OSM_CLIENT_SECRET: ${{ secrets.OSM_CLIENT_SECRET }}
OSM_SECRET_KEY: ${{ secrets.OSM_SECRET_KEY }}
run: |
cd backend/
python manage.py makemigrations
python manage.py makemigrations core
python manage.py makemigrations login
python manage.py migrate
python manage.py migrate login
python manage.py migrate core
- name: Run tests
env:
TESTING_TOKEN: ${{ secrets.TESTING_TOKEN }}
OSM_CLIENT_ID: ${{ secrets.OSM_CLIENT_ID }}
OSM_CLIENT_SECRET: ${{ secrets.OSM_CLIENT_SECRET }}
OSM_SECRET_KEY: ${{ secrets.OSM_SECRET_KEY }}
run: |
cd backend/
coverage run manage.py test tests
# enable coverage report with this : coverage report