-
Notifications
You must be signed in to change notification settings - Fork 20
150 lines (133 loc) · 4.72 KB
/
pr-testing.yml
File metadata and controls
150 lines (133 loc) · 4.72 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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
name: PR to Testing Branch
on:
pull_request:
branches:
- testing
types: [opened, synchronize, reopened]
env:
REGISTRY: registry.digitalocean.com/dbr-cr
PYTHON_VERSION: "3.11"
jobs:
lint-and-type-check:
name: Lint & Type Check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install dependencies
run: |
cd echo/server
pip install -r requirements.lock
- name: Run Ruff Lint
run: |
cd echo/server
ruff check .
- name: Run MyPy Type Check
run: |
cd echo/server
mypy dembrane/ --ignore-missing-imports
unit-tests:
name: Unit Tests
runs-on: ubuntu-latest
env:
# Required environment variables for config.py
DIRECTUS_SECRET: test-secret
DIRECTUS_TOKEN: test-token
DATABASE_URL: postgresql+psycopg://test:test@localhost:5432/test
REDIS_URL: redis://localhost:6379
OPENAI_API_KEY: sk-test-key
ANTHROPIC_API_KEY: sk-ant-test-key
STORAGE_S3_BUCKET: test-bucket
STORAGE_S3_ENDPOINT: https://test.endpoint.com
STORAGE_S3_KEY: test-key
STORAGE_S3_SECRET: test-secret
SMALL_LITELLM_MODEL: gpt-4o-mini
SMALL_LITELLM_API_KEY: test-key
SMALL_LITELLM_API_VERSION: "2024-06-01"
SMALL_LITELLM_API_BASE: https://api.openai.com/v1
MEDIUM_LITELLM_MODEL: gpt-4o
MEDIUM_LITELLM_API_KEY: test-key
MEDIUM_LITELLM_API_VERSION: "2024-06-01"
MEDIUM_LITELLM_API_BASE: https://api.openai.com/v1
LARGE_LITELLM_MODEL: gpt-4o
LARGE_LITELLM_API_KEY: test-key
LARGE_LITELLM_API_VERSION: "2024-06-01"
LARGE_LITELLM_API_BASE: https://api.openai.com/v1
LIGHTRAG_LITELLM_MODEL: gpt-4o-mini
LIGHTRAG_LITELLM_API_KEY: test-key
LIGHTRAG_LITELLM_API_VERSION: "2024-06-01"
LIGHTRAG_LITELLM_API_BASE: https://api.openai.com/v1
LIGHTRAG_LITELLM_AUDIOMODEL_MODEL: gpt-4o-audio
LIGHTRAG_LITELLM_AUDIOMODEL_API_BASE: https://api.openai.com/v1
LIGHTRAG_LITELLM_AUDIOMODEL_API_KEY: test-key
LIGHTRAG_LITELLM_AUDIOMODEL_API_VERSION: "2024-06-01"
LIGHTRAG_LITELLM_TEXTSTRUCTUREMODEL_MODEL: gpt-4o-mini
LIGHTRAG_LITELLM_TEXTSTRUCTUREMODEL_API_BASE: https://api.openai.com/v1
LIGHTRAG_LITELLM_TEXTSTRUCTUREMODEL_API_KEY: test-key
LIGHTRAG_LITELLM_TEXTSTRUCTUREMODEL_API_VERSION: "2024-06-01"
LIGHTRAG_LITELLM_EMBEDDING_MODEL: text-embedding-ada-002
LIGHTRAG_LITELLM_EMBEDDING_API_BASE: https://api.openai.com/v1
LIGHTRAG_LITELLM_EMBEDDING_API_KEY: test-key
LIGHTRAG_LITELLM_EMBEDDING_API_VERSION: "2024-06-01"
LIGHTRAG_LITELLM_INFERENCE_MODEL: claude-3-5-sonnet
LIGHTRAG_LITELLM_INFERENCE_API_KEY: test-key
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install dependencies
run: |
cd echo/server
pip install -r requirements.lock
- name: Run Unit Tests
run: |
cd echo/server
pytest tests/ -v -m "not integration and not slow and not smoke" --maxfail=3
build-images:
name: Build Docker Images (validation only)
runs-on: ubuntu-latest
needs: [lint-and-type-check, unit-tests]
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build API Server Image
uses: docker/build-push-action@v5
with:
context: ./echo/server
file: ./echo/server/Dockerfile
push: false
tags: ${{ env.REGISTRY }}/dbr-echo-server:pr-${{ github.event.pull_request.number }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build Directus Image
uses: docker/build-push-action@v5
with:
context: ./echo/directus
file: ./echo/directus/Dockerfile
push: false
tags: ${{ env.REGISTRY }}/dbr-echo-directus:pr-${{ github.event.pull_request.number }}
cache-from: type=gha
cache-to: type=gha,mode=max
auto-merge:
name: Auto-merge PR
runs-on: ubuntu-latest
needs: [build-images]
permissions:
pull-requests: write
contents: write
steps:
- name: Auto-merge PR
uses: pascalgn/automerge-action@v0.16.2
env:
GITHUB_TOKEN: ${{ secrets.GH_AUTO_MERGE_TOKEN }}
MERGE_LABELS: ""
MERGE_METHOD: "squash"
MERGE_COMMIT_MESSAGE: "pull-request-title"
MERGE_RETRIES: 3
MERGE_RETRY_SLEEP: 10000