Skip to content

Commit c243800

Browse files
authored
[CI] Remove redundant always() (#20587)
Zizmor raised this alert - https://github.com/intel/llvm/security/code-scanning/2537 I looked deeper. We have lots of "always() && some_condition" where *some_condition* makes always() redundant.
1 parent 4474e85 commit c243800

12 files changed

+74
-78
lines changed

.github/workflows/sycl-linux-build.yml

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ jobs:
210210
# Emulate default value for manual dispatch as we've run out of available arguments.
211211
run: cmake --build $GITHUB_WORKSPACE/build --target ${{ inputs.build_target || 'sycl-toolchain' }}
212212
- name: check-llvm
213-
if: always() && !cancelled() && contains(inputs.changes, 'llvm')
213+
if: ${{ !cancelled() && contains(inputs.changes, 'llvm') }}
214214
env:
215215
# Can't inline to support possible quotes inside:
216216
BUILD_CONFIGURE_EXTRA_ARGS: ${{ inputs.build_configure_extra_args }}
@@ -222,7 +222,7 @@ jobs:
222222
223223
cmake --build $GITHUB_WORKSPACE/build --target check-llvm
224224
- name: check-clang
225-
if: always() && !cancelled() && contains(inputs.changes, 'clang')
225+
if: ${{ !cancelled() && contains(inputs.changes, 'clang') }}
226226
env:
227227
# Can't inline to support possible quotes inside:
228228
BUILD_CONFIGURE_EXTRA_ARGS: ${{ inputs.build_configure_extra_args }}
@@ -235,71 +235,71 @@ jobs:
235235
fi
236236
cmake --build $GITHUB_WORKSPACE/build --target check-clang
237237
- name: check-sycl
238-
if: always() && !cancelled() && contains(inputs.changes, 'sycl')
238+
if: ${{ !cancelled() && contains(inputs.changes, 'sycl') }}
239239
run: |
240240
# TODO consider moving this to Dockerfile.
241241
export LD_LIBRARY_PATH=/usr/local/cuda/compat/:/usr/local/cuda/lib64:$LD_LIBRARY_PATH
242242
cmake --build $GITHUB_WORKSPACE/build --target check-sycl
243243
- name: check-sycl-unittests
244-
if: always() && !cancelled() && contains(inputs.changes, 'sycl')
244+
if: ${{ !cancelled() && contains(inputs.changes, 'sycl') }}
245245
run: |
246246
# TODO consider moving this to Dockerfile.
247247
export LD_LIBRARY_PATH=/usr/local/cuda/compat/:/usr/local/cuda/lib64:$LD_LIBRARY_PATH
248248
cmake --build $GITHUB_WORKSPACE/build --target check-sycl-unittests
249249
- name: check-llvm-spirv
250-
if: always() && !cancelled() && contains(inputs.changes, 'llvm_spirv')
250+
if: ${{ !cancelled() && contains(inputs.changes, 'llvm_spirv') }}
251251
run: |
252252
cmake --build $GITHUB_WORKSPACE/build --target check-llvm-spirv
253253
- name: check-xptifw
254-
if: always() && !cancelled() && contains(inputs.changes, 'xptifw')
254+
if: ${{ !cancelled() && contains(inputs.changes, 'xptifw') }}
255255
run: |
256256
cmake --build $GITHUB_WORKSPACE/build --target check-xptifw
257257
- name: check-libclc
258-
if: always() && !cancelled() && contains(inputs.changes, 'libclc')
258+
if: ${{ !cancelled() && contains(inputs.changes, 'libclc') }}
259259
run: |
260260
cmake --build $GITHUB_WORKSPACE/build --target check-libclc
261261
- name: check-libdevice
262-
if: always() && !cancelled() && contains(inputs.changes, 'sycl')
262+
if: ${{ !cancelled() && contains(inputs.changes, 'sycl') }}
263263
run: |
264264
cmake --build $GITHUB_WORKSPACE/build --target check-libdevice
265265
- name: Check E2E test requirements
266-
if: always() && !cancelled() && !contains(inputs.changes, 'sycl')
266+
if: ${{ !cancelled() && !contains(inputs.changes, 'sycl') }}
267267
run: |
268268
# TODO consider moving this to Dockerfile.
269269
export LD_LIBRARY_PATH=/usr/local/cuda/compat/:/usr/local/cuda/lib64:$LD_LIBRARY_PATH
270270
LIT_OPTS="--allow-empty-runs" LIT_FILTER="e2e_test_requirements" cmake --build $GITHUB_WORKSPACE/build --target check-sycl
271271
- name: Install sycl-toolchain
272-
if: ${{ always() && !cancelled() && steps.build.conclusion == 'success' }}
272+
if: ${{ !cancelled() && steps.build.conclusion == 'success' }}
273273
run: |
274274
cmake --build $GITHUB_WORKSPACE/build --target deploy-sycl-toolchain
275275
276276
- name: Pack toolchain release
277-
if: ${{ always() && !cancelled() && steps.build.conclusion == 'success' && inputs.release_toolchain_artifact != '' }}
277+
if: ${{ !cancelled() && steps.build.conclusion == 'success' && inputs.release_toolchain_artifact != '' }}
278278
run: tar -I '${{ steps.artifact_info.outputs.COMPRESS }}' -cf ${{ steps.artifact_info.outputs.ARCHIVE_NAME }} -C $GITHUB_WORKSPACE/toolchain .
279279
- name: Upload toolchain release
280-
if: ${{ always() && !cancelled() && steps.build.conclusion == 'success' && inputs.release_toolchain_artifact != '' }}
280+
if: ${{ !cancelled() && steps.build.conclusion == 'success' && inputs.release_toolchain_artifact != '' }}
281281
uses: actions/upload-artifact@v5
282282
with:
283283
name: ${{ inputs.release_toolchain_artifact }}
284284
path: ${{ steps.artifact_info.outputs.ARCHIVE_NAME }}
285285
retention-days: ${{ inputs.retention-days }}
286286

287287
- name: Install utilities
288-
if: ${{ always() && !cancelled() && steps.build.conclusion == 'success' }}
288+
if: ${{ !cancelled() && steps.build.conclusion == 'success' }}
289289
run: |
290290
cmake --build $GITHUB_WORKSPACE/build --target install-sycl-test-utilities
291291
292292
- name: Additional Install for "--shared-libs" build
293-
if: ${{ always() && !cancelled() && steps.build.conclusion == 'success' && contains(inputs.build_configure_extra_args, '--shared-libs') }}
293+
if: ${{ !cancelled() && steps.build.conclusion == 'success' && contains(inputs.build_configure_extra_args, '--shared-libs') }}
294294
run: |
295295
cmake --build $GITHUB_WORKSPACE/build --target install-clang-libraries
296296
cmake --build $GITHUB_WORKSPACE/build --target install-llvm-libraries
297297
298298
- name: Pack toolchain
299-
if: ${{ always() && !cancelled() && steps.build.conclusion == 'success' }}
299+
if: ${{ !cancelled() && steps.build.conclusion == 'success' }}
300300
run: tar -I '${{ steps.artifact_info.outputs.COMPRESS }}' -cf ${{ steps.artifact_info.outputs.ARCHIVE_NAME }} -C $GITHUB_WORKSPACE/toolchain .
301301
- name: Upload toolchain
302-
if: ${{ always() && !cancelled() && steps.build.conclusion == 'success' }}
302+
if: ${{ !cancelled() && steps.build.conclusion == 'success' }}
303303
uses: actions/upload-artifact@v5
304304
with:
305305
name: ${{ inputs.toolchain_artifact }}
@@ -310,7 +310,7 @@ jobs:
310310
- name: Source OneAPI TBB vars.sh
311311
# Tasks that use the just built toolchain below, need extra environment
312312
# setup. No harm in it if all of those tasks would get skipped.
313-
if: ${{ always() && !cancelled() && steps.build.conclusion == 'success' }}
313+
if: ${{ !cancelled() && steps.build.conclusion == 'success' }}
314314
run: |
315315
# https://github.com/actions/runner/issues/1964 prevents us from using
316316
# the ENTRYPOINT in the image.
@@ -327,7 +327,7 @@ jobs:
327327
rm env_before env_after
328328
329329
- name: Build E2E tests
330-
if: ${{ inputs.e2e_binaries_artifact && always() && !cancelled() && steps.build.conclusion == 'success' }}
330+
if: ${{ inputs.e2e_binaries_artifact && !cancelled() && steps.build.conclusion == 'success' }}
331331
uses: ./devops/actions/run-tests/e2e
332332
with:
333333
ref: ${{ inputs.ref || github.sha }}
@@ -338,11 +338,11 @@ jobs:
338338
extra_lit_opts: --param sycl_build_targets="spir;nvidia;amd"
339339

340340
- name: Remove E2E tests before spirv-backend run
341-
if: ${{ inputs.e2e_binaries_spirv_backend_artifact && always() && !cancelled() && steps.build.conclusion == 'success' }}
341+
if: ${{ inputs.e2e_binaries_spirv_backend_artifact && !cancelled() && steps.build.conclusion == 'success' }}
342342
run: rm -rf build-e2e
343343

344344
- name: Build E2E tests with SPIR-V Backend
345-
if: ${{ inputs.e2e_binaries_spirv_backend_artifact && always() && !cancelled() && steps.build.conclusion == 'success' }}
345+
if: ${{ inputs.e2e_binaries_spirv_backend_artifact && !cancelled() && steps.build.conclusion == 'success' }}
346346
uses: ./devops/actions/run-tests/e2e
347347
with:
348348
ref: ${{ inputs.ref || github.sha }}
@@ -353,11 +353,11 @@ jobs:
353353
extra_lit_opts: --param spirv-backend=True
354354

355355
- name: Remove E2E tests before preview-mode run
356-
if: ${{ inputs.e2e_binaries_preview_artifact && always() && !cancelled() && steps.build.conclusion == 'success' }}
356+
if: ${{ inputs.e2e_binaries_preview_artifact && !cancelled() && steps.build.conclusion == 'success' }}
357357
run: rm -rf build-e2e
358358

359359
- name: Build E2E tests in Preview Mode
360-
if: ${{ inputs.e2e_binaries_preview_artifact && always() && !cancelled() && steps.build.conclusion == 'success' }}
360+
if: ${{ inputs.e2e_binaries_preview_artifact && !cancelled() && steps.build.conclusion == 'success' }}
361361
uses: ./devops/actions/run-tests/e2e
362362
with:
363363
ref: ${{ inputs.ref || github.sha }}

.github/workflows/sycl-linux-precommit.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ jobs:
5151
build:
5252
name: Self build
5353
needs: [detect_changes]
54-
if: always() && success()
54+
if: success()
5555
uses: ./.github/workflows/sycl-linux-build.yml
5656
with:
5757
build_ref: ${{ github.sha }}
@@ -70,7 +70,7 @@ jobs:
7070
# Build and run native cpu e2e tests separately as cannot currently
7171
# build all the e2e tests
7272
build_run_native_cpu_e2e_tests:
73-
if: ${{ always() && !cancelled() && needs.build.outputs.build_conclusion == 'success' }}
73+
if: ${{ !cancelled() && needs.build.outputs.build_conclusion == 'success' }}
7474
runs-on: [Linux, build]
7575
needs: [build]
7676
container:
@@ -109,7 +109,7 @@ jobs:
109109
# The idea is to ensure that the code works with both CUDA versions.
110110
build_ubuntu2204:
111111
needs: [detect_changes]
112-
if: always() && !cancelled() && contains(needs.detect_changes.outputs.filters, 'ur_cuda_adapter')
112+
if: ${{ !cancelled() && contains(needs.detect_changes.outputs.filters, 'ur_cuda_adapter') }}
113113
uses: ./.github/workflows/sycl-linux-build.yml
114114
with:
115115
build_ref: ${{ github.sha }}
@@ -143,7 +143,7 @@ jobs:
143143
144144
E2E:
145145
needs: [build, detect_changes, compat_read_exclude]
146-
if: ${{ always() && !cancelled() && needs.build.outputs.build_conclusion == 'success' }}
146+
if: ${{ !cancelled() && needs.build.outputs.build_conclusion == 'success' }}
147147
permissions:
148148
contents: write
149149
packages: read
@@ -242,7 +242,7 @@ jobs:
242242
contents: write
243243
packages: read
244244
if: |
245-
always() && !cancelled()
245+
!cancelled()
246246
&& needs.build.outputs.build_conclusion == 'success'
247247
&& (contains(github.event.pull_request.labels.*.name, 'run-perf-tests')
248248
|| contains(needs.detect_changes.outputs.filters, 'perf-tests'))

.github/workflows/sycl-nightly.yml

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ jobs:
8585
permissions:
8686
contents: write
8787
packages: read
88-
if: ${{ always() && !cancelled() && needs.ubuntu2204_build.outputs.build_conclusion == 'success' }}
88+
if: ${{ !cancelled() && needs.ubuntu2204_build.outputs.build_conclusion == 'success' }}
8989
strategy:
9090
fail-fast: false
9191
matrix:
@@ -175,7 +175,7 @@ jobs:
175175
permissions:
176176
contents: write
177177
packages: read
178-
if: ${{ always() && !cancelled() && needs.ubuntu2404_oneapi_build.outputs.build_conclusion == 'success' }}
178+
if: ${{ !cancelled() && needs.ubuntu2404_oneapi_build.outputs.build_conclusion == 'success' }}
179179
uses: ./.github/workflows/sycl-linux-run-tests.yml
180180
with:
181181
name: Intel PVC L0 oneAPI
@@ -204,8 +204,7 @@ jobs:
204204
needs: build-win
205205
# Continue if build was successful.
206206
if: |
207-
always()
208-
&& !cancelled()
207+
!cancelled()
209208
&& needs.build-win.outputs.build_conclusion == 'success'
210209
strategy:
211210
fail-fast: false
@@ -232,7 +231,7 @@ jobs:
232231

233232
cuda-aws-start:
234233
needs: [ubuntu2204_build]
235-
if: ${{ always() && !cancelled() && needs.ubuntu2204_build.outputs.build_conclusion == 'success' }}
234+
if: ${{ !cancelled() && needs.ubuntu2204_build.outputs.build_conclusion == 'success' }}
236235
uses: ./.github/workflows/sycl-aws.yml
237236
secrets: inherit
238237
with:
@@ -243,7 +242,7 @@ jobs:
243242
permissions:
244243
contents: write
245244
packages: read
246-
if: ${{ always() && !cancelled() && needs.ubuntu2204_build.outputs.build_conclusion == 'success' }}
245+
if: ${{ !cancelled() && needs.ubuntu2204_build.outputs.build_conclusion == 'success' }}
247246
uses: ./.github/workflows/sycl-linux-run-tests.yml
248247
with:
249248
name: CUDA E2E
@@ -259,7 +258,7 @@ jobs:
259258

260259
cuda-aws-stop:
261260
needs: [cuda-aws-start, cuda-run-tests]
262-
if: always() && ${{ needs.cuda-aws-start.result != 'skipped' }}
261+
if: ${{ needs.cuda-aws-start.result != 'skipped' }}
263262
uses: ./.github/workflows/sycl-aws.yml
264263
secrets: inherit
265264
with:
@@ -270,7 +269,7 @@ jobs:
270269
permissions:
271270
contents: write
272271
packages: read
273-
if: ${{ always() && !cancelled() && needs.ubuntu2204_build.outputs.build_conclusion == 'success' }}
272+
if: ${{ !cancelled() && needs.ubuntu2204_build.outputs.build_conclusion == 'success' }}
274273
uses: ./.github/workflows/sycl-linux-run-tests.yml
275274
with:
276275
name: Build SYCL-CTS for Linux
@@ -289,7 +288,7 @@ jobs:
289288
permissions:
290289
contents: write
291290
packages: read
292-
if: ${{ always() && !cancelled() && needs.ubuntu2204_build.outputs.build_conclusion == 'success' }}
291+
if: ${{ !cancelled() && needs.ubuntu2204_build.outputs.build_conclusion == 'success' }}
293292
strategy:
294293
fail-fast: false
295294
matrix:
@@ -319,7 +318,7 @@ jobs:
319318

320319
build-sycl-cts-win:
321320
needs: build-win
322-
if: ${{ always() && !cancelled() && needs.build-win.outputs.build_conclusion == 'success' }}
321+
if: ${{ !cancelled() && needs.build-win.outputs.build_conclusion == 'success' }}
323322
uses: ./.github/workflows/sycl-windows-run-tests.yml
324323
with:
325324
name: Build SYCL-CTS for Windows
@@ -332,7 +331,7 @@ jobs:
332331

333332
run-sycl-cts-win:
334333
needs: [build-win, build-sycl-cts-win]
335-
if: ${{ always() && !cancelled() && needs.build-win.outputs.build_conclusion == 'success' }}
334+
if: ${{ !cancelled() && needs.build-win.outputs.build_conclusion == 'success' }}
336335
strategy:
337336
fail-fast: false
338337
matrix:

.github/workflows/sycl-post-commit.yml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747

4848
e2e-lin:
4949
needs: [detect_changes, build-lin]
50-
if: ${{ always() && !cancelled() && needs.build-lin.outputs.build_conclusion == 'success' }}
50+
if: ${{ !cancelled() && needs.build-lin.outputs.build_conclusion == 'success' }}
5151
permissions:
5252
contents: write
5353
packages: read
@@ -111,9 +111,8 @@ jobs:
111111
112112
build-win:
113113
if: |
114-
always()
115-
&& success()
116-
&& github.repository == 'intel/llvm'
114+
success() &&
115+
github.repository == 'intel/llvm'
117116
uses: ./.github/workflows/sycl-windows-build.yml
118117
with:
119118
cxx: icx
@@ -124,9 +123,8 @@ jobs:
124123
needs: build-win
125124
# Continue if build was successful.
126125
if: |
127-
always()
128-
&& !cancelled()
129-
&& needs.build-win.outputs.build_conclusion == 'success'
126+
!cancelled() &&
127+
needs.build-win.outputs.build_conclusion == 'success'
130128
uses: ./.github/workflows/sycl-windows-run-tests.yml
131129
with:
132130
name: Intel GEN12 Graphics with Level Zero

.github/workflows/sycl-prebuilt-e2e-container.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ jobs:
9494
name: Run E2E tests with SYCL RT they were built with
9595
runs-on: [Linux, pvc]
9696
needs: [docker, build]
97-
if: ${{ always() && !cancelled() && needs.build.outputs.build_conclusion == 'success' }}
97+
if: ${{ !cancelled() && needs.build.outputs.build_conclusion == 'success' }}
9898
container:
9999
image: ghcr.io/${{ github.repository }}/sycl_prebuilt_tests:${{ inputs.ref || github.ref_name }}
100100
options: -u 1001 --device=/dev/dri -v /dev/dri/by-path:/dev/dri/by-path --privileged --cap-add SYS_ADMIN

.github/workflows/sycl-trivy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
run: ./bin/trivy config --format json --output trivy-report.json --ignorefile=devops/.trivyignore.yaml devops/containers --exit-code 1
3333

3434
- name: Upload report artifact
35-
if: always() && !cancelled()
35+
if: ${{ !cancelled() }}
3636
uses: actions/upload-artifact@v5
3737
with:
3838
name: trivy-report

.github/workflows/sycl-ur-perf-benchmarking.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ jobs:
164164
permissions:
165165
contents: write
166166
packages: read
167-
if: always() && !cancelled() && needs.build_sycl_dispatch.outputs.build_conclusion == 'success'
167+
if: ${{ !cancelled() && needs.build_sycl_dispatch.outputs.build_conclusion == 'success' }}
168168
strategy:
169169
matrix:
170170
include:
@@ -210,7 +210,7 @@ jobs:
210210
permissions:
211211
contents: write
212212
packages: read
213-
if: always() && !cancelled() && needs.build_nightly.outputs.build_conclusion == 'success'
213+
if: ${{ !cancelled() && needs.build_nightly.outputs.build_conclusion == 'success' }}
214214
strategy:
215215
fail-fast: false
216216
matrix:
@@ -261,7 +261,7 @@ jobs:
261261
permissions:
262262
contents: write
263263
packages: read
264-
if: always() && !cancelled() && needs.build_pr.outputs.build_conclusion == 'success'
264+
if: ${{ !cancelled() && needs.build_pr.outputs.build_conclusion == 'success' }}
265265
uses: ./.github/workflows/sycl-linux-run-tests.yml
266266
with:
267267
name: 'Framework test: PVC_PERF, L0, Minimal preset'

.github/workflows/sycl-weekly.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
permissions:
2626
contents: write
2727
packages: read
28-
if: ${{ always() && !cancelled() && needs.ubuntu2204_build.outputs.build_conclusion == 'success' }}
28+
if: ${{ !cancelled() && needs.ubuntu2204_build.outputs.build_conclusion == 'success' }}
2929
uses: ./.github/workflows/sycl-linux-run-tests.yml
3030
with:
3131
name: Build SYCL-CTS
@@ -45,7 +45,7 @@ jobs:
4545
permissions:
4646
contents: write
4747
packages: read
48-
if: ${{ always() && !cancelled() && needs.ubuntu2204_build.outputs.build_conclusion == 'success' }}
48+
if: ${{ !cancelled() && needs.ubuntu2204_build.outputs.build_conclusion == 'success' }}
4949
strategy:
5050
fail-fast: false
5151
matrix:

0 commit comments

Comments
 (0)