Skip to content

Commit 6ddcc24

Browse files
committed
.github: Allow individual steps to fail
So we can show a pretty red X on the GUI, by returning error codes from the bash methods, beyond the fail environment variable. Signed-off-by: Jorge Marques <[email protected]>
1 parent 6aa64a8 commit 6ddcc24

File tree

3 files changed

+58
-26
lines changed

3 files changed

+58
-26
lines changed

.github/workflows/build.yml

Lines changed: 26 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ jobs:
3737
build:
3838
timeout-minutes: 7200
3939
runs-on: [self-hosted, v1]
40+
continue-on-error: true
4041

4142
outputs:
4243
fail: ${{ steps.assert.outputs.fail }}
@@ -101,54 +102,63 @@ jobs:
101102
source ci/build.sh
102103
compile_kernel
103104
105+
- name: Prepare dist
106+
run: |
107+
if [[ -d dist ]]; then
108+
rm -r dist
109+
fi
110+
mkdir -p dist/modules
111+
cp defconfig dist
112+
cp arch/${{ inputs.ARCH }}/boot/*Image dist
113+
find . -type f -name *.ko | \
114+
xargs -I % cp --parents % dist/modules
115+
104116
- name: Assert compiled
105117
if: ${{ env.AUTO_FROM_RANGE == 'true' }}
106118
run: |
107119
source ci/build.sh
108120
assert_compiled
109121
122+
- name: Assert state
123+
if: ${{ failure() }}
124+
run: |
125+
source ci/build.sh
126+
set_step_fail "assert_state"
127+
echo "fatal=true" >> "$GITHUB_ENV"
128+
110129
- name: Sparse
111-
if: ${{ env.CHECKS_SPARCE == 'true' }}
130+
if: ${{ !cancelled() && env.fatal != 'true' && env.CHECKS_SPARCE == 'true' }}
112131
run: |
113132
source ci/build.sh
114133
compile_kernel_sparse
115134
116135
- name: GCC fanalyzer
117-
if: ${{ env.CHECKS_GCC_FANALYZER == 'true' }}
136+
if: ${{ !cancelled() && env.fatal != 'true' && env.CHECKS_GCC_FANALYZER == 'true' }}
118137
run: |
119138
source ci/build.sh
120139
compile_gcc_fanalyzer
121140
122141
- name: Clang analyzer
123-
if: ${{ env.CHECKS_CLANG_ANALYZER == 'true' }}
142+
if: ${{ !cancelled() && env.fatal != 'true' && env.CHECKS_CLANG_ANALYZER == 'true' }}
124143
run: |
125144
source ci/build.sh
126145
compile_clang_analyzer
127146
128147
- name: Smatch
129-
if: ${{ env.CHECKS_SMATCH == 'true' }}
148+
if: ${{ !cancelled() && env.fatal != 'true' && env.CHECKS_SMATCH == 'true' }}
130149
run: |
131150
source ci/build.sh
132151
compile_kernel_smatch
133152
134-
- name: Prepare dist
135-
run: |
136-
if [[ -d dist ]]; then
137-
rm -r dist
138-
fi
139-
mkdir -p dist/modules
140-
cp defconfig dist
141-
cp arch/${{ inputs.ARCH }}/boot/*Image dist
142-
find . -type f -name *.ko | \
143-
xargs -I % cp --parents % dist/modules
144-
145153
- name: Store the distribution packages
154+
if: ${{ !cancelled() }}
146155
uses: actions/upload-artifact@v4
147156
with:
148157
name: dist-${{ inputs.DEFCONFIG }}-${{ env.CID }}-${{ inputs.ARCH }}
149158
path: dist
150159

151-
- name: Assert compile
160+
- name: Export labels
161+
if: ${{ !cancelled() }}
152162
id: assert
153163
run: |
154164
source ci/runner_env.sh

.github/workflows/checks.yml

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ on:
77
required: true
88
type: string
99
outputs:
10+
fatal:
11+
value: ${{ jobs.checks.outputs.fatal}}
1012
fail:
1113
value: ${{ jobs.checks.outputs.fail }}
1214
warn:
@@ -16,8 +18,10 @@ jobs:
1618
checks:
1719
timeout-minutes: 7200
1820
runs-on: [self-hosted, v1]
21+
continue-on-error: true
1922

2023
outputs:
24+
fatal: ${{ steps.assert.outputs.fatal }}
2125
fail: ${{ steps.assert.outputs.fail }}
2226
warn: ${{ steps.assert.outputs.warn }}
2327

@@ -29,32 +33,45 @@ jobs:
2933
source ci/build.sh
3034
apply_prerun
3135
36+
- name: Assert state
37+
if: ${{ failure() }}
38+
run: |
39+
source ci/build.sh
40+
set_step_fail "assert_state"
41+
echo "fatal=true" >> "$GITHUB_ENV"
42+
3243
- name: License
44+
if: ${{ !cancelled() && env.fatal != 'true' }}
3345
run: |
3446
source ci/build.sh
3547
check_license
3648
3749
- name: Check patch
50+
if: ${{ !cancelled() && env.fatal != 'true' }}
3851
run: |
3952
source ci/build.sh
4053
export -f check_checkpatch set_step_fail set_step_warn
41-
timeout 1d bash -c "check_checkpatch" || \
42-
echo "step_fail_checkpatch_timeout=true" >> "$GITHUB_ENV"
54+
status=0; timeout 1d bash -c "check_checkpatch" || status=$?
55+
[ $status -eq 124 ] && echo "step_fail_checkpatch_timeout=true" >> "$GITHUB_ENV"
56+
exit $status
4357
4458
- name: Coccicheck
59+
if: ${{ !cancelled() && env.fatal != 'true' }}
4560
run: |
4661
source ci/build.sh
4762
export -f check_coccicheck set_step_fail set_step_warn
48-
timeout 1d bash -c "check_coccicheck" || \
49-
echo "step_fail_coccicheck_timeout=true" >> "$GITHUB_ENV"
63+
status=0; timeout 1d bash -c "check_coccicheck" || status=$?
64+
[ $status -eq 124 ] && echo "step_fail_coccicheck_timeout=true" >> "$GITHUB_ENV"
65+
exit $status
5066
5167
- name: CPP Check
68+
if: ${{ !cancelled() && env.fatal != 'true' }}
5269
run: |
5370
source ci/build.sh
5471
check_cppcheck
5572
5673
- name: Checkout and patch reference branch
57-
if: ${{ !startsWith(github.base_ref, 'mirror/') && !startsWith(github.ref_name, 'mirror/') }}
74+
if: ${{ !cancelled() && env.fatal != 'true' && !startsWith(github.base_ref, 'mirror/') && !startsWith(github.ref_name, 'mirror/') }}
5875
run: |
5976
git fetch origin --depth=1 "${{ inputs.ref_branch }}" &&
6077
git reset --hard origin/${{ inputs.ref_branch }} ||
@@ -90,18 +107,21 @@ jobs:
90107
done <<< "$files"
91108
92109
- name: Check dt-bindings
110+
if: ${{ !cancelled() && env.fatal != 'true' }}
93111
run: |
94112
source ci/build.sh
95113
check_dt_binding_check
96114
97115
- name: Revert patch reference branch
98-
if: ${{ !startsWith(github.base_ref, 'mirror/') && !startsWith(github.ref_name, 'mirror/') }}
116+
if: ${{ !cancelled() && env.fatal != 'true' && !startsWith(github.base_ref, 'mirror/') && !startsWith(github.ref_name, 'mirror/') }}
99117
run: |
100118
git reset --hard $head_sha
101119
102-
- name: Assert checks
120+
- name: Export labels
121+
if: ${{ !cancelled() }}
103122
id: assert
104123
run: |
105-
echo "warn=$(printenv | grep ^step_warn_ | grep -v =$ | tr '\n' ',' | sed 's/,$//')" >> "$GITHUB_OUTPUT"
106-
echo "fail=$(printenv | grep ^step_fail_ | grep -v =$ | tr '\n' ',' | sed 's/,$//')" >> "$GITHUB_OUTPUT"
124+
echo "fatal=$fatal" >> "$GITHUB_OUTPUT"
125+
source ci/runner_env.sh
126+
export_labels
107127

.github/workflows/top-level.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ jobs:
2727
build_gcc_x86_64:
2828
uses: ./.github/workflows/build.yml
2929
needs: [checks]
30+
if: needs.checks.outputs.fatal != 'true'
3031
secrets: inherit
3132
with:
3233
CXX: "14"
@@ -35,6 +36,7 @@ jobs:
3536
build_llvm_x86_64:
3637
uses: ./.github/workflows/build.yml
3738
needs: [checks]
39+
if: needs.checks.outputs.fatal != 'true'
3840
secrets: inherit
3941
with:
4042
LLVM: "19"
@@ -44,6 +46,7 @@ jobs:
4446
build_gcc_aarch64:
4547
uses: ./.github/workflows/build.yml
4648
needs: [checks]
49+
if: needs.checks.outputs.fatal != 'true'
4750
secrets: inherit
4851
with:
4952
CXX: "14"
@@ -52,7 +55,6 @@ jobs:
5255
DEFCONFIG: "adi_ci_defconfig"
5356
build_gcc_arm:
5457
uses: ./.github/workflows/build.yml
55-
#needs: [checks]
5658
secrets: inherit
5759
with:
5860
CXX: "14"

0 commit comments

Comments
 (0)