Repository navigation
144 lines (127 loc) · 4.4 KB
/
Copy pathcodestyle.yml
File metadata and controls
144 lines (127 loc) · 4.4 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
---
# SPDX-License-Identifier: BSD-3-Clause
name: Codestyle & Manifest Checks
# yamllint disable-line rule:truthy
on:
push:
branches:
- 'main'
pull_request:
branches:
- 'main'
workflow_dispatch:
permissions: {}
concurrency:
group: "${{ github.workflow }}-${{ github.event_name }}-\
${{ github.event_name == 'pull_request' && github.ref || github.run_id }}"
cancel-in-progress: true
jobs:
yamllint:
name: YAML lint
runs-on: ubuntu-24.04
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install yamllint
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends yamllint
- name: Run yamllint
env:
yamllint_config: '{extends: default, rules: {line-length: {max: 100}}}'
run: |
yamllint -f parsable -d "$yamllint_config" --strict \
.github/workflows/*.yml *.yml
spdx-check:
name: SPDX license headers
runs-on: ubuntu-24.04
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Verify SPDX-License-Identifier headers
run: |
set -euo pipefail
missing=0
while IFS= read -r f; do
case "$f" in
.github/workflows/*.yml|scripts/*.sh|cmake/*.cmake|\
CMakeLists.txt|Makefile|west.yml|\
tools/validate-*.py|tools/pretty-macro.sh)
if ! head -n 5 "$f" | grep -q "SPDX-License-Identifier:"; then
echo "ERROR: missing SPDX-License-Identifier header in $f"
missing=1
fi
;;
esac
done < <(git ls-files)
exit "$missing"
shell-syntax:
name: Shell script syntax
runs-on: ubuntu-24.04
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Check bash syntax on tracked shell scripts
run: |
set -euo pipefail
while IFS= read -r f; do
echo "Checking $f"
bash -n "$f"
done < <(git ls-files '*.sh')
python-lint:
name: Python fatal lint (ruff)
runs-on: ubuntu-24.04
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Run ruff fatal checks
uses: astral-sh/ruff-action@278981a28ce3188b1e39527901f38254bf3aac89 # v4.1.0
with:
args: "check --select E9,F63,F7,F82"
src: "tools validator"
manifest-consistency:
name: West manifest & ALSA pin parity
runs-on: ubuntu-24.04
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Install python3-yaml
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends python3-yaml
- name: Verify west.yml and build-alsa-tools.sh ALSA revisions match
run: |
python3 - <<'PYEOF'
import pathlib
import re
import yaml
west = yaml.safe_load(pathlib.Path("west.yml").read_text())
projects = {p["name"]: p["revision"] for p in west["manifest"]["projects"]}
sh_text = pathlib.Path("scripts/build-alsa-tools.sh").read_text()
m = re.search(r"COMMIT_ID=\(\s*([^)]+)\)", sh_text, re.DOTALL)
assert m, "COMMIT_ID array not found in scripts/build-alsa-tools.sh"
sh_commits = re.findall(r'"([0-9a-f]{40})"', m.group(1))
assert len(sh_commits) == 2, f"Expected 2 ALSA commits, got {sh_commits}"
assert projects["alsa-lib"] == sh_commits[0], (
f"alsa-lib mismatch: west.yml={projects['alsa-lib']} vs sh={sh_commits[0]}"
)
assert projects["alsa-utils"] == sh_commits[1], (
f"alsa-utils mismatch: west.yml={projects['alsa-utils']} vs sh={sh_commits[1]}"
)
print("ALSA pins match cleanly:", projects["alsa-lib"], projects["alsa-utils"])
PYEOF