Repository navigation
docs(readme): trim to principles and cross-link docs #65
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" |