Skip to content

Commit 0facf6d

Browse files
committed
fixup! .github: Allow individual steps to fail
1 parent a068cb2 commit 0facf6d

File tree

2 files changed

+19
-31
lines changed

2 files changed

+19
-31
lines changed

.github/workflows/build.yml

Lines changed: 8 additions & 14 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 }}
@@ -118,40 +119,32 @@ jobs:
118119
source ci/build.sh
119120
assert_compiled
120121
121-
- name: Halt execution
122+
- name: Cancel steps
122123
if: ${{ failure() }}
123124
run: |
124125
echo "::error ::ci: Cannot proceed without a compiled kernel, the workflow will be cancelled."
125-
until curl -L \
126-
-X POST \
127-
-H "Accept: application/vnd.github+json" \
128-
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
129-
-H "X-GitHub-Api-Version: 2022-11-28" \
130-
"https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/cancel" ; do
131-
sleep 5
132-
done
133-
while true ; do sleep 10 ; done
126+
"FATAL=true" >> "$GITHUB_ENV"
134127
135128
- name: Sparse
136-
if: ${{ !cancelled() && env.CHECKS_SPARCE == 'true' }}
129+
if: ${{ !cancelled() && env.FATAL != 'true' && env.CHECKS_SPARCE == 'true' }}
137130
run: |
138131
source ci/build.sh
139132
compile_kernel_sparse
140133
141134
- name: GCC fanalyzer
142-
if: ${{ !cancelled() && env.CHECKS_GCC_FANALYZER == 'true' }}
135+
if: ${{ !cancelled() && env.FATAL != 'true' && env.CHECKS_GCC_FANALYZER == 'true' }}
143136
run: |
144137
source ci/build.sh
145138
compile_gcc_fanalyzer
146139
147140
- name: Clang analyzer
148-
if: ${{ !cancelled() && env.CHECKS_CLANG_ANALYZER == 'true' }}
141+
if: ${{ !cancelled() && env.FATAL != 'true' && env.CHECKS_CLANG_ANALYZER == 'true' }}
149142
run: |
150143
source ci/build.sh
151144
compile_clang_analyzer
152145
153146
- name: Smatch
154-
if: ${{ !cancelled() && env.CHECKS_SMATCH == 'true' }}
147+
if: ${{ !cancelled() && env.FATAL != 'true' && env.CHECKS_SMATCH == 'true' }}
155148
run: |
156149
source ci/build.sh
157150
compile_kernel_smatch
@@ -169,3 +162,4 @@ jobs:
169162
run: |
170163
source ci/runner_env.sh
171164
export_labels
165+
# [ "$FATAL" == 'true' ] && exit 1

.github/workflows/checks.yml

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ jobs:
1616
checks:
1717
timeout-minutes: 7200
1818
runs-on: [self-hosted, v1]
19+
# continue-on-error: true
1920

2021
outputs:
2122
fail: ${{ steps.assert.outputs.fail }}
@@ -29,28 +30,20 @@ jobs:
2930
source ci/build.sh
3031
apply_prerun
3132
32-
- name: Halt execution
33+
- name: Cancel steps
3334
if: ${{ failure() }}
3435
run: >
3536
echo "::error ::ci: Cannot proceed at this condition, the workflow will be cancelled."
36-
until curl -L \
37-
-X POST \
38-
-H "Accept: application/vnd.github+json" \
39-
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
40-
-H "X-GitHub-Api-Version: 2022-11-28" \
41-
"https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/cancel" ; do
42-
sleep 5
43-
done
44-
while true ; do sleep 10 ; done
37+
"FATAL=true" >> "$GITHUB_ENV"
4538
4639
- name: License
47-
if: ${{ !cancelled() }}
40+
if: ${{ !cancelled() && env.FATAL != 'true' }}
4841
run: |
4942
source ci/build.sh
5043
check_license
5144
5245
- name: Check patch
53-
if: ${{ !cancelled() }}
46+
if: ${{ !cancelled() && env.FATAL != 'true' }}
5447
run: |
5548
source ci/build.sh
5649
export -f check_checkpatch set_step_fail set_step_warn
@@ -59,7 +52,7 @@ jobs:
5952
exit $status
6053
6154
- name: Coccicheck
62-
if: ${{ !cancelled() }}
55+
if: ${{ !cancelled() && env.FATAL != 'true' }}
6356
run: |
6457
source ci/build.sh
6558
export -f check_coccicheck set_step_fail set_step_warn
@@ -68,13 +61,13 @@ jobs:
6861
exit $status
6962
7063
- name: CPP Check
71-
if: ${{ !cancelled() }}
64+
if: ${{ !cancelled() && env.FATAL != 'true' }}
7265
run: |
7366
source ci/build.sh
7467
check_cppcheck
7568
7669
- name: Checkout and patch reference branch
77-
if: ${{ !cancelled() && !startsWith(github.base_ref, 'mirror/') && !startsWith(github.ref_name, 'mirror/') }}
70+
if: ${{ !cancelled() && env.FATAL != 'true' && !startsWith(github.base_ref, 'mirror/') && !startsWith(github.ref_name, 'mirror/') }}
7871
run: |
7972
git fetch origin --depth=1 "${{ inputs.ref_branch }}" &&
8073
git reset --hard origin/${{ inputs.ref_branch }} ||
@@ -110,13 +103,13 @@ jobs:
110103
done <<< "$files"
111104
112105
- name: Check dt-bindings
113-
if: ${{ !cancelled() }}
106+
if: ${{ !cancelled() && env.FATAL != 'true' }}
114107
run: |
115108
source ci/build.sh
116109
check_dt_binding_check
117110
118111
- name: Revert patch reference branch
119-
if: ${{ !cancelled() && !startsWith(github.base_ref, 'mirror/') && !startsWith(github.ref_name, 'mirror/') }}
112+
if: ${{ !cancelled() && env.FATAL != 'true' && !startsWith(github.base_ref, 'mirror/') && !startsWith(github.ref_name, 'mirror/') }}
120113
run: |
121114
git reset --hard $head_sha
122115
@@ -126,4 +119,5 @@ jobs:
126119
run: |
127120
echo "warn=$(printenv | grep ^step_warn_ | grep -v =$ | tr '\n' ',' | sed 's/,$//')" >> "$GITHUB_OUTPUT"
128121
echo "fail=$(printenv | grep ^step_fail_ | grep -v =$ | tr '\n' ',' | sed 's/,$//')" >> "$GITHUB_OUTPUT"
122+
# [ "$FATAL" == 'true' ] && exit 1
129123

0 commit comments

Comments
 (0)