Skip to content

Add manifest-driven OpenAPI client sync action #145

Add manifest-driven OpenAPI client sync action

Add manifest-driven OpenAPI client sync action #145

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
- cron: "17 6 * * 1"
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: cargo test --all-features
- name: Verify checked-in conformance reports
run: |
CONFORMANCE_REPORT=1 cargo test --test conformance --test conformance_json_schema
git diff --exit-code -- tests/conformance/coverage-report.md tests/conformance/json-schema-2020-12-report.md
openai-sdk-compat:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
workspaces: |
. -> target
examples/server-openai-responses -> target
- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip
cache-dependency-path: tests/python/openai_sdk_compat/requirements.txt
- name: Install pinned official OpenAI Python SDK
run: python -m pip install --requirement tests/python/openai_sdk_compat/requirements.txt
- name: Test official SDK against generated Axum server
env:
OPENAI_COMPAT_PYTHON: python
run: >-
cargo test --test openai_sdk_compat_test
official_openai_python_sdk_matches_generated_axum_server --
--ignored --exact --nocapture
anthropic-sdk-compat:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
with:
submodules: true
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
workspaces: |
. -> target
examples/server-anthropic-messages -> target
- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: pip
cache-dependency-path: tests/python/anthropic_sdk_compat/requirements.txt
- name: Install pinned official Anthropic Python SDK
run: python -m pip install --requirement tests/python/anthropic_sdk_compat/requirements.txt
- name: Test official SDK against generated Axum server
env:
ANTHROPIC_COMPAT_PYTHON: python
run: >-
cargo test --test anthropic_sdk_compat_test
official_anthropic_python_sdk_matches_generated_axum_server --
--ignored --exact --nocapture
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy
- uses: Swatinem/rust-cache@v2
- run: cargo clippy --all-features -- -D warnings
fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt
- run: cargo fmt --check
doc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: cargo doc --no-deps --all-features
env:
RUSTDOCFLAGS: -D warnings
install-smoke:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: scripts/install-smoke.sh
env:
# Keep cargo-install artifacts inside the target tree restored by
# rust-cache; the script still isolates and removes its package root.
CARGO_TARGET_DIR: ${{ github.workspace }}/target/install-smoke
- name: Build Action binary override
run: cargo build --locked --bin openapi-to-rust
- name: Smoke-test the local GitHub Action
uses: ./
with:
binary: ${{ github.workspace }}/target/debug/openapi-to-rust
command: check
manifest: tests/fixtures/client-sync/openapi-clients.yml
msrv:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.88.0
- uses: Swatinem/rust-cache@v2
- run: cargo check --all-targets --all-features
# Fast tier: every supported corpus document must generate, while the two
# production-target specs must also compile from their exact dependency
# fragments. The full compile tier runs separately on a schedule/manual run.
spec-compile:
if: github.event_name != 'schedule' && github.event_name != 'workflow_dispatch'
runs-on: ubuntu-latest
env:
# Share scratch-crate dependencies across runs through rust-cache's
# root-workspace target directory.
SPEC_COMPILE_TARGET_DIR: ${{ github.workspace }}/target/spec-compile
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: SPEC_COMPILE_PARSE_ONLY=1 scripts/spec-compile.sh
- run: scripts/spec-compile.sh anthropic openai
full-spec-compile:
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
timeout-minutes: 240
env:
SPEC_COMPILE_TARGET_DIR: ${{ github.workspace }}/target/spec-compile
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: scripts/spec-compile.sh