Run Benchmark #10
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: Run Benchmark | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| run: | |
| description: "Number of times to run the benchmark" | |
| required: true | |
| type: string | |
| model: | |
| description: "Model to use" | |
| required: true | |
| type: string | |
| tasks: | |
| description: "Comma-separated list of tasks" | |
| required: true | |
| type: string | |
| jobs: | |
| prepare: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| tasks: ${{ steps.split.outputs.tasks }} | |
| steps: | |
| - name: Split tasks into matrix | |
| id: split | |
| run: | | |
| TASKS_JSON=$(echo "${{ inputs.tasks }}" | tr ',' '\n' | sed 's/^[[:space:]]*//;s/[[:space:]]*$//' | jq -R -s -c 'split("\n") | map(select(length > 0))') | |
| echo "tasks=$TASKS_JSON" >> $GITHUB_OUTPUT | |
| benchmark: | |
| needs: prepare | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| task: ${{ fromJson(needs.prepare.outputs.tasks) }} | |
| environment: production | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v1 | |
| with: | |
| bun-version: 1.2.21 | |
| - name: Install dependencies | |
| run: bun install | |
| - name: Install OpenCode CLI | |
| run: bun add -g opencode-ai | |
| - name: Print benchmark config | |
| env: | |
| RUN_COUNT: ${{ inputs.run }} | |
| MODEL: ${{ inputs.model }} | |
| TASK: ${{ matrix.task }} | |
| run: | | |
| echo "Run count: ${RUN_COUNT}" | |
| echo "Model: ${MODEL}" | |
| echo "Task: ${TASK}" | |
| - name: Run benchmark | |
| env: | |
| OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }} | |
| DEBUG: true | |
| run: bun dev opencode --task ${{ matrix.task }} --model ${{ inputs.model }} |