Repository navigation
239 lines (206 loc) · 8.66 KB
/
Copy pathci.yml
File metadata and controls
239 lines (206 loc) · 8.66 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
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
name: CI
# Pull requests only. GitHub runs PR checks on the merge result, so a push
# build on main would re-test content that the release / feature PR already
# proved green.
on:
pull_request:
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
quality:
name: "Python ${{ matrix.python-version }}"
runs-on: ubuntu-latest
# Post-release main → develop sync PRs carry main's already-tested tree and
# are auto-merged by the bot before checks finish. See sync-main-to-develop.
if: ${{ !startsWith(github.head_ref, 'chore/sync-develop-after-') }}
strategy:
fail-fast: false
matrix:
python-version: ["3.12"]
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v4
with:
enable-cache: true
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: make install
- name: Lint
run: make lint
- name: Type check
run: make typecheck
- name: Test
run: make test PYTEST_JOBS=logical
dashboard:
name: Dashboard
runs-on: ubuntu-latest
if: ${{ !startsWith(github.head_ref, 'chore/sync-develop-after-') }}
defaults:
run:
working-directory: dashboard
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v5
with:
# Same Node as deploy/docker/Dockerfile and release.yml.
node-version: "20"
cache: npm
cache-dependency-path: dashboard/package-lock.json
- name: Install dependencies
run: npm ci
- name: Type check
run: npx tsc -b
- name: Test
run: npm test
# `make install` follows uv.lock. A merged PR can still fail
# `pip install octop` when dependency ranges resolve differently in a clean
# environment. Build the wheel, install it with pip, and verify the
# published console command from an empty environment.
command-install:
name: Command install (${{ matrix.os }})
runs-on: ${{ matrix.os }}
if: ${{ !startsWith(github.head_ref, 'chore/sync-develop-after-') }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v4
with:
python-version: "3.12"
- name: Build wheel
run: uv build --wheel
- name: Install the wheel with pip (Linux)
if: runner.os == 'Linux'
run: |
set -euo pipefail
uv venv --no-project --python 3.12 --seed /tmp/octop-install
wheels=(dist/octop-*.whl)
if [ "${#wheels[@]}" -ne 1 ]; then
echo "expected one wheel, found: ${wheels[*]}"
exit 1
fi
/tmp/octop-install/bin/python -m pip install --upgrade pip
/tmp/octop-install/bin/python -m pip install "${wheels[0]}"
- name: Install the wheel with pip (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
$ErrorActionPreference = "Stop"
uv venv --no-project --python 3.12 --seed .octop-install
$wheels = @(Get-ChildItem -Path dist -Filter "octop-*.whl")
if ($wheels.Count -ne 1) {
throw "expected one wheel, found: $($wheels.Name -join ', ')"
}
.\.octop-install\Scripts\python.exe -m pip install --upgrade pip
.\.octop-install\Scripts\python.exe -m pip install $wheels[0].FullName
- name: Verify the installed command (Linux)
if: runner.os == 'Linux'
run: /tmp/octop-install/bin/octop --help
- name: Verify the installed command (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: .\.octop-install\Scripts\octop.exe --help
helm:
name: Helm chart
runs-on: ubuntu-latest
if: ${{ !startsWith(github.head_ref, 'chore/sync-develop-after-') }}
steps:
- uses: actions/checkout@v4
- name: Set up Helm
uses: azure/setup-helm@v4
with:
version: v3.17.3
- name: Lint and render
run: |
set -euo pipefail
helm lint deploy/helm/octop
helm template octop deploy/helm/octop -n octop >/dev/null
helm template octop deploy/helm/octop -n octop \
-f deploy/helm/octop/values.example.yaml >/dev/null
helm template octop deploy/helm/octop -n octop \
--set postgresql.enabled=false \
--set database.host=pg.example.com >/dev/null
if helm template octop deploy/helm/octop -n octop --set postgresql.enabled=false >/dev/null 2>/tmp/helm-err; then
echo "expected a missing database.host to fail"
exit 1
fi
test-windows:
name: Windows / Python 3.12
runs-on: windows-latest
if: ${{ !startsWith(github.head_ref, 'chore/sync-develop-after-') }}
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v4
with:
enable-cache: true
python-version: "3.12"
- name: Install dependencies
run: make install
- name: Lint
run: make lint
- name: Type check
run: make typecheck
- name: Test
run: make test PYTEST_JOBS=logical
live-tests:
name: "Live tests (real credentials)"
runs-on: ubuntu-latest
# Only the main repo may access secrets; fork PRs get none and must skip.
if: >-
github.event.pull_request.head.repo.full_name == github.repository &&
!startsWith(github.head_ref, 'chore/sync-develop-after-')
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v4
with:
enable-cache: true
python-version: "3.12"
- name: Install dependencies
run: make install
# Secrets are injected as env vars. Missing secrets => empty values =>
# the live tests auto-skip (CI stays green). Never `echo`/print secrets.
- name: Run live tests
env:
OPENAI_API_KEY: ${{ secrets.LIVE_OPENAI_API_KEY }}
OPENAI_BASE_URL: ${{ secrets.LIVE_OPENAI_BASE_URL }}
OPENAI_MODEL_NAME: ${{ secrets.LIVE_OPENAI_MODEL_NAME }}
OSS_KIND: ${{ secrets.LIVE_OSS_KIND }}
OSS_ENDPOINT: ${{ secrets.LIVE_OSS_ENDPOINT }}
OSS_ACCESS_KEY: ${{ secrets.LIVE_OSS_ACCESS_KEY }}
OSS_SECRET_KEY: ${{ secrets.LIVE_OSS_SECRET_KEY }}
OSS_BUCKET: ${{ secrets.LIVE_OSS_BUCKET }}
OSS_REGION: ${{ secrets.LIVE_OSS_REGION }}
OSS_PREFIX: ${{ secrets.LIVE_OSS_PREFIX }}
ALI_OSS_KIND: ${{ secrets.LIVE_ALI_OSS_KIND }}
ALI_OSS_ENDPOINT: ${{ secrets.LIVE_ALI_OSS_ENDPOINT }}
ALI_OSS_ACCESS_KEY: ${{ secrets.LIVE_ALI_OSS_ACCESS_KEY }}
ALI_OSS_SECRET_KEY: ${{ secrets.LIVE_ALI_OSS_SECRET_KEY }}
ALI_OSS_BUCKET: ${{ secrets.LIVE_ALI_OSS_BUCKET }}
ALI_OSS_REGION: ${{ secrets.LIVE_ALI_OSS_REGION }}
ALI_OSS_PREFIX: ${{ secrets.LIVE_ALI_OSS_PREFIX }}
CONNECTOR_TENCENT_DOCS_TOKEN: ${{ secrets.LIVE_CONNECTOR_TENCENT_DOCS_TOKEN }}
CONNECTOR_TENCENT_MEETING_TOKEN: ${{ secrets.LIVE_CONNECTOR_TENCENT_MEETING_TOKEN }}
CONNECTOR_TENCENT_WEIYUN_TOKEN: ${{ secrets.LIVE_CONNECTOR_TENCENT_WEIYUN_TOKEN }}
CONNECTOR_YOUDAO_NOTE_TOKEN: ${{ secrets.LIVE_CONNECTOR_YOUDAO_NOTE_TOKEN }}
CONNECTOR_TENCENT_NEWS_TOKEN: ${{ secrets.LIVE_CONNECTOR_TENCENT_NEWS_TOKEN }}
CONNECTOR_WECHAT_READING_TOKEN: ${{ secrets.LIVE_CONNECTOR_WECHAT_READING_TOKEN }}
CONNECTOR_QQ_MUSIC_TOKEN: ${{ secrets.LIVE_CONNECTOR_QQ_MUSIC_TOKEN }}
CONNECTOR_FLIGGY_TOKEN: ${{ secrets.LIVE_CONNECTOR_FLIGGY_TOKEN }}
CONNECTOR_BAIDU_MAP_TOKEN: ${{ secrets.LIVE_CONNECTOR_BAIDU_MAP_TOKEN }}
CONNECTOR_CTRIP_WENDAO_TOKEN: ${{ secrets.LIVE_CONNECTOR_CTRIP_WENDAO_TOKEN }}
CONNECTOR_TENCENT_IMA_TOKEN: ${{ secrets.LIVE_CONNECTOR_TENCENT_IMA_TOKEN }}
CONNECTOR_TENCENT_IMA_CLIENT_ID: ${{ secrets.LIVE_CONNECTOR_TENCENT_IMA_CLIENT_ID }}
CONNECTOR_TENCENT_LEXIANG_TOKEN: ${{ secrets.LIVE_CONNECTOR_TENCENT_LEXIANG_TOKEN }}
CONNECTOR_TENCENT_LEXIANG_COMPANY_FROM: ${{ secrets.LIVE_CONNECTOR_TENCENT_LEXIANG_COMPANY_FROM }}
CONNECTOR_MEITUAN_TRAVEL_TOKEN: ${{ secrets.LIVE_CONNECTOR_MEITUAN_TRAVEL_TOKEN }}
CONNECTOR_YUANDIAN_TOKEN: ${{ secrets.LIVE_CONNECTOR_YUANDIAN_TOKEN }}
# Channel probes (WeChat iLink + Feishu)
WEIXIN_BOT_UIN: ${{ secrets.LIVE_WEIXIN_BOT_UIN }}
WEIXIN_TOKEN: ${{ secrets.LIVE_WEIXIN_TOKEN }}
WEIXIN_BASE_URL: ${{ secrets.LIVE_WEIXIN_BASE_URL }}
FEISHU_APP_ID: ${{ secrets.LIVE_FEISHU_APP_ID }}
FEISHU_APP_SECRET: ${{ secrets.LIVE_FEISHU_APP_SECRET }}
run: make test-live