-
Notifications
You must be signed in to change notification settings - Fork 1
115 lines (97 loc) · 2.82 KB
/
Copy pathbackend.yml
File metadata and controls
115 lines (97 loc) · 2.82 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
name: Backend CI
on:
push:
branches: [main]
paths:
- "src/backend/**"
- "pyproject.toml"
- "uv.lock"
- ".github/workflows/backend.yml"
pull_request:
branches: [main]
paths:
- "src/backend/**"
- "pyproject.toml"
- "uv.lock"
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
version: "latest"
- name: Set up Python
run: uv python install 3.12
- name: Install dependencies
run: uv sync --frozen
- name: Run ruff linter
run: uv run ruff check src/backend
- name: Run ruff formatter check
run: uv run ruff format --check src/backend
test:
name: Test
runs-on: ubuntu-latest
needs: lint
# Set working directory to root to follow pyproject.toml logic
services:
postgres:
image: postgres:15-alpine
env:
POSTGRES_USER: test
POSTGRES_PASSWORD: test
POSTGRES_DB: interpres_test
ports:
- 5432:5432
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
version: "latest"
- name: Set up Python
run: uv python install 3.12
- name: Install dependencies
run: uv sync --frozen
- name: Run tests
env:
DATABASE_URL: postgresql://test:test@localhost:5432/interpres_test
LANCEDB_PATH: ./lancedb_data
run: uv run pytest --cov=src/backend --cov-report=xml --junitxml=junit.xml
# Use Railway so no need to activate this step
# build-push:
# name: Build & Push Container
# runs-on: ubuntu-latest
# needs: test
# permissions:
# contents: read
# packages: write
# steps:
# - uses: actions/checkout@v4
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v3
# - name: Log in to GitHub Container Registry
# uses: docker/login-action@v3
# with:
# registry: ghcr.io
# username: ${{ github.actor }}
# password: ${{ secrets.GITHUB_TOKEN }}
# - name: Lowercase REPO
# run: |
# echo "REPO=${GITHUB_REPOSITORY,,}" >>${GITHUB_ENV}
# - name: Build and push Docker image
# uses: docker/build-push-action@v5
# with:
# context: .
# file: src/backend/Dockerfile
# push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
# tags: |
# ghcr.io/${{ env.REPO }}/backend:latest
# ghcr.io/${{ env.REPO }}/backend:${{ github.sha }}