Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Automate schema validation in a github workflow job #462

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 24 additions & 3 deletions .github/workflows/schema.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ name: Schema
on: [pull_request]

jobs:
generate-schema:
runs-on: ubuntu-22.04
diff-schema:
runs-on: ubuntu-latest

steps:
- name: Checkout rockcraft
Expand All @@ -14,7 +14,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
python-version: "3.10"

- name: Install requirements
run: pip install -r requirements.txt
Expand All @@ -26,3 +26,24 @@ jobs:
run: |
test -f schema/rockcraft.json &&
diff generated_schema.json schema/rockcraft.json

validate-schema:
runs-on: ubuntu-latest

steps:
- name: Checkout rockcraft
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20"

- name: Install ajv cli
run: npm install -g ajv-cli

- name: Run ajv
run: |
ajv validate -s schema/rockcraft.json -d docs/reference/code/example/rockcraft.yaml --strict=false --spec=draft2020
linostar marked this conversation as resolved.
Show resolved Hide resolved
Loading