Establish OpenCode compatibility certification corpus
Some checks failed
Some checks failed
This commit is contained in:
93
.github/workflows/candidate.yml
vendored
Normal file
93
.github/workflows/candidate.yml
vendored
Normal file
@@ -0,0 +1,93 @@
|
||||
name: Candidate compatibility
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
branches: [main]
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
opencode_ruby_ref:
|
||||
description: Candidate opencode-ruby ref; blank uses the manifest
|
||||
required: false
|
||||
type: string
|
||||
|
||||
jobs:
|
||||
repository:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: "3.4"
|
||||
- run: ruby test/repository_test.rb
|
||||
|
||||
prepare:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
matrix: ${{ steps.matrix.outputs.value }}
|
||||
client_ref: ${{ steps.client.outputs.value }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- id: matrix
|
||||
run: echo "value=$(ruby scripts/matrix_json.rb)" >> "$GITHUB_OUTPUT"
|
||||
- id: client
|
||||
env:
|
||||
INPUT_REF: ${{ inputs.opencode_ruby_ref }}
|
||||
run: |
|
||||
if [ -n "$INPUT_REF" ]; then
|
||||
echo "value=$INPUT_REF" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "value=$(jq -r .ref manifests/client-candidate.json)" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
fixture-contract:
|
||||
needs: prepare
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
repository: ajaynomics/opencode-ruby
|
||||
ref: ${{ needs.prepare.outputs.client_ref }}
|
||||
path: client
|
||||
- uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: "3.4"
|
||||
bundler-cache: true
|
||||
working-directory: client
|
||||
- name: Candidate unit tests
|
||||
working-directory: client
|
||||
run: bundle exec rake test
|
||||
- name: Shared fixture contract
|
||||
working-directory: client
|
||||
env:
|
||||
OPENCODE_RUBY_PATH: ${{ github.workspace }}/client
|
||||
OPENCODE_RUBY_COMMIT: ${{ needs.prepare.outputs.client_ref }}
|
||||
run: bundle exec ruby ../ruby/opencode_ruby_fixture_contract.rb
|
||||
|
||||
exact-image-contract:
|
||||
needs: prepare
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix: ${{ fromJSON(needs.prepare.outputs.matrix) }}
|
||||
name: image ${{ matrix.id }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
repository: ajaynomics/opencode-ruby
|
||||
ref: ${{ needs.prepare.outputs.client_ref }}
|
||||
path: client
|
||||
- uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: "3.4"
|
||||
bundler-cache: true
|
||||
working-directory: client
|
||||
- name: Exercise complete REST and SSE turn
|
||||
env:
|
||||
BUNDLE_GEMFILE: ${{ github.workspace }}/client/Gemfile
|
||||
OPENCODE_IMAGE: ${{ matrix.image }}
|
||||
OPENCODE_RUBY_PATH: ${{ github.workspace }}/client
|
||||
run: bundle exec scripts/run_image_contract.sh
|
||||
81
.github/workflows/watch-upstream.yml
vendored
Normal file
81
.github/workflows/watch-upstream.yml
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
name: Watch upstream OpenCode
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "23 */6 * * *"
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
|
||||
concurrency:
|
||||
group: opencode-upstream-watcher
|
||||
cancel-in-progress: false
|
||||
|
||||
jobs:
|
||||
open-compatibility-pr:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Resolve latest release
|
||||
id: release
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
release="$(gh api repos/anomalyco/opencode/releases/latest)"
|
||||
tag="$(jq -r .tag_name <<<"$release")"
|
||||
current="$(jq -r .release_tag manifests/upstream.json)"
|
||||
echo "tag=$tag" >> "$GITHUB_OUTPUT"
|
||||
echo "published_at=$(jq -r .published_at <<<"$release")" >> "$GITHUB_OUTPUT"
|
||||
echo "release_url=$(jq -r .html_url <<<"$release")" >> "$GITHUB_OUTPUT"
|
||||
if [ "$tag" = "$current" ]; then
|
||||
echo "changed=false" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "changed=true" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
- name: Stop when a PR already exists
|
||||
if: steps.release.outputs.changed == 'true'
|
||||
id: existing
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
TAG: ${{ steps.release.outputs.tag }}
|
||||
run: |
|
||||
branch="compat/upstream-${TAG#v}"
|
||||
count="$(gh pr list --state open --head "$branch" --json number --jq length)"
|
||||
echo "branch=$branch" >> "$GITHUB_OUTPUT"
|
||||
if [ "$count" -gt 0 ]; then
|
||||
echo "skip=true" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "skip=false" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
- name: Resolve immutable image and update manifests
|
||||
if: steps.release.outputs.changed == 'true' && steps.existing.outputs.skip == 'false'
|
||||
env:
|
||||
TAG: ${{ steps.release.outputs.tag }}
|
||||
PUBLISHED_AT: ${{ steps.release.outputs.published_at }}
|
||||
RELEASE_URL: ${{ steps.release.outputs.release_url }}
|
||||
run: |
|
||||
digest="$(docker buildx imagetools inspect "ghcr.io/anomalyco/opencode:${TAG#v}" --format '{{json .Manifest}}' | jq -r .digest)"
|
||||
ruby scripts/record_upstream_candidate.rb "$TAG" "$PUBLISHED_AT" "$RELEASE_URL" "$digest"
|
||||
ruby test/repository_test.rb
|
||||
- name: Open compatibility PR
|
||||
if: steps.release.outputs.changed == 'true' && steps.existing.outputs.skip == 'false'
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
TAG: ${{ steps.release.outputs.tag }}
|
||||
BRANCH: ${{ steps.existing.outputs.branch }}
|
||||
run: |
|
||||
git config user.name "opencode-compat-bot"
|
||||
git config user.email "opencode-compat-bot@users.noreply.github.com"
|
||||
git switch -c "$BRANCH"
|
||||
git add manifests/image-matrix.json manifests/upstream.json
|
||||
git commit -m "Test OpenCode ${TAG} compatibility"
|
||||
git push --set-upstream origin "$BRANCH"
|
||||
gh pr create \
|
||||
--base main \
|
||||
--head "$BRANCH" \
|
||||
--title "Test OpenCode ${TAG} compatibility" \
|
||||
--body "Upstream watcher detected ${TAG}, resolved its immutable OCI digest, and added it as a pending compatibility target. This PR only runs certification checks; promotion and consumer rollout remain manual."
|
||||
Reference in New Issue
Block a user