feat: add opencode models and quota tracking #583
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: PR Checks | |
| on: | |
| pull_request: | |
| types: | |
| - opened | |
| - synchronize | |
| - reopened | |
| # A newer commit makes the checks for the previous one irrelevant, and superseded | |
| # runs otherwise keep saturating the runner pool for the whole repository. | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| # Must match the number of shard entries in the test matrix below. Past four | |
| # the fixed per-shard setup costs more than the test time it buys back. | |
| TEST_SHARDS: 4 | |
| jobs: | |
| # Runs once for the whole repository rather than per shard. None of these | |
| # commands build the Linux desktop app or run native asset build hooks, so | |
| # this job skips the desktop toolchain, Zig, native asset cache and preflight. | |
| static: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v7 | |
| with: | |
| submodules: false | |
| - name: Setup Flutter workspace | |
| uses: ./.github/actions/setup-flutter-workspace | |
| with: | |
| linux-toolchain: 'false' | |
| native-assets: 'false' | |
| preflight: 'false' | |
| - name: Format | |
| run: dart format --set-exit-if-changed lib test integration_test tool | |
| # `dart run` would resolve the package and fire the native asset build | |
| # hooks, which this job deliberately has no Zig for. The script imports | |
| # only dart:io, so run the file directly. | |
| - name: Max lines ratchet | |
| run: dart tool/quality/check_max_lines.dart | |
| - name: Analyze | |
| run: flutter analyze | |
| test: | |
| name: test ${{ matrix.name }} | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - name: shard 0 | |
| shard: '0' | |
| - name: shard 1 | |
| shard: '1' | |
| - name: shard 2 | |
| shard: '2' | |
| - name: shard 3 | |
| shard: '3' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v7 | |
| with: | |
| submodules: false | |
| - name: Setup Flutter workspace | |
| uses: ./.github/actions/setup-flutter-workspace | |
| with: | |
| # flutter test still runs native asset hooks, but it does not build | |
| # the Linux desktop app and needs no GTK, WebKit or libmpv headers. | |
| linux-toolchain: 'false' | |
| # The shard split happens on the file list, not through | |
| # --total-shards/--shard-index: that flag slices the tests inside each | |
| # suite after loading it, so every shard would still compile every file. | |
| - name: Test | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| mapfile -t files < <(dart tool/ci/select_test_shard.dart --total ${{ env.TEST_SHARDS }} --index "${{ matrix.shard }}" --skip test/golden) | |
| # Process substitution swallows the selector's exit code, and an empty | |
| # list would make flutter test silently run everything instead. | |
| if [ "${#files[@]}" -eq 0 ]; then | |
| echo "Shard ${{ matrix.shard }} selected no test files." >&2 | |
| exit 1 | |
| fi | |
| echo "shard ${{ matrix.shard }}: ${#files[@]} test files" | |
| flutter test --coverage --coverage-path "coverage/lcov-shard-${{ matrix.shard }}.info" "${files[@]}" | |
| - name: Upload shard coverage | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: coverage-shard-${{ matrix.shard }} | |
| path: coverage/lcov-shard-${{ matrix.shard }}.info | |
| if-no-files-found: error | |
| # Only needs Dart: coverage_report.dart imports dart:io and nothing else, so | |
| # setting up Flutter here would cost more than the gate itself. | |
| coverage: | |
| needs: test | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v7 | |
| with: | |
| submodules: false | |
| - name: Setup Dart | |
| uses: dart-lang/setup-dart@v1 | |
| - name: Download shard coverage | |
| uses: actions/download-artifact@v7 | |
| with: | |
| pattern: coverage-shard-* | |
| merge-multiple: true | |
| path: coverage-shards | |
| # --expect-inputs is what stops a lost shard artifact from quietly | |
| # shrinking the totals into a passing gate. | |
| - name: Coverage report | |
| run: dart tool/quality/coverage_report.dart --input-dir coverage-shards --expect-inputs ${{ env.TEST_SHARDS }} --min-lines 100 --worst 25 | |
| mobile: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| defaults: | |
| run: | |
| working-directory: mobile | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v7 | |
| with: | |
| submodules: false | |
| # The mobile package overrides xterm to ../third_party/xterm and runs no | |
| # native asset hooks, so it needs neither the other submodule nor Zig. | |
| - name: Setup Flutter workspace | |
| uses: ./.github/actions/setup-flutter-workspace | |
| with: | |
| working-directory: mobile | |
| submodules: third_party/xterm | |
| linux-toolchain: 'false' | |
| native-assets: 'false' | |
| preflight: 'false' | |
| - name: Format | |
| run: dart format --set-exit-if-changed lib test | |
| - name: Analyze | |
| run: flutter analyze | |
| - name: Test | |
| run: flutter test | |
| rust: | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v7 | |
| - name: Install Linux dependencies | |
| run: sudo apt-get update && sudo apt-get install --yes libdbus-1-dev pkg-config | |
| - name: Setup Rust and sccache | |
| uses: ./.github/actions/setup-rust-sccache | |
| - name: Format | |
| run: cargo fmt --check | |
| working-directory: rust | |
| # --workspace is required because rust/ has a root package (alera_native), | |
| # so a bare clippy/test would skip the alera-cli member. | |
| - name: Clippy | |
| run: cargo clippy --workspace --all-targets -- -D warnings | |
| working-directory: rust | |
| - name: Test | |
| run: cargo test --workspace | |
| working-directory: rust | |
| - name: Report sccache statistics | |
| if: always() | |
| run: | | |
| { | |
| echo "### sccache Rust checks" | |
| echo '```text' | |
| sccache --show-stats || true | |
| echo '```' | |
| } | tee -a "$GITHUB_STEP_SUMMARY" | |
| pr-ready: | |
| name: pr-ready | |
| if: always() | |
| needs: | |
| - static | |
| - test | |
| - coverage | |
| - mobile | |
| - rust | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 5 | |
| steps: | |
| - name: Require fast checks | |
| shell: bash | |
| env: | |
| STATIC_RESULT: ${{ needs.static.result }} | |
| TEST_RESULT: ${{ needs.test.result }} | |
| COVERAGE_RESULT: ${{ needs.coverage.result }} | |
| MOBILE_RESULT: ${{ needs.mobile.result }} | |
| RUST_RESULT: ${{ needs.rust.result }} | |
| run: | | |
| set -euo pipefail | |
| failed=0 | |
| for result_name in STATIC_RESULT TEST_RESULT COVERAGE_RESULT MOBILE_RESULT RUST_RESULT; do | |
| result="${!result_name}" | |
| if [ "$result" != "success" ]; then | |
| echo "::error::${result_name} was ${result}" | |
| failed=1 | |
| fi | |
| done | |
| exit "$failed" |