Repository navigation
111 lines (105 loc) · 3.7 KB
/
Copy pathci.yml
File metadata and controls
111 lines (105 loc) · 3.7 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
name: CI
on:
push:
branches: ['main']
pull_request:
branches: ['main']
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
unit-test:
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
with:
# Must satisfy package.json engines (undici 8 needs >=22.19).
node-version: 24
cache: npm
- run: npm ci
- run: npm run typecheck
- run: npm run build
- run: npm test -- --runInBand
shellcheck:
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: read
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
- name: bash syntax check
run: |
bash -n entrypoint.sh
bash -n tests/test-integration.sh
bash -n tests/test-streaming-real.sh
- name: Run ShellCheck
run: |
if ! command -v shellcheck >/dev/null; then
sudo apt-get update && sudo apt-get install -y shellcheck
fi
shellcheck -S warning entrypoint.sh tests/test-integration.sh tests/test-streaming-real.sh
ai-bot-lint:
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: read
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: "3.12"
- name: Validate AI bot (json + py_compile + unittest)
run: |
python3 -c "import json; json.load(open('github_bot/config/bot_config.json')); json.load(open('github_bot/config/LLM_config.example.json')); print('json OK')"
python3 -m py_compile github_bot/src/*.py tests/test_ai_bot.py
PYTHONPATH=github_bot/src python3 -m unittest tests.test_ai_bot -v
- name: Guard against committed bot secrets
run: |
if git ls-files | grep -E '(^|/)LLM_config\.json$|(^|/)\.env(\..+)?$|(^|/)config\.json$' | grep -v '\.env\.example$'; then
echo "Blocked: filled-in secrets must not be committed." >&2
exit 1
fi
docker-build:
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: read
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
- uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f # v3
- uses: docker/build-push-action@ca052bb54ab0790a636c9b5f226502c73d547a25 # v5
with:
context: .
file: ./Dockerfile
push: false
load: true
tags: opencode2api:ci
cache-from: type=gha
cache-to: type=gha,mode=max
# Minimal smoke: run the compiled proxy directly (bypass opencode
# backend wait) and probe the auth-free shallow /health endpoint.
# `node dist/index.js` hits the entrypoint else-branch
# (exec gosu node "$@") so no backend credentials are needed.
- name: Smoke test built image (/health)
run: |
docker run -d --name opencode2api-smoke -p 10000:10000 opencode2api:ci node dist/index.js
ok=0
for i in $(seq 1 30); do
if curl -sf http://127.0.0.1:10000/health; then
echo
echo "smoke: /health 200"
ok=1
break
fi
sleep 2
done
docker logs opencode2api-smoke || true
docker rm -f opencode2api-smoke || true
test "$ok" = "1"