-
Notifications
You must be signed in to change notification settings - Fork 38
179 lines (144 loc) · 4.09 KB
/
lint.yml
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
name: Lint
on:
pull_request:
branches: [main, hirte-*]
workflow_dispatch:
jobs:
changes:
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
clang: ${{ steps.filter.outputs.clang }}
md: ${{ steps.filter.outputs.md }}
python: ${{ steps.filter.outputs.python }}
apispec: ${{ steps.filter.outputs.apispec }}
steps:
- name: Detect changed files
uses: dorny/paths-filter@v3
id: filter
with:
filters: |
clang:
- '**/*.c'
- '**/*.h'
- '**/meson.build'
- 'meson_options.txt'
md:
- '**/*.md'
python:
- 'tests/**/*.py'
- 'doc/**/*.py'
apispec:
- 'data/*.xml'
common:
name: Common
runs-on: ubuntu-latest
container:
image: quay.io/bluechi/build-base:latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
submodules: 'true'
- name: Check SPDX headers
run: |
./build-scripts/spdx-header-check.sh
- name: Check Copyright headers
run: |
./build-scripts/copyright-header-check.sh
- name: Running codespell checker
run: |
make check-codespell
clang:
needs: changes
if: ${{ needs.changes.outputs.clang == 'true' }}
name: C
runs-on: ubuntu-latest
container:
image: quay.io/bluechi/build-base:latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
submodules: 'true'
- name: Initialize meson configuration
run: |
meson setup builddir
- name: Running source code format check
run: |
ninja -C builddir clang-format-check
- name: Running static analysis
run: |
ninja -C builddir clang-tidy
markdown:
needs: changes
if: ${{ needs.changes.outputs.md == 'true' }}
name: Markdown
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
submodules: 'true'
- name: Running markdown lint
uses: DavidAnson/markdownlint-cli2-action@v15
python:
needs: changes
if: ${{ needs.changes.outputs.python == 'true' }}
name: Python
runs-on: ubuntu-latest
container:
image: quay.io/bluechi/build-base:latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
submodules: 'true'
- name: Run flake8
run: |
source /opt/bluechi-env/bin/activate
flake8 doc tests
deactivate
- name: Run isort
run: |
source /opt/bluechi-env/bin/activate
isort doc tests --check --diff
deactivate
- name: Run black
run: |
source /opt/bluechi-env/bin/activate
black doc --check --diff
black tests --check --diff
deactivate
apispec:
needs: changes
if: ${{ needs.changes.outputs.apispec == 'true' }}
name:
runs-on: ubuntu-latest
container:
image: quay.io/bluechi/build-base:latest
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
submodules: 'true'
- name: Install dependencies
run: |
python3 -m ensurepip --default-pip
python3 -m pip install -r requirements.txt
python3 -m pip install -r src/bindings/generator/requirements.txt
pip install wheel
dnf install -y python3-gobject
- name: Generate and build python bindings
run: |
./build-scripts/generate-bindings.sh python
./build-scripts/build-bindings.sh python
- name: Check for changes in generated python code
run: |
git config --global --add safe.directory $(pwd)
git diff --exit-code src/bindings/python/
- name: Prompt rebuilding python bindings
if: ${{ failure() }}
run: |
echo "Changes in D-Bus API spec detected. Please generated them."