Skip to content

Commit bd5c609

Browse files
authored
Merge pull request #46 from superna9999/yaml-validate
Add yaml schema and validator
2 parents 01ebafc + 049cf31 commit bd5c609

File tree

14 files changed

+549
-0
lines changed

14 files changed

+549
-0
lines changed

.github/workflows/yaml.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# SPDX-License-Identifier: GPL-2.0
2+
#
3+
# Copyright (c) 2021 Canonical Ltd.
4+
# Copyright (c) 2023 Linaro Ltd
5+
# Author: Krzysztof Kozlowski <[email protected]>
6+
7+
#
8+
# Loosely based on: https://github.com/linux-test-project/ltp
9+
# https://github.com/linux-nfc/neard
10+
#
11+
name: "Yaml"
12+
on:
13+
pull_request:
14+
push:
15+
workflow_dispatch:
16+
17+
jobs:
18+
job:
19+
name: Yaml
20+
runs-on: ubuntu-latest
21+
permissions:
22+
actions: read
23+
contents: read
24+
25+
container:
26+
image: ubuntu:jammy
27+
28+
steps:
29+
- name: Git checkout
30+
uses: actions/checkout@v3
31+
32+
- name: Install additional packages
33+
run: |
34+
export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true
35+
apt update
36+
apt install -y --no-install-recommends yamllint python3-jsonschema python3-ruamel.yaml
37+
38+
- name: Lint samples
39+
run: for file in config-samples/*; do yamllint $file; done
40+
41+
- name: Check samples
42+
run: for file in config-samples/*; do python3 ./validate.py -s schema.yaml $file; done

.yamllint

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
extends: relaxed
2+
3+
rules:
4+
line-length:
5+
# 80 chars should be enough, but don't fail if a line is longer
6+
max: 110
7+
allow-non-breakable-words: true
8+
level: warning
9+
braces:
10+
min-spaces-inside: 0
11+
max-spaces-inside: 1
12+
min-spaces-inside-empty: 0
13+
max-spaces-inside-empty: 0
14+
brackets:
15+
min-spaces-inside: 0
16+
max-spaces-inside: 1
17+
min-spaces-inside-empty: 0
18+
max-spaces-inside-empty: 0
19+
colons: {max-spaces-before: 0, max-spaces-after: 1}
20+
commas: {min-spaces-after: 1, max-spaces-after: 1}
21+
comments:
22+
require-starting-space: true
23+
min-spaces-from-content: 1
24+
comments-indentation: disable
25+
document-start:
26+
present: true
27+
empty-lines:
28+
max: 3
29+
max-end: 1
30+
empty-values:
31+
forbid-in-block-mappings: true
32+
forbid-in-flow-mappings: true
33+
hyphens:
34+
max-spaces-after: 1
35+
indentation:
36+
spaces: 2
37+
indent-sequences: true
38+
check-multi-line-strings: false
39+
trailing-spaces: false

config-samples/sample1.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
devices:
3+
- board: myboard
4+
name: "My Board"
5+
description: |
6+
My Awesome board
7+
console: /dev/ttyABC0
8+
fastboot: cacafada
9+
fastboot_set_active: a
10+
fastboot_key_timeout: 2
11+
usb_always_on: false
12+
cdba: /dev/serial/by-id/usb-CDBA-if00
13+
voltage: 1800

config-samples/sample10.yaml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
---
2+
devices:
3+
- board: myboard
4+
name: "My Board"
5+
description: |
6+
My Awesome board
7+
console: /dev/ttyABC0
8+
fastboot: cacafada
9+
ftdi_gpio: "s:0x0403:0x6011:FT7YWRL8;D;POWER,1,ACTIVE_LOW;FASTBOOT_KEY,0,ACTIVE_HIGH;POWER_KEY,3,ACTIVE_HIGH;USB_DISCONNECT,7,ACTIVE_LOW"
10+
- board: myboard-2
11+
name: "My Board 2"
12+
description: |
13+
My Awesome board Number 2
14+
console: /dev/ttyABC1
15+
fastboot: cacafada
16+
ftdi_gpio: "s:0x0403:0x6011:FT7YWRL8;D;POWER_KEY,3,ACTIVE_HIGH;POWER,1,ACTIVE_LOW;FASTBOOT_KEY,0,ACTIVE_HIGH"
17+
- board: myboard-3
18+
name: "My Board 2"
19+
description: |
20+
My Awesome board Number 3
21+
console: /dev/ttyABC2
22+
fastboot: cacafada
23+
ftdi_gpio: "s:0x0403:0x6011:FT7YWRL8;D;FASTBOOT_KEY,0,ACTIVE_HIGH;POWER,1,ACTIVE_LOW"
24+
- board: myboard-4
25+
name: "My Board 2"
26+
description: |
27+
My Awesome board Number 4
28+
console: /dev/ttyABC3
29+
fastboot: cacafada
30+
ftdi_gpio: "s:0x0403:0x6011:FT7YWRL8;D;POWER,1,ACTIVE_LOW"
31+
- board: myboard-5
32+
name: "My Board 2"
33+
description: |
34+
My Awesome board Number 5
35+
console: /dev/ttyABC4
36+
fastboot: cacafada
37+
ftdi_gpio: "s:0x0403:0x6011:FT7YWRL8;D"
38+
- board: myboard-6
39+
name: "My Board 2"
40+
description: |
41+
My Awesome board Number 6
42+
console: /dev/ttyABC5
43+
fastboot: cacafada
44+
ftdi_gpio: "s:0x0403:0x6011:FT7YWRL8"
45+
- board: myboard-7
46+
name: "My Board 2"
47+
description: |
48+
My Awesome board Number 7
49+
console: /dev/ttyABC6
50+
fastboot: cacafada
51+
ftdi_gpio: "i:0x0403:0x6011;D;POWER,1,ACTIVE_LOW;FASTBOOT_KEY,0,ACTIVE_HIGH;POWER_KEY,3,ACTIVE_HIGH;USB_DISCONNECT,7,ACTIVE_LOW"
52+
- board: myboard-8
53+
name: "My Board 2"
54+
description: |
55+
My Awesome board Number 7
56+
console: /dev/ttyABC6
57+
fastboot: cacafada
58+
ftdi_gpio: "i:0x0403:0x6011:0;D;POWER,1,ACTIVE_LOW;FASTBOOT_KEY,0,ACTIVE_HIGH;POWER_KEY,3,ACTIVE_HIGH;USB_DISCONNECT,7,ACTIVE_LOW"
59+
- board: myboard-9
60+
name: "My Board 2"
61+
description: |
62+
My Awesome board Number 7
63+
console: /dev/ttyABC6
64+
fastboot: cacafada
65+
ftdi_gpio: "d:/dev/bus/usb/006/001;D;POWER,1,ACTIVE_LOW;FASTBOOT_KEY,0,ACTIVE_HIGH;POWER_KEY,3,ACTIVE_HIGH;USB_DISCONNECT,7,ACTIVE_LOW"

config-samples/sample2.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
devices:
3+
- board: myboard
4+
name: "My Board"
5+
description: |
6+
My Awesome board
7+
console: /dev/ttyABC0
8+
fastboot: cacafada
9+
fastboot_set_active: b
10+
fastboot_key_timeout: 2
11+
usb_always_on: false
12+
conmux: /dev/serial/by-id/usb-CDBA-if00

config-samples/sample3.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
devices:
3+
- board: myboard
4+
name: "My Board"
5+
description: |
6+
My Awesome board
7+
console: /dev/ttyABC0
8+
fastboot: cacafada
9+
fastboot_set_active: true
10+
fastboot_key_timeout: 2
11+
usb_always_on: false
12+
external: /path/to/my/awesome/script.sh

config-samples/sample4.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
devices:
3+
- board: myboard
4+
name: "My Board"
5+
description: |
6+
My Awesome board
7+
console: /dev/ttyABC0
8+
fastboot: cacafada
9+
fastboot_set_active: true
10+
fastboot_key_timeout: 2
11+
usb_always_on: false
12+
ppps_path: 2-2:1.0/2-2-port2
13+
ppps3_path: 2-2:2.0/2-2-port2

config-samples/sample5.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
devices:
3+
- board: myboard
4+
name: "My Board"
5+
description: |
6+
My Awesome board
7+
console: /dev/ttyABC0
8+
fastboot: cacafada
9+
fastboot_set_active: true
10+
fastboot_key_timeout: 2
11+
usb_always_on: false
12+
qcomlt_debug_board: /dev/serial/by-id/usb-DebugBoard-if00

config-samples/sample6.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
devices:
3+
- board: myboard
4+
name: "My Board"
5+
description: |
6+
My Awesome board
7+
console: /dev/ttyABC0
8+
fastboot: cacafada
9+
fastboot_set_active: true
10+
fastboot_key_timeout: 2
11+
usb_always_on: false
12+
alpaca: /dev/serial/by-id/usb-ALPACA-if00

config-samples/sample7.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
devices:
3+
- board: myboard
4+
name: "My Board"
5+
description: |
6+
My Awesome board
7+
console: /dev/ttyABC0
8+
fastboot: cacafada
9+
fastboot_set_active: true
10+
fastboot_key_timeout: 2
11+
usb_always_on: false
12+
cdba: /dev/serial/by-id/usb-CDBA-if00
13+
voltage: 1800
14+
users:
15+
- toto
16+
- tata

0 commit comments

Comments
 (0)