-
Notifications
You must be signed in to change notification settings - Fork 1.1k
feat(examples): add CodeBuddy Code CLI integration example(refs #644 ) #996
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
2fa0a4c
e1b13fa
eba03f5
82657fe
3b4abd2
2cc075c
7b77eaa
7070730
4840153
da1cc65
392e564
c0d2152
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | |||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,80 @@ | |||||||||||||||||
| # Copyright (c) 2026 Tencent Inc. | |||||||||||||||||
| # SPDX-License-Identifier: Apache-2.0 | |||||||||||||||||
|
|
|||||||||||||||||
| name: codebuddy-integration | |||||||||||||||||
|
|
|||||||||||||||||
| on: | |||||||||||||||||
| pull_request: | |||||||||||||||||
| paths: | |||||||||||||||||
| - "examples/codebuddy-integration/**" | |||||||||||||||||
| - "docs/**/integrations/codebuddy.md" | |||||||||||||||||
| - ".github/workflows/codebuddy-integration.yml" | |||||||||||||||||
| push: | |||||||||||||||||
| branches: [master] | |||||||||||||||||
|
|
|||||||||||||||||
| jobs: | |||||||||||||||||
| static: | |||||||||||||||||
| name: Static checks (compile + unit tests) | |||||||||||||||||
| runs-on: ubuntu-latest | |||||||||||||||||
| steps: | |||||||||||||||||
| - uses: actions/checkout@v4 | |||||||||||||||||
|
|
|||||||||||||||||
| - name: Set up Python | |||||||||||||||||
| uses: actions/setup-python@v5 | |||||||||||||||||
| with: | |||||||||||||||||
| python-version: "3.11" | |||||||||||||||||
|
|
|||||||||||||||||
| - name: Install dependencies | |||||||||||||||||
| working-directory: examples/codebuddy-integration | |||||||||||||||||
| run: pip install -r requirements.txt | |||||||||||||||||
|
|
|||||||||||||||||
| - name: Compile host driver scripts | |||||||||||||||||
| working-directory: examples/codebuddy-integration | |||||||||||||||||
| run: | | |||||||||||||||||
| python3 -m py_compile env_utils.py _codebuddy_common.py \ | |||||||||||||||||
| run_codebuddy.py resume_codebuddy.py network_policy.py | |||||||||||||||||
|
|
|||||||||||||||||
| - name: Run unit tests | |||||||||||||||||
| working-directory: examples/codebuddy-integration | |||||||||||||||||
| run: python3 -m pytest tests/ -v | |||||||||||||||||
|
|
|||||||||||||||||
| - name: Smoke-check --help output | |||||||||||||||||
| working-directory: examples/codebuddy-integration | |||||||||||||||||
| run: | | |||||||||||||||||
| python3 run_codebuddy.py --help | |||||||||||||||||
| python3 resume_codebuddy.py --help | |||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Critical: CI test discovery silently skips 3 out of 4 test files The CI uses
Only ~752 lines of Fix: Change to |
|||||||||||||||||
| python3 network_policy.py --help | |||||||||||||||||
|
|
|||||||||||||||||
| dockerfile: | |||||||||||||||||
| name: Dockerfile builds cleanly | |||||||||||||||||
| runs-on: ubuntu-latest | |||||||||||||||||
| steps: | |||||||||||||||||
| - uses: actions/checkout@v4 | |||||||||||||||||
|
|
|||||||||||||||||
| - name: Set up Buildx | |||||||||||||||||
| uses: docker/setup-buildx-action@v3 | |||||||||||||||||
|
|
|||||||||||||||||
| - name: Build (cache miss is fine; --load is just for smoke) | |||||||||||||||||
| uses: docker/build-push-action@v6 | |||||||||||||||||
| with: | |||||||||||||||||
| context: examples/codebuddy-integration | |||||||||||||||||
| push: false | |||||||||||||||||
| load: true | |||||||||||||||||
| tags: codebuddy-cube:ci | |||||||||||||||||
| cache-from: type=gha | |||||||||||||||||
| cache-to: type=gha,mode=max | |||||||||||||||||
|
|
|||||||||||||||||
| - name: codebuddy --version inside the image | |||||||||||||||||
| run: | | |||||||||||||||||
| cid=$(docker run -d --rm codebuddy-cube:ci) | |||||||||||||||||
| docker exec "$cid" codebuddy --version | |||||||||||||||||
| # envd /health reachable means the readiness probe will succeed; | |||||||||||||||||
| # add a retry loop because envd may still be booting on cold cache. | |||||||||||||||||
| for i in $(seq 30); do | |||||||||||||||||
| if docker exec "$cid" curl -fsS -o /dev/null \ | |||||||||||||||||
| http://127.0.0.1:49983/health; then | |||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Potential orphan container on exec failure If Consider adding a trap at the top of this cid=""
cleanup() { [ -n "$cid" ] && docker rm -f "$cid" 2>/dev/null || true; }
trap cleanup EXIT
cid=$(docker run -d --rm codebuddy-cube:ci)This guarantees cleanup regardless of which command fails.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This job runs on GitHub-hosted ubuntu-latest runners, which are fully ephemeral — the VM is destroyed once the job finishes, so an orphaned container here doesn't persist or accumulate across runs. Since this is the only container operation in the static job, I'll leave it as-is for now, but agree the trap pattern would be worth adding if this ever moves to a self-hosted runner or if more container steps are added to this job later. |
|||||||||||||||||
| break | |||||||||||||||||
| fi | |||||||||||||||||
| sleep 1 | |||||||||||||||||
| done | |||||||||||||||||
| docker rm -f "$cid" | |||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.