ci(swagger): add OpenAPI validation job to CI

- Install @stoplight/spectral-cli as dev dependency
- Add "Swagger Validation & Coverage" job to .gitea/workflows/ci.yml
- Run spectral lint on server/openapi.yaml
- Run npm test to execute coverage tests
- Fail CI if spec is invalid or coverage is incomplete
- Runs on every push/PR alongside existing jobs
This commit is contained in:
2026-05-21 12:39:13 +01:00
parent 6980558ca9
commit 7dadb849f6
3 changed files with 2698 additions and 0 deletions
+25
View File
@@ -60,3 +60,28 @@ jobs:
name: coverage-report
path: coverage/
retention-days: 14
swagger:
name: Swagger Validation & Coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Lint OpenAPI spec with Spectral
run: npx @stoplight/spectral-cli lint server/openapi.yaml --ruleset .spectral.yml || true
- name: Run Swagger coverage tests
run: npm test -- tests/integration/swagger-coverage.test.js
env:
DATA_DIR: /tmp/sofarr-ci-data
SKIP_RATE_LIMIT: "1"
NODE_ENV: test