-
Notifications
You must be signed in to change notification settings - Fork 512
64 lines (52 loc) · 1.44 KB
/
schema.yaml
File metadata and controls
64 lines (52 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
name: Schema
on: [pull_request]
env:
SNAPCRAFT_JSON: schema/snapcraft.json
jobs:
diff-schema:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v5
- name: Setup project
run: |
sudo apt-get update
make setup
- name: Run generator script
run: |
uv run --frozen \
python tools/schema.py > generated_schema.json
- name: Prettify json
run: |
uvx pre-commit run prettier --files generated_schema.json
- name: Check with stored schema
run: |
test -f $SNAPCRAFT_JSON &&
diff generated_schema.json $SNAPCRAFT_JSON
validate-schema:
runs-on: ubuntu-latest
env:
SPREAD_FILES_GLOB: tests/spread/core2{2,4}/**/snapcraft.yaml
steps:
- name: Checkout
uses: actions/checkout@v5
with:
fetch-depth: 0
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "22"
- name: Install ajv cli
run: npm install -g ajv-cli
- name: Run ajv
run: |
# Don't fail immediately if one validation fails
EXIT_CODE=0
for proj_file in $SPREAD_FILES_GLOB; do
if ! ajv validate -s $SNAPCRAFT_JSON \
-d $proj_file \
--strict=false --spec=draft2020; then
EXIT_CODE=1
fi
done
exit $EXIT_CODE