Skip to content

Commit 7f1a33f

Browse files
docs: update API conformance test (#3631)
# What does this PR do? Given the rapidly changing nature of Llama Stack's APIs and the need to have clean, user-friendly API documentation, we want to split the API reference into 3 main buckets; stable, experimental and deprecated. The most straightforward way to do it is to have several automatically generated doctrees, which introduces some complexity in testing APIs for backwards compatibility. This PR updates the API conformance test to handle cases where the API schema is split into several files; it does not change the testing criteria. <!-- Provide a short summary of what this PR does and why. Link to relevant issues if applicable. --> <!-- If resolving an issue, uncomment and update the line below --> <!-- Closes #[issue-number] --> ## Test Plan No developer-facing changes (all existing tests should pass) <!-- Describe the tests you ran to verify your changes with result summaries. *Provide clear instructions so the plan can be easily re-executed.* -->
1 parent 853e9b3 commit 7f1a33f

File tree

1 file changed

+53
-4
lines changed

1 file changed

+53
-4
lines changed

.github/workflows/conformance.yml

Lines changed: 53 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# API Conformance Tests
22
# This workflow ensures that API changes maintain backward compatibility and don't break existing integrations
33
# It runs schema validation and OpenAPI diff checks to catch breaking changes early
4+
#
5+
# The workflow handles both monolithic and split API specifications:
6+
# - If split specs exist (stable/experimental/deprecated), they are stitched together for comparison
7+
# - If only monolithic spec exists, it is used directly
8+
# This allows for clean API organization while maintaining robust conformance testing
49

510
name: API Conformance Tests
611

@@ -13,9 +18,12 @@ on:
1318
branches: [ main ]
1419
types: [opened, synchronize, reopened, edited]
1520
paths:
16-
- 'docs/static/llama-stack-spec.yaml'
17-
- 'docs/static/llama-stack-spec.html'
18-
- '.github/workflows/conformance.yml' # This workflow itself
21+
- 'docs/static/llama-stack-spec.yaml' # Legacy monolithic spec
22+
- 'docs/static/stable-llama-stack-spec.yaml' # Stable APIs spec
23+
- 'docs/static/experimental-llama-stack-spec.yaml' # Experimental APIs spec
24+
- 'docs/static/deprecated-llama-stack-spec.yaml' # Deprecated APIs spec
25+
- 'docs/static/llama-stack-spec.html' # Legacy HTML spec
26+
- '.github/workflows/conformance.yml' # This workflow itself
1927

2028
concurrency:
2129
group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/main' && github.run_id || github.ref }}
@@ -80,6 +88,47 @@ jobs:
8088
sudo cp ~/oasdiff /usr/local/bin/oasdiff
8189
sudo chmod +x /usr/local/bin/oasdiff
8290
91+
# Install yq for YAML processing
92+
- name: Install yq
93+
run: |
94+
sudo wget -qO /usr/local/bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64
95+
sudo chmod +x /usr/local/bin/yq
96+
97+
# Verify API specs exist for conformance testing
98+
- name: Check API Specs
99+
run: |
100+
echo "Checking for API specification files..."
101+
102+
# Check current branch
103+
if [ -f "docs/static/stable-llama-stack-spec.yaml" ]; then
104+
echo "✓ Found stable API spec in current branch"
105+
CURRENT_SPEC="docs/static/stable-llama-stack-spec.yaml"
106+
elif [ -f "docs/static/llama-stack-spec.yaml" ]; then
107+
echo "✓ Found monolithic API spec in current branch"
108+
CURRENT_SPEC="docs/static/llama-stack-spec.yaml"
109+
else
110+
echo "❌ No API specs found in current branch"
111+
exit 1
112+
fi
113+
114+
# Check base branch
115+
if [ -f "base/docs/static/stable-llama-stack-spec.yaml" ]; then
116+
echo "✓ Found stable API spec in base branch"
117+
BASE_SPEC="base/docs/static/stable-llama-stack-spec.yaml"
118+
elif [ -f "base/docs/static/llama-stack-spec.yaml" ]; then
119+
echo "✓ Found monolithic API spec in base branch"
120+
BASE_SPEC="base/docs/static/llama-stack-spec.yaml"
121+
else
122+
echo "❌ No API specs found in base branch"
123+
exit 1
124+
fi
125+
126+
# Export for next step
127+
echo "BASE_SPEC=${BASE_SPEC}" >> $GITHUB_ENV
128+
echo "CURRENT_SPEC=${CURRENT_SPEC}" >> $GITHUB_ENV
129+
130+
echo "Will compare: ${BASE_SPEC} -> ${CURRENT_SPEC}"
131+
83132
# Run oasdiff to detect breaking changes in the API specification
84133
# This step will fail if incompatible changes are detected, preventing breaking changes from being merged
85134
- name: Run OpenAPI Breaking Change Diff
@@ -91,4 +140,4 @@ jobs:
91140
- name: Report skip reason
92141
if: steps.skip-check.outputs.skip == 'true'
93142
run: |
94-
echo "Conformance test skipped due to breaking change indicator"
143+
oasdiff breaking --fail-on ERR $BASE_SPEC $CURRENT_SPEC --match-path '^/v1/'

0 commit comments

Comments
 (0)