agentstat 0.1.2

Read-only AI provider usage, quota, balance, and reset data
Documentation
name: Rust

on:
  pull_request:
  push:
    branches: [main]
  workflow_call:

permissions:
  contents: read

concurrency:
  group: ci-${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
  test:
    name: Test (${{ matrix.os }})
    timeout-minutes: 30
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest, windows-latest]
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v4
        with:
          persist-credentials: false
      - uses: dtolnay/rust-toolchain@stable
        with:
          components: rustfmt, clippy
      - uses: actions/setup-python@v5
        with:
          python-version: '3.12'
      - run: cargo test --locked --all-features
      - run: cargo test --locked --no-default-features
      - run: cargo test --locked
      - run: cargo test --locked --all-features --test http -- --ignored
      - run: cargo clippy --locked --all-features --all-targets -- -D warnings
      - run: cargo doc --locked --all-features --no-deps
      - run: cargo package --locked --all-features
      - run: python scripts/check_coverage.py
      - run: python scripts/test_release.py

  format:
    name: Nightly format
    runs-on: ubuntu-latest
    timeout-minutes: 15
    steps:
      - uses: actions/checkout@v4
        with:
          persist-credentials: false
      - uses: dtolnay/rust-toolchain@nightly
        with:
          components: rustfmt
      - run: cargo +nightly fmt --check

  deny:
    name: Dependency bans
    runs-on: ubuntu-latest
    timeout-minutes: 15
    steps:
      - uses: actions/checkout@v4
        with:
          persist-credentials: false
      - uses: taiki-e/install-action@v2
        with:
          tool: cargo-deny
      - run: cargo deny check bans

  individual-features:
    name: Individual features
    runs-on: ubuntu-latest
    timeout-minutes: 30
    steps:
      - uses: actions/checkout@v4
        with:
          persist-credentials: false
      - uses: dtolnay/rust-toolchain@stable
      - uses: actions/setup-python@v5
        with:
          python-version: '3.12'
      - run: cargo fetch --locked
      - run: bash scripts/check_features.sh

  checks:
    name: Checks passed
    if: ${{ always() }}
    needs: [test, individual-features, format, deny]
    runs-on: ubuntu-latest
    timeout-minutes: 5
    steps:
      - name: Require all checks to succeed
        env:
          TEST_RESULT: ${{ needs.test.result }}
          FEATURES_RESULT: ${{ needs.individual-features.result }}
          FORMAT_RESULT: ${{ needs.format.result }}
          DENY_RESULT: ${{ needs.deny.result }}
        run: |
          test "$TEST_RESULT" = success
          test "$FEATURES_RESULT" = success
          test "$FORMAT_RESULT" = success
          test "$DENY_RESULT" = success