Skip to content

Commit

Permalink
add generated schema and github workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
linostar committed Jan 18, 2024
1 parent a8c230a commit 516111d
Show file tree
Hide file tree
Showing 4 changed files with 676 additions and 5 deletions.
3 changes: 0 additions & 3 deletions .github/scripts/requirements.txt

This file was deleted.

5 changes: 3 additions & 2 deletions .github/scripts/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@

"""Creation of schema for rockcraft.yaml."""
import json
import os
import sys
from typing import TYPE_CHECKING

from craft_parts import Part

sys.path.append("rockcraft")
script_dir = os.path.dirname(os.path.realpath(__file__))
sys.path.append(os.path.join(script_dir, "../../"))

from rockcraft import errors # noqa: E402
from rockcraft.models.project import Project # noqa: E402

if TYPE_CHECKING:
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/schema.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: schema
on: [pull_request]

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

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

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Install requirements
run: pip install -r requirements.txt

- name: Run generator script
run: python .github/scripts/schema.py > generated_schema.json

- name: Check with stored schema
run: diff generated_schema.json schemas/rockcraft_schema.json > /dev/null
Loading

0 comments on commit 516111d

Please sign in to comment.