forked from hotosm/fAIr
-
Notifications
You must be signed in to change notification settings - Fork 0
91 lines (79 loc) · 2.45 KB
/
test_backend_build.yml
File metadata and controls
91 lines (79 loc) · 2.45 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
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