82 lines
2.2 KiB
YAML
82 lines
2.2 KiB
YAML
name: Ledger OpenAPI CI
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches: [main]
|
|
paths:
|
|
- 'api/ledger/**'
|
|
- 'devops/ledger/**'
|
|
pull_request:
|
|
paths:
|
|
- 'api/ledger/**'
|
|
|
|
jobs:
|
|
validate-oas:
|
|
runs-on: ubuntu-22.04
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: '20'
|
|
|
|
- name: Install tools
|
|
run: |
|
|
npm install -g @stoplight/spectral-cli
|
|
npm install -g @openapitools/openapi-generator-cli
|
|
|
|
- name: Validate OpenAPI spec
|
|
run: |
|
|
chmod +x devops/ledger/validate-oas.sh
|
|
devops/ledger/validate-oas.sh
|
|
|
|
- name: Upload validation report
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ledger-oas-validation-${{ github.run_number }}
|
|
path: |
|
|
out/ledger/oas/lint-report.json
|
|
out/ledger/oas/validation-report.txt
|
|
out/ledger/oas/spec-summary.json
|
|
if-no-files-found: warn
|
|
|
|
check-wellknown:
|
|
runs-on: ubuntu-22.04
|
|
needs: validate-oas
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Check .well-known/openapi structure
|
|
run: |
|
|
# Validate .well-known structure if exists
|
|
if [ -d ".well-known" ]; then
|
|
echo "Checking .well-known/openapi..."
|
|
if [ -f ".well-known/openapi.json" ]; then
|
|
python3 -c "import json; json.load(open('.well-known/openapi.json'))"
|
|
echo ".well-known/openapi.json is valid JSON"
|
|
fi
|
|
else
|
|
echo "[info] .well-known directory not present (OK for dev)"
|
|
fi
|
|
|
|
deprecation-check:
|
|
runs-on: ubuntu-22.04
|
|
needs: validate-oas
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Check deprecation policy
|
|
run: |
|
|
if [ -f "devops/ledger/deprecation-policy.yaml" ]; then
|
|
echo "Validating deprecation policy..."
|
|
python3 -c "import yaml; yaml.safe_load(open('devops/ledger/deprecation-policy.yaml'))"
|
|
echo "Deprecation policy is valid"
|
|
else
|
|
echo "[info] No deprecation policy yet (OK for initial setup)"
|
|
fi
|