Skip to content

Refactor : Backend API to integrate zenml integrations #234

Refactor : Backend API to integrate zenml integrations

Refactor : Backend API to integrate zenml integrations #234

name: Backend lint and tests
on:
push:
branches:
- master
- develop
paths:
- "backend/**"
- ".github/workflows/test_backend_build.yml"
- ".pre-commit-config.yaml"
pull_request:
branches:
- master
- develop
paths:
- "backend/**"
- ".github/workflows/test_backend_build.yml"
- ".pre-commit-config.yaml"
jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
enable-cache: true
cache-dependency-glob: "backend/uv.lock"
- name: Install backend dependencies
working-directory: ./backend
run: uv sync
- name: Run pre-commit
run: uv run --directory backend pre-commit run --all-files --show-diff-on-failure
test:
runs-on: ubuntu-latest
needs: lint
services:
postgres:
image: postgis/postgis:17-3.5
env:
POSTGRES_USER: admin
POSTGRES_PASSWORD: password
POSTGRES_DB: ai
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
permissions:
id-token: write
steps:
- uses: actions/checkout@v5
- uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
with:
enable-cache: true
cache-dependency-glob: "backend/uv.lock"
- 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
- name: Install dependencies
working-directory: ./backend
run: uv sync
- name: Run migrations and tests
env:
DATABASE_URL: postgis://admin:password@localhost:5432/ai
SECRET_KEY: ci-test-secret-key-not-for-production-use-only
DEBUG: "True"
FRONTEND_URL: http://localhost:3500
API_BASE_URL: http://localhost:8000/api/v1
AUTH_PROVIDER: dev
FAIR_DEV_TOKEN: ci-test-token-min-32-chars-long-xxxxxx
ALLOWED_HOSTS: localhost,127.0.0.1,testserver
BUCKET_NAME: fair-ci-test
AWS_ACCESS_KEY_ID: ci-access-key
AWS_SECRET_ACCESS_KEY: ci-secret-key
working-directory: ./backend
run: |
uv run python manage.py migrate
uv run pytest