Feature : Docker optimization and offline prediction #679
Workflow file for this run
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: Backend Build and Tests | |
| on: | |
| push: | |
| branches: | |
| - master | |
| - develop | |
| paths: | |
| - "backend/**" | |
| - ".github/workflows/backend_build.yml" | |
| pull_request: | |
| branches: | |
| - master | |
| - develop | |
| 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: | |
| - name: Check out code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python 3.8 | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.8 | |
| cache: "pip" | |
| - name: Clone Ramp | |
| run: git clone https://github.com/kshitijrajsharma/ramp-code-fAIr.git ramp-code | |
| - name: Install uv | |
| run: pip install uv | |
| - name: Create env | |
| working-directory: ./backend | |
| run: | | |
| 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 | |
| working-directory: ./backend | |
| run: celery -A aiproject worker --loglevel=debug -Q ramp_training,yolo_training & | |
| - name: Run flower dashboard | |
| working-directory: ./backend | |
| run: celery -A aiproject --broker=redis://localhost:6379/ flower & | |
| - 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 }} | |
| working-directory: ./backend | |
| run: | | |
| 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 }} | |
| working-directory: ./backend | |
| run: coverage run manage.py test tests | |
| # enable coverage report with this : coverage report |