|
1 | 1 | # API Conformance Tests |
2 | 2 | # This workflow ensures that API changes maintain backward compatibility and don't break existing integrations |
3 | 3 | # 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 |
4 | 9 |
|
5 | 10 | name: API Conformance Tests |
6 | 11 |
|
|
13 | 18 | branches: [ main ] |
14 | 19 | types: [opened, synchronize, reopened, edited] |
15 | 20 | 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 |
19 | 27 |
|
20 | 28 | concurrency: |
21 | 29 | group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/main' && github.run_id || github.ref }} |
|
80 | 88 | sudo cp ~/oasdiff /usr/local/bin/oasdiff |
81 | 89 | sudo chmod +x /usr/local/bin/oasdiff |
82 | 90 |
|
| 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 | +
|
83 | 132 | # Run oasdiff to detect breaking changes in the API specification |
84 | 133 | # This step will fail if incompatible changes are detected, preventing breaking changes from being merged |
85 | 134 | - name: Run OpenAPI Breaking Change Diff |
|
91 | 140 | - name: Report skip reason |
92 | 141 | if: steps.skip-check.outputs.skip == 'true' |
93 | 142 | 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