openrouter-rs 0.11.1

A type-safe OpenRouter Rust SDK
Documentation
name: Integration Tests

on:
  workflow_dispatch:
    inputs:
      tier:
        description: "Integration tier"
        required: false
        default: stable
        type: choice
        options:
          - stable
          - hot
  schedule:
    - cron: "0 6 * * 1"

concurrency:
  group: integration-${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

permissions:
  contents: read

jobs:
  integration:
    name: Run core live integration tests
    runs-on: ubuntu-latest
    timeout-minutes: 40
    env:
      OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
    steps:
      - name: Checkout
        uses: actions/checkout@v5

      - name: Setup Rust (stable)
        uses: dtolnay/rust-toolchain@stable

      - name: Cache Rust artifacts
        uses: Swatinem/rust-cache@v2

      - name: Resolve integration tier
        id: tier
        env:
          EVENT_NAME: ${{ github.event_name }}
          DISPATCH_TIER: ${{ github.event.inputs.tier }}
        run: |
          tier="stable"
          if [ "${EVENT_NAME}" = "schedule" ]; then
            tier="hot"
          elif [ "${EVENT_NAME}" = "workflow_dispatch" ] && [ "${DISPATCH_TIER}" = "hot" ]; then
            tier="hot"
          fi
          echo "tier=${tier}" >> "$GITHUB_OUTPUT"
          echo "Running integration tier: ${tier}"

      - name: Refresh integration model pool
        if: steps.tier.outputs.tier == 'hot'
        run: ./scripts/sync_model_pool.sh

      - name: Run integration tests (or skip when secret missing)
        env:
          OPENROUTER_INTEGRATION_TIER: ${{ steps.tier.outputs.tier }}
          OPENROUTER_TEST_HOT_RESPONSES_MODELS_LIMIT: "10"
        run: |
          if [ -z "${OPENROUTER_API_KEY}" ]; then
            echo "OPENROUTER_API_KEY secret is not configured; skipping integration tests."
            exit 0
          fi
          cargo test --test integration -- --nocapture --skip management::

  management-smoke:
    name: Run management-key smoke integration tests
    runs-on: ubuntu-latest
    timeout-minutes: 30
    env:
      OPENROUTER_MANAGEMENT_KEY: ${{ secrets.OPENROUTER_MANAGEMENT_KEY }}
      OPENROUTER_PROVISIONING_KEY: ${{ secrets.OPENROUTER_PROVISIONING_KEY }}
      OPENROUTER_RUN_MANAGEMENT_TESTS: "1"
    steps:
      - name: Checkout
        uses: actions/checkout@v5

      - name: Setup Rust (stable)
        uses: dtolnay/rust-toolchain@stable

      - name: Cache Rust artifacts
        uses: Swatinem/rust-cache@v2

      - name: Run management smoke tests (or skip when secret missing)
        run: |
          if [ -z "${OPENROUTER_MANAGEMENT_KEY}" ] && [ -n "${OPENROUTER_PROVISIONING_KEY}" ]; then
            OPENROUTER_MANAGEMENT_KEY="${OPENROUTER_PROVISIONING_KEY}"
            export OPENROUTER_MANAGEMENT_KEY
          fi

          if [ -z "${OPENROUTER_MANAGEMENT_KEY}" ]; then
            echo "OPENROUTER_MANAGEMENT_KEY secret is not configured; skipping management smoke tests."
            exit 0
          fi

          cargo test --test integration management:: -- --nocapture