|
| 1 | +# API Conformance Tests |
| 2 | +# This workflow ensures that API changes maintain backward compatibility and don't break existing integrations |
| 3 | +# It runs schema validation and OpenAPI diff checks to catch breaking changes early |
| 4 | + |
| 5 | +name: API Conformance Tests |
| 6 | + |
| 7 | +run-name: Run the API Conformance test suite on the changes. |
| 8 | + |
| 9 | +on: |
| 10 | + push: |
| 11 | + branches: [ main ] |
| 12 | + pull_request: |
| 13 | + branches: [ main ] |
| 14 | + types: [opened, synchronize, reopened] |
| 15 | + paths: |
| 16 | + - 'llama_stack/**' |
| 17 | + - '!llama_stack/ui/**' |
| 18 | + - 'tests/**' |
| 19 | + - 'uv.lock' |
| 20 | + - 'pyproject.toml' |
| 21 | + - '.github/workflows/conformance.yml' # This workflow itself |
| 22 | + |
| 23 | +concurrency: |
| 24 | + group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/main' && github.run_id || github.ref }} |
| 25 | + # Cancel in-progress runs when new commits are pushed to avoid wasting CI resources |
| 26 | + cancel-in-progress: true |
| 27 | + |
| 28 | +jobs: |
| 29 | + # Job to check if API schema changes maintain backward compatibility |
| 30 | + check-schema-compatibility: |
| 31 | + runs-on: ubuntu-latest |
| 32 | + steps: |
| 33 | + # Using specific version 4.1.7 because 5.0.0 fails when trying to run this locally using `act` |
| 34 | + # This ensures consistent behavior between local testing and CI |
| 35 | + - name: Checkout PR Code |
| 36 | + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 |
| 37 | + |
| 38 | + # Checkout the base branch to compare against (usually main) |
| 39 | + # This allows us to diff the current changes against the previous state |
| 40 | + - name: Checkout Base Branch |
| 41 | + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 |
| 42 | + with: |
| 43 | + ref: ${{ github.event.pull_request.base.ref }} |
| 44 | + path: 'base' |
| 45 | + |
| 46 | + # Build a custom container that includes both openapi-diff and yq tools |
| 47 | + # The default openapi-diff container doesn't have yq, which we need for advanced YAML filtering |
| 48 | + - name: Install oasdiff |
| 49 | + run: | |
| 50 | + curl -fsSL https://raw.githubusercontent.com/oasdiff/oasdiff/main/install.sh | sh |
| 51 | +
|
| 52 | + # Run the OpenAPI diff tool to detect breaking changes in the API specification |
| 53 | + # This step will fail if incompatible changes are detected, preventing breaking changes from being merged |
| 54 | + - name: Run OpenAPI Breaking Change Diff |
| 55 | + run: | |
| 56 | + oasdiff breaking --fail-on ERR base/docs/_static/llama-stack-spec.yaml docs/_static/llama-stack-spec.yaml --match-path '^/v1/openai/v1' \ |
| 57 | + --match-path '^/v1/vector-io' \ |
| 58 | + --match-path '^/v1/vector-dbs' |
0 commit comments