music on atproto
plyr.fm
1name: backend tests
2
3on:
4 pull_request:
5 paths:
6 - "backend/src/backend/**"
7 - "backend/tests/**"
8 - "backend/pyproject.toml"
9 - "backend/uv.lock"
10 - ".github/workflows/test-backend.yml"
11
12permissions:
13 contents: read
14
15jobs:
16 test:
17 timeout-minutes: 10
18 runs-on: ubuntu-latest
19
20 services:
21 postgres:
22 image: postgres:14-alpine
23 env:
24 POSTGRES_USER: relay_test
25 POSTGRES_PASSWORD: relay_test
26 POSTGRES_DB: relay_test
27 ports:
28 - 5432:5432
29 options: >-
30 --health-cmd pg_isready
31 --health-interval 10s
32 --health-timeout 5s
33 --health-retries 5
34
35 redis:
36 image: redis:7-alpine
37 ports:
38 - 6379:6379
39 options: >-
40 --health-cmd "redis-cli ping"
41 --health-interval 10s
42 --health-timeout 5s
43 --health-retries 5
44
45 steps:
46 - uses: actions/checkout@v5
47
48 - name: set up python
49 uses: actions/setup-python@v5
50 with:
51 python-version: "3.12"
52
53 - name: install uv
54 uses: astral-sh/setup-uv@v7
55 with:
56 enable-cache: true
57 cache-dependency-glob: "backend/uv.lock"
58
59 - name: install dependencies
60 run: cd backend && uv sync --locked
61
62 - name: run tests
63 env:
64 DATABASE_URL: postgresql+asyncpg://relay_test:relay_test@localhost:5432/relay_test
65 DOCKET_URL: redis://localhost:6379
66 run: cd backend && uv run pytest tests/ -n auto
67
68 - name: prune uv cache
69 if: always()
70 run: uv cache prune --ci