-
-
Notifications
You must be signed in to change notification settings - Fork 61
136 lines (118 loc) · 4.43 KB
/
backend_build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
name: Backend Build and Tests
on:
push:
branches:
- master
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
coverage report