-
Notifications
You must be signed in to change notification settings - Fork 0
123 lines (103 loc) · 3.22 KB
/
ci.yml
File metadata and controls
123 lines (103 loc) · 3.22 KB
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
name: CI
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
jobs:
lint:
name: Lint Python Code
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
- name: Install dependencies
working-directory: backend
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
- name: Run ruff
run: |
cd backend && ruff check --fix src/ || true
if [ -d "ai" ]; then ruff check --fix ai/ || true; fi
if [ -d "scripts" ]; then ruff check --fix scripts/ || true; fi
- name: Run mypy
working-directory: backend
run: mypy src/ ai/ || true # Continue on error for now, strict mode disabled
test:
name: Run Tests
runs-on: ubuntu-latest
needs: lint
services:
postgres:
image: postgis/postgis:16-3.4
env:
POSTGRES_USER: aethera
POSTGRES_PASSWORD: aethera
POSTGRES_DB: aethera
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y gdal-bin libgdal-dev python3-gdal
- name: Install Python dependencies
working-directory: backend
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
- name: Set GDAL environment
run: |
export GDAL_DATA=$(gdal-config --datadir)
echo "GDAL_DATA=$GDAL_DATA" >> $GITHUB_ENV
- name: Initialize database
env:
POSTGRES_DSN: postgresql://aethera:aethera@localhost:5432/aethera
working-directory: backend
run: |
python -m src.db.init_db --dsn $POSTGRES_DSN || true
- name: Run tests with pytest
working-directory: backend
env:
POSTGRES_DSN: postgresql://aethera:aethera@localhost:5432/aethera
run: |
pytest tests/ -v --cov=src --cov-report=xml --cov-report=term || true
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
file: ./backend/coverage.xml
flags: backend
name: codecov-umbrella
fail_ci_if_error: false
docker-build:
name: Build Docker Images
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build PostgreSQL image
uses: docker/build-push-action@v5
with:
context: .
file: ./docker/postgres/Dockerfile
push: false
tags: aethera-postgres:latest
cache-from: type=gha
cache-to: type=gha,mode=max