Skip to content

Commit 5d13710

Browse files
committed
ci: add job to verify wayland protocol files
1 parent 7507eb7 commit 5d13710

4 files changed

Lines changed: 89 additions & 0 deletions

File tree

‎.editorconfig‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
root = true
2+
3+
[*]
4+
charset = utf-8
5+
end_of_line = lf
6+
insert_final_newline = true
7+
trim_trailing_whitespace = true
8+
9+
[*.xml]
10+
indent_style = space
11+
indent_size = 2

‎.github/workflows/ci.yml‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
8+
jobs:
9+
validate:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
- name: Install libxml2-utils
14+
run: sudo apt-get update && sudo apt-get install -y libxml2-utils
15+
- name: Validate protocols
16+
run: ./check.sh

‎check.sh‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
#!/bin/sh
2+
# Validate protocol XML files against the Wayland DTD and check basic style.
3+
# Requires xmllint (libxml2).
4+
set -u
5+
6+
cd "$(dirname "$0")"
7+
8+
status=0
9+
10+
for xml in staging/*/*.xml; do
11+
if ! xmllint --noout --dtdvalid wayland.dtd "$xml"; then
12+
status=1
13+
fi
14+
15+
if grep -nP '\t' "$xml"; then
16+
echo "$xml: tabs found (use spaces)" >&2
17+
status=1
18+
fi
19+
20+
if grep -nP ' +$' "$xml"; then
21+
echo "$xml: trailing whitespace found" >&2
22+
status=1
23+
fi
24+
done
25+
26+
exit $status

‎wayland.dtd‎

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<!ELEMENT protocol (copyright?, description?, interface+)>
2+
<!ATTLIST protocol name CDATA #REQUIRED>
3+
<!ELEMENT copyright (#PCDATA)>
4+
<!ELEMENT interface (description?,(request|event|enum)+)>
5+
<!ATTLIST interface name CDATA #REQUIRED>
6+
<!ATTLIST interface version CDATA #REQUIRED>
7+
<!ATTLIST interface frozen CDATA #IMPLIED>
8+
<!ELEMENT request (description?,arg*)>
9+
<!ATTLIST request name CDATA #REQUIRED>
10+
<!ATTLIST request type CDATA #IMPLIED>
11+
<!ATTLIST request since CDATA #IMPLIED>
12+
<!ATTLIST request deprecated-since CDATA #IMPLIED>
13+
<!ELEMENT event (description?,arg*)>
14+
<!ATTLIST event name CDATA #REQUIRED>
15+
<!ATTLIST event type CDATA #IMPLIED>
16+
<!ATTLIST event since CDATA #IMPLIED>
17+
<!ATTLIST event deprecated-since CDATA #IMPLIED>
18+
<!ELEMENT enum (description?,entry*)>
19+
<!ATTLIST enum name CDATA #REQUIRED>
20+
<!ATTLIST enum since CDATA #IMPLIED>
21+
<!ATTLIST enum bitfield CDATA #IMPLIED>
22+
<!ELEMENT entry (description?)>
23+
<!ATTLIST entry name CDATA #REQUIRED>
24+
<!ATTLIST entry value CDATA #REQUIRED>
25+
<!ATTLIST entry summary CDATA #IMPLIED>
26+
<!ATTLIST entry since CDATA #IMPLIED>
27+
<!ATTLIST entry deprecated-since CDATA #IMPLIED>
28+
<!ELEMENT arg (description?)>
29+
<!ATTLIST arg name CDATA #REQUIRED>
30+
<!ATTLIST arg type CDATA #REQUIRED>
31+
<!ATTLIST arg summary CDATA #IMPLIED>
32+
<!ATTLIST arg interface CDATA #IMPLIED>
33+
<!ATTLIST arg allow-null CDATA #IMPLIED>
34+
<!ATTLIST arg enum CDATA #IMPLIED>
35+
<!ELEMENT description (#PCDATA)>
36+
<!ATTLIST description summary CDATA #REQUIRED>

0 commit comments

Comments
 (0)