Skip to content

Enhance Docker

Enhance Docker #296

Workflow file for this run

name: Backend Build
on:
push:
branches:
- master
pull_request:
branches:
- master
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@v2
- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
python-version: 3.8
- name: Get my current working dir
run: pwd
- name: Test env vars for python
env:
TESTING_TOKEN: ${{ secrets.TESTING_TOKEN }}
run: python -c "import os; print(os.environ['TESTING_TOKEN'])"
- 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/1wvJhkiOrSlHmmvJ0avkAdu9sslFf5_I0/view?usp=sharing
- name: Unzip and Move Basemodel
run: unzip checkpoint.tf.zip -d ramp-code/ramp
- name: Install gdal
run: |
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) --global-option=build_ext --global-option="-I/usr/include/gdal"
- name: Install ramp dependecies
run: |
cd ramp-code && cd colab && make install
- name: Install fair utilities
run: pip install hot-fair-utilities==1.0.41
- 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
- name: Creating env
run: |
cd backend/
mv sample_env .env
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: Run tests
env:
TESTING_TOKEN: ${{ secrets.TESTING_TOKEN }}
run: |
cd backend/
export TESTING_TOKEN=$TESTING_TOKEN
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