openai-core 0.1.0

Rust SDK for OpenAI-compatible ecosystem
Documentation
name: CI

on:
  push:
    branches:
      - main
  pull_request:

permissions:
  contents: read

env:
  CARGO_TERM_COLOR: always

jobs:
  quality:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - uses: dtolnay/rust-toolchain@master
        with:
          toolchain: stable
          components: rustfmt, clippy

      - uses: Swatinem/rust-cache@v2

      - uses: taiki-e/install-action@v2
        with:
          tool: cargo-deny

      - uses: taiki-e/install-action@v2
        with:
          tool: cargo-public-api

      - uses: taiki-e/install-action@v2
        with:
          tool: cargo-nextest

      - name: Install nightly for cargo-public-api
        run: rustup toolchain install nightly --profile minimal

      - name: Format
        run: cargo fmt --all -- --check

      - name: Generated Endpoint Catalog
        run: python3 ./scripts/generate_endpoints.py --check

      - name: Cargo Deny
        run: cargo deny check

      - name: Public API
        run: bash ./scripts/check-public-api.sh

      - name: Examples
        run: cargo check --examples --all-features

      - name: Ecosystem Fixtures
        run: bash ./scripts/check-ecosystem.sh

      - name: Downstream Canaries
        run: bash ./scripts/check-downstream-canaries.sh

      - name: Docs.rs-style docs build
        env:
          RUSTDOCFLAGS: --cfg docsrs
        run: cargo +nightly doc --all-features --no-deps

      - name: Clippy
        run: cargo clippy --all-targets --all-features -- -D warnings

      - name: Nextest
        run: cargo nextest run --all-features

  cargo-check:
    strategy:
      fail-fast: false
      matrix:
        include:
          - os: ubuntu-latest
            toolchain: stable
            profile: default
            args: ""
          - os: ubuntu-latest
            toolchain: stable
            profile: no-default-features
            args: "--no-default-features"
          - os: ubuntu-latest
            toolchain: stable
            profile: all-features
            args: "--all-features"
          - os: macos-latest
            toolchain: stable
            profile: default
            args: ""
          - os: macos-latest
            toolchain: stable
            profile: no-default-features
            args: "--no-default-features"
          - os: macos-latest
            toolchain: stable
            profile: all-features
            args: "--all-features"
          - os: windows-latest
            toolchain: stable
            profile: default
            args: ""
          - os: windows-latest
            toolchain: stable
            profile: no-default-features
            args: "--no-default-features"
          - os: windows-latest
            toolchain: stable
            profile: all-features
            args: "--all-features"
          - os: ubuntu-latest
            toolchain: 1.94.1
            profile: default
            args: ""
          - os: ubuntu-latest
            toolchain: 1.94.1
            profile: no-default-features
            args: "--no-default-features"
          - os: ubuntu-latest
            toolchain: 1.94.1
            profile: all-features
            args: "--all-features"
    name: Cargo Check (${{ matrix.os }} / ${{ matrix.toolchain }} / ${{ matrix.profile }})
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v4

      - uses: dtolnay/rust-toolchain@master
        with:
          toolchain: ${{ matrix.toolchain }}

      - uses: Swatinem/rust-cache@v2

      - name: Cargo Check
        run: cargo check ${{ matrix.args }}

  tests:
    strategy:
      fail-fast: false
      matrix:
        include:
          - os: ubuntu-latest
            toolchain: stable
            profile: default
            args: ""
          - os: ubuntu-latest
            toolchain: stable
            profile: no-default-features
            args: "--no-default-features"
          - os: ubuntu-latest
            toolchain: stable
            profile: all-features
            args: "--all-features"
          - os: macos-latest
            toolchain: stable
            profile: default
            args: ""
          - os: macos-latest
            toolchain: stable
            profile: all-features
            args: "--all-features"
          - os: windows-latest
            toolchain: stable
            profile: default
            args: ""
          - os: windows-latest
            toolchain: stable
            profile: all-features
            args: "--all-features"
          - os: ubuntu-latest
            toolchain: 1.94.1
            profile: default
            args: ""
          - os: ubuntu-latest
            toolchain: 1.94.1
            profile: no-default-features
            args: "--no-default-features"
          - os: ubuntu-latest
            toolchain: 1.94.1
            profile: all-features
            args: "--all-features"
    name: Tests (${{ matrix.os }} / ${{ matrix.toolchain }} / ${{ matrix.profile }})
    runs-on: ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v4

      - uses: dtolnay/rust-toolchain@master
        with:
          toolchain: ${{ matrix.toolchain }}

      - uses: Swatinem/rust-cache@v2

      - name: Cargo Test
        run: cargo test ${{ matrix.args }}