Skip to content

feat(typescript): migrate codebase to TypeScript #2

feat(typescript): migrate codebase to TypeScript

feat(typescript): migrate codebase to TypeScript #2

Workflow file for this run

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:
node-version: 20
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
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"