File tree Expand file tree Collapse file tree 2 files changed +55
-14
lines changed Expand file tree Collapse file tree 2 files changed +55
-14
lines changed Original file line number Diff line number Diff line change 4
4
push :
5
5
branches :
6
6
- ' main'
7
- paths :
8
- - ' **/*.c'
9
- - ' **/*.cpp'
10
- - ' **/*.h'
11
- - ' **/*.hpp'
12
7
13
8
pull_request :
14
9
types :
18
13
- synchronize
19
14
branches :
20
15
- ' main'
21
- paths :
22
- - ' **/*.c'
23
- - ' **/*.cpp'
24
- - ' **/*.h'
25
- - ' **/*.hpp'
26
16
27
17
workflow_dispatch :
28
18
inputs :
52
42
submodules : false
53
43
persist-credentials : false
54
44
45
+ - name : Check for relevant file changes
46
+ id : changes
47
+ run : |
48
+ if [ "${{ github.event_name }}" == "push" ]; then
49
+ # For pushes, compare with previous commit
50
+ CHANGED_FILES=$(git diff --name-only HEAD~1 HEAD)
51
+ else
52
+ # For PRs, compare with base branch
53
+ git fetch origin ${{ github.base_ref }}
54
+ CHANGED_FILES=$(git diff --name-only origin/${{ github.base_ref }}...HEAD)
55
+ fi
56
+
57
+ echo "Changed files:"
58
+ echo "$CHANGED_FILES"
59
+
60
+ if echo "$CHANGED_FILES" | grep -E '\.(c|cpp|h|hpp)$'; then
61
+ echo "has_format_files=true" >> $GITHUB_OUTPUT
62
+ else
63
+ echo "has_format_files=false" >> $GITHUB_OUTPUT
64
+ fi
65
+
55
66
- name : Run clang-format check
67
+ if : steps.changes.outputs.has_format_files == 'true'
56
68
57
69
with :
58
70
clang-format-version : ' 19'
59
71
check-path : ${{ matrix.path['check'] }}
60
72
exclude-regex : ${{ matrix.path['exclude'] }}
73
+
74
+ verify-format :
75
+ name : verify-format
76
+ runs-on : ubuntu-latest
77
+ if : always()
78
+ needs : format-check
79
+ steps :
80
+ - name : Check format results
81
+ run : |
82
+ if [[ "${{ needs.format-check.result }}" == "failure" ||
83
+ "${{ needs.format-check.result }}" == "cancelled" ]]; then
84
+ echo "Format check failed or was cancelled"
85
+ exit 1
86
+ else
87
+ echo "Format check completed successfully or was skipped"
88
+ fi
89
+
Original file line number Diff line number Diff line change 30
30
- name : Initialize Zephyr environment
31
31
run : |
32
32
yes | ./extra/bootstrap.sh -o=--filter=tree:0
33
+ source venv/bin/activate
34
+ echo "ZEPHYR_SDK_INSTALL_DIR=$(west config sdk.base-dir)" >> "$GITHUB_ENV"
33
35
echo "CORE_TAG=$(git describe --tags --exact-match || git describe --always)" >> "$GITHUB_ENV"
34
36
echo "CORE_ARTIFACT=ArduinoCore-zephyr-$(git describe --always)" >> "$GITHUB_ENV"
35
37
echo "BOARD_VARIANTS=$(extra/get_board_details.sh | jq -cr 'sort_by(.variant)')" >> "$GITHUB_ENV"
42
44
- name : Build variants
43
45
shell : bash
44
46
run : |
47
+ source venv/bin/activate
45
48
./extra/build_all.sh -f
46
49
47
50
- name : Package core
@@ -184,15 +187,24 @@ jobs:
184
187
failOnError : false
185
188
186
189
verify-core :
187
- name : Collect job errors
190
+ name : verify-core
188
191
runs-on : ubuntu-latest
189
- if : cancelled() || contains(needs.*.result, 'failure' )
192
+ if : always( )
190
193
needs :
191
194
- package-core
192
195
- test-core
193
196
steps :
194
- - name : Notify failure
195
- run : exit 1
197
+ - name : Check job results
198
+ run : |
199
+ if [[ "${{ needs.package-core.result }}" == "failure" ||
200
+ "${{ needs.test-core.result }}" == "failure" ||
201
+ "${{ needs.package-core.result }}" == "cancelled" ||
202
+ "${{ needs.test-core.result }}" == "cancelled" ]]; then
203
+ echo "One or more required jobs failed or were cancelled"
204
+ exit 1
205
+ else
206
+ echo "All required jobs completed successfully"
207
+ fi
196
208
197
209
publish-core :
198
210
name : Publish core
You can’t perform that action at this time.
0 commit comments