Skip to content

Commit 3c197b1

Browse files
authored
✨ Add enable_clang_tidy option to tests.yml (#111)
* ✨ Add enable_clang_tidy option to tests.yml Set the option `enable_clang_tidy=True` for packages with that option available. * Make each self check dependant on its file
1 parent 99a7656 commit 3c197b1

2 files changed

Lines changed: 80 additions & 6 deletions

File tree

.github/workflows/self_check.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,38 @@ concurrency:
2828
cancel-in-progress: true
2929

3030
jobs:
31+
changes:
32+
runs-on: ubuntu-24.04
33+
outputs:
34+
library_check: ${{ steps.filter.outputs.library_check }}
35+
lint: ${{ steps.filter.outputs.lint }}
36+
docs: ${{ steps.filter.outputs.docs }}
37+
package_and_upload_all: ${{ steps.filter.outputs.package_and_upload_all }}
38+
app_builder2: ${{ steps.filter.outputs.app_builder2 }}
39+
tests: ${{ steps.filter.outputs.tests }}
40+
steps:
41+
- uses: actions/checkout@v4
42+
- uses: dorny/paths-filter@v3
43+
id: filter
44+
with:
45+
filters: |
46+
library_check:
47+
- '.github/workflows/library_check.yml'
48+
tests:
49+
- '.github/workflows/tests.yml'
50+
lint:
51+
- '.github/workflows/lint.yml'
52+
docs:
53+
- '.github/workflows/docs.yml'
54+
package_and_upload_all:
55+
- '.github/workflows/package_and_upload_all.yml'
56+
- '.github/workflows/package_and_upload.yml'
57+
app_builder2:
58+
- '.github/workflows/app_builder2.yml'
59+
3160
library_check_libhal_v4:
61+
needs: changes
62+
if: ${{ needs.changes.outputs.library_check == 'true' }}
3263
uses: ./.github/workflows/library_check.yml
3364
with:
3465
library: libhal
@@ -37,6 +68,8 @@ jobs:
3768
secrets: inherit
3869

3970
library_check_libhal-util:
71+
needs: changes
72+
if: ${{ needs.changes.outputs.library_check == 'true' }}
4073
uses: ./.github/workflows/library_check.yml
4174
with:
4275
library: libhal-util
@@ -45,27 +78,35 @@ jobs:
4578
secrets: inherit
4679

4780
libhal-actuator:
81+
needs: changes
82+
if: ${{ needs.changes.outputs.library_check == 'true' }}
4883
uses: ./.github/workflows/library_check.yml
4984
with:
5085
library: libhal-actuator
5186
repo: libhal/libhal-actuator
5287
secrets: inherit
5388

5489
libhal-sensor:
90+
needs: changes
91+
if: ${{ needs.changes.outputs.library_check == 'true' }}
5592
uses: ./.github/workflows/library_check.yml
5693
with:
5794
library: libhal-sensor
5895
repo: libhal/libhal-sensor
5996
secrets: inherit
6097

6198
libhal-expander:
99+
needs: changes
100+
if: ${{ needs.changes.outputs.library_check == 'true' }}
62101
uses: ./.github/workflows/library_check.yml
63102
with:
64103
library: libhal-expander
65104
repo: libhal/libhal-expander
66105
secrets: inherit
67106

68107
libhal-micromod-lint:
108+
needs: changes
109+
if: ${{ needs.changes.outputs.lint == 'true' }}
69110
uses: ./.github/workflows/lint.yml
70111
with:
71112
library: libhal-micromod
@@ -75,6 +116,8 @@ jobs:
75116
secrets: inherit
76117

77118
libhal-micromod-docs:
119+
needs: changes
120+
if: ${{ needs.changes.outputs.docs == 'true' }}
78121
uses: ./.github/workflows/docs.yml
79122
with:
80123
library: libhal-micromod
@@ -83,7 +126,18 @@ jobs:
83126
repo: libhal/libhal-micromod
84127
secrets: inherit
85128

129+
strong_ptr-tests:
130+
needs: changes
131+
if: ${{ needs.changes.outputs.tests == 'true' }}
132+
uses: ./.github/workflows/tests.yml
133+
with:
134+
library: strong_ptr
135+
repo: libhal/strong_ptr
136+
secrets: inherit
137+
86138
package-strong_ptr:
139+
needs: changes
140+
if: ${{ needs.changes.outputs.package_and_upload_all == 'true' }}
87141
uses: ./.github/workflows/package_and_upload_all.yml
88142
with:
89143
library: strong_ptr
@@ -93,6 +147,8 @@ jobs:
93147
secrets: inherit
94148

95149
package-libhal_v4:
150+
needs: changes
151+
if: ${{ needs.changes.outputs.package_and_upload_all == 'true' }}
96152
uses: ./.github/workflows/package_and_upload_all.yml
97153
with:
98154
library: libhal
@@ -102,6 +158,8 @@ jobs:
102158
secrets: inherit
103159

104160
package-libhal-util:
161+
needs: changes
162+
if: ${{ needs.changes.outputs.package_and_upload_all == 'true' }}
105163
uses: ./.github/workflows/package_and_upload_all.yml
106164
with:
107165
library: libhal-util
@@ -116,6 +174,8 @@ jobs:
116174
# TODO(libhal/libhal-util#87): Add libhal-util v6
117175

118176
libhal-arm-mcu-lpc4078-demos:
177+
needs: changes
178+
if: ${{ needs.changes.outputs.app_builder2 == 'true' }}
119179
uses: ./.github/workflows/app_builder2.yml
120180
with:
121181
repo: libhal/libhal-arm-mcu
@@ -125,6 +185,8 @@ jobs:
125185
secrets: inherit
126186

127187
libhal-expander-build-latest:
188+
needs: changes
189+
if: ${{ needs.changes.outputs.app_builder2 == 'true' }}
128190
uses: ./.github/workflows/app_builder2.yml
129191
with:
130192
repo: libhal/libhal-expander
@@ -134,6 +196,8 @@ jobs:
134196
platform_profile: hal/mcu/lpc4078
135197

136198
libhal-actuator-demos-lpc4078:
199+
needs: changes
200+
if: ${{ needs.changes.outputs.app_builder2 == 'true' }}
137201
uses: ./.github/workflows/app_builder2.yml
138202
with:
139203
repo: libhal/libhal-actuator
@@ -143,6 +207,8 @@ jobs:
143207
secrets: inherit
144208

145209
libhal-actuator-demos-lpc4074:
210+
needs: changes
211+
if: ${{ needs.changes.outputs.app_builder2 == 'true' }}
146212
uses: ./.github/workflows/app_builder2.yml
147213
with:
148214
repo: libhal/libhal-actuator
@@ -152,6 +218,8 @@ jobs:
152218
secrets: inherit
153219

154220
libhal-starter-app-lpc4078:
221+
needs: changes
222+
if: ${{ needs.changes.outputs.app_builder2 == 'true' }}
155223
uses: ./.github/workflows/app_builder2.yml
156224
with:
157225
repo: libhal/libhal-starter
@@ -160,6 +228,8 @@ jobs:
160228
secrets: inherit
161229

162230
libhal-starter-app-stm32f103c8:
231+
needs: changes
232+
if: ${{ needs.changes.outputs.app_builder2 == 'true' }}
163233
uses: ./.github/workflows/app_builder2.yml
164234
with:
165235
repo: libhal/libhal-starter
@@ -168,6 +238,8 @@ jobs:
168238
secrets: inherit
169239

170240
libhal-starter-app-mod-stmt32f1-v4:
241+
needs: changes
242+
if: ${{ needs.changes.outputs.app_builder2 == 'true' }}
171243
uses: ./.github/workflows/app_builder2.yml
172244
with:
173245
repo: libhal/libhal-starter

.github/workflows/tests.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,25 +19,25 @@ on:
1919
inputs:
2020
library:
2121
type: string
22-
required: true
22+
default: ${{ github.event.repository.name }}
2323
version:
2424
type: string
2525
default: ""
2626
coverage:
2727
type: boolean
28-
required: true
28+
default: false
2929
fail_on_coverage:
3030
type: boolean
31-
required: true
31+
default: false
3232
coverage_threshold:
3333
type: string
34-
required: true
34+
default: "40 80"
3535
repo:
3636
type: string
3737
required: true
3838
conan_version:
3939
type: string
40-
required: true
40+
default: 2.22.2
4141
config2_version:
4242
type: string
4343
default: main
@@ -46,6 +46,8 @@ on:
4646
type: string
4747
default: "."
4848
# (DEPRECATED) Version of LLVM to install via homebrew, no longer used
49+
# The llvm binary comes from the llvm-toolchain package within the llvm
50+
# profile.
4951
llvm:
5052
type: string
5153
default: "17"
@@ -103,4 +105,4 @@ jobs:
103105
run: conan config install https://github.com/libhal/conan-config2.git --args="-b ${{ inputs.config2_version }}"
104106

105107
- name: 🔬 Create & Run Unit Tests
106-
run: conan create ${{ inputs.dir }} -s:h build_type=Debug --version='latest' -s:h os=${{ matrix.os }} -s:h arch=${{ matrix.arch }} --build=missing -pr:h hal/tc/llvm
108+
run: conan create ${{ inputs.dir }} -s:h build_type=Debug --version='latest' -s:h os=${{ matrix.os }} -s:h arch=${{ matrix.arch }} --build=missing -pr:h hal/tc/llvm -o "*:enable_clang_tidy=True"

0 commit comments

Comments
 (0)