Skip to content

OpenCode compatibility #17

OpenCode compatibility

OpenCode compatibility #17

Workflow file for this run

name: OpenCode compatibility
on:
schedule:
- cron: "17 2 * * *"
workflow_dispatch:
push:
branches: [main]
paths:
- ".github/workflows/compatibility.yml"
- "package.json"
- "bun.lock"
- "src/**"
- "scripts/resolve-opencode-compatibility.ts"
- "scripts/test-opencode-server.ts"
pull_request:
paths:
- ".github/workflows/compatibility.yml"
- "package.json"
- "bun.lock"
- "src/**"
- "scripts/resolve-opencode-compatibility.ts"
- "scripts/test-opencode-server.ts"
permissions:
contents: read
concurrency:
group: opencode-compatibility-${{ github.ref }}
cancel-in-progress: true
jobs:
discover:
name: Resolve supported OpenCode targets
runs-on: ubuntu-22.04
outputs:
targets: ${{ steps.targets.outputs.targets }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
with:
bun-version: 1.3.14
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 22
package-manager-cache: false
- name: Resolve current and five prior minor lines
id: targets
shell: bash
run: |
set -euo pipefail
targets="$(bun scripts/resolve-opencode-compatibility.ts)"
echo "targets=$targets" >> "$GITHUB_OUTPUT"
echo "Testing OpenCode targets: \`$targets\`" >> "$GITHUB_STEP_SUMMARY"
compatibility:
name: OpenCode ${{ matrix.target.version }} (${{ matrix.target.line }})
needs: discover
runs-on: ubuntu-22.04
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
target: ${{ fromJSON(needs.discover.outputs.targets) }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2
with:
bun-version: 1.3.14
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 22
package-manager-cache: false
- run: bun install --frozen-lockfile
- name: Install exact OpenCode target
run: |
npm install \
--prefix "$RUNNER_TEMP/opencode-runtime" \
--package-lock=false \
"opencode-ai@${{ matrix.target.version }}"
- name: Exercise real dispatch integration
run: bun run test:opencode
env:
OPENCODE_BIN: ${{ runner.temp }}/opencode-runtime/node_modules/.bin/opencode
OPENCODE_TEST_VERSION: ${{ matrix.target.version }}
- name: Record compatibility result
if: always()
run: |
plugin_version="$(node -p "require('./package.json').version")"
{
echo "| OpenCode | opencode-model-dispatch | Target | Result |"
echo "| --- | --- | --- | --- |"
echo "| \`${{ matrix.target.version }}\` | \`$plugin_version\` | ${{ matrix.target.line }}, ${{ matrix.target.role }} | **${{ job.status }}** |"
} >> "$GITHUB_STEP_SUMMARY"