Skip to content

Commit a230a62

Browse files
[CI] Refactor changes detection for check-* in Build/LIT tasks (#9760)
1 parent 6436a1a commit a230a62

File tree

4 files changed

+77
-134
lines changed

4 files changed

+77
-134
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Identify impacted LIT tests
2+
# Outlined into a separate reusable workflow to ease testing for new rules.
3+
4+
on:
5+
workflow_call:
6+
outputs:
7+
filters:
8+
description: Matched filters
9+
value: ${{ jobs.need_check.outputs.filters }}
10+
11+
jobs:
12+
need_check:
13+
name: Decide which tests could be affected by the changes
14+
# Github's ubuntu-* runners are slow to allocate. Use our CUDA runner since
15+
# we don't use it for anything right now.
16+
runs-on: cuda
17+
timeout-minutes: 3
18+
outputs:
19+
filters: ${{ steps.changes.outputs.changes }}
20+
steps:
21+
- name: Check file changes
22+
uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50
23+
id: changes
24+
with:
25+
filters: |
26+
llvm: &llvm
27+
- 'llvm/**'
28+
llvm_spirv: &llvm_spirv
29+
- *llvm
30+
- 'llvm-spirv/**'
31+
clang: &clang
32+
- *llvm
33+
- 'clang/**'
34+
sycl_fusion: &sycl-fusion
35+
- *llvm
36+
- 'sycl-fusion/**'
37+
xptifw: &xptifw
38+
- 'xptifw/**'
39+
libclc: &libclc
40+
- *llvm_spirv
41+
- *clang
42+
- 'libclc/**'
43+
sycl:
44+
- *clang
45+
- *sycl-fusion
46+
- *llvm_spirv
47+
- *xptifw
48+
- *libclc
49+
- 'sycl/*'
50+
- 'sycl/!(test-e2e)/**'

.github/workflows/sycl_linux_build_and_test.yml

Lines changed: 12 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -64,34 +64,11 @@ on:
6464
type: string
6565
required: false
6666
default: 'SYCL-2020'
67-
check_llvm:
67+
check_filters:
6868
type: string
69+
description: 'Filter matches for the changed files in the PR'
70+
default: '[llvm, clang, sycl, llvm_spirv, xptifw, libclc, libdevice]'
6971
required: false
70-
default: 'true'
71-
check_clang:
72-
type: string
73-
required: false
74-
default: 'true'
75-
check_sycl:
76-
type: string
77-
required: false
78-
default: 'true'
79-
check_llvm_spirv:
80-
type: string
81-
required: false
82-
default: 'true'
83-
check_xptifw:
84-
type: string
85-
required: false
86-
default: 'true'
87-
check_libclc:
88-
type: string
89-
required: false
90-
default: 'true'
91-
check_libdevice:
92-
type: string
93-
required: false
94-
default: 'true'
9572

9673
jobs:
9774
build:
@@ -136,36 +113,36 @@ jobs:
136113
- name: Compile
137114
id: build
138115
run: cmake --build $GITHUB_WORKSPACE/build
139-
# TODO allow to optionally disable in-tree checks
140116
- name: check-llvm
141-
if: ${{ always() && !cancelled() && steps.build.outcome == 'success' && inputs.check_llvm == 'true' }}
117+
if: always() && !cancelled() && contains(inputs.check_filters, 'llvm')
142118
run: |
143119
cmake --build $GITHUB_WORKSPACE/build --target check-llvm
144120
- name: check-clang
145-
if: ${{ always() && !cancelled() && steps.build.outcome == 'success' && inputs.check_clang == 'true' }}
121+
if: always() && !cancelled() && contains(inputs.check_filters, 'clang')
146122
run: |
123+
# Can we move this to Dockerfile? Hopefully, noop on Windows.
147124
export XDG_CACHE_HOME=$GITHUB_WORKSPACE/os_cache
148125
cmake --build $GITHUB_WORKSPACE/build --target check-clang
149126
- name: check-sycl
150-
if: ${{ always() && !cancelled() && steps.build.outcome == 'success' && inputs.check_sycl == 'true' }}
127+
if: always() && !cancelled() && contains(inputs.check_filters, 'sycl')
151128
run: |
152-
# TODO consider moving this to Dockerfile
129+
# TODO consider moving this to Dockerfile.
153130
export LD_LIBRARY_PATH=/usr/local/cuda/compat/:/usr/local/cuda/lib64:$LD_LIBRARY_PATH
154131
cmake --build $GITHUB_WORKSPACE/build --target check-sycl
155132
- name: check-llvm-spirv
156-
if: ${{ always() && !cancelled() && steps.build.outcome == 'success' && inputs.check_llvm_spirv == 'true' }}
133+
if: always() && !cancelled() && contains(inputs.check_filters, 'llvm_spirv')
157134
run: |
158135
cmake --build $GITHUB_WORKSPACE/build --target check-llvm-spirv
159136
- name: check-xptifw
160-
if: ${{ always() && !cancelled() && steps.build.outcome == 'success' && inputs.check_xptifw == 'true' }}
137+
if: always() && !cancelled() && contains(inputs.check_filters, 'xptifw')
161138
run: |
162139
cmake --build $GITHUB_WORKSPACE/build --target check-xptifw
163140
- name: check-libclc
164-
if: ${{ always() && !cancelled() && steps.build.outcome == 'success' && inputs.check_libclc == 'true' }}
141+
if: always() && !cancelled() && contains(inputs.check_filters, 'libclc')
165142
run: |
166143
cmake --build $GITHUB_WORKSPACE/build --target check-libclc
167144
- name: check-libdevice
168-
if: ${{ always() && !cancelled() && steps.build.outcome == 'success' && inputs.check_libdevice == 'true' }}
145+
if: always() && !cancelled() && contains(inputs.check_filters, 'libdevice')
169146
run: |
170147
cmake --build $GITHUB_WORKSPACE/build --target check-libdevice
171148
- name: Install

.github/workflows/sycl_precommit.yml

Lines changed: 6 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -27,53 +27,8 @@ permissions:
2727
contents: read
2828

2929
jobs:
30-
need_check:
31-
name: Decide which tests could be affected by the changes
32-
runs-on: ubuntu-22.04
33-
timeout-minutes: 3
34-
outputs:
35-
llvm: ${{ steps.changes.outputs.llvm == 'true' }}
36-
llvm_spirv: ${{ steps.changes.outputs.llvm_spirv == 'true' }}
37-
clang: ${{ steps.changes.outputs.clang == 'true' }}
38-
xptifw: ${{ steps.changes.outputs.xptifw == 'true' }}
39-
libclc: ${{ steps.changes.outputs.libclc == 'true' }}
40-
sycl: ${{ steps.changes.outputs.sycl == 'true' }}
41-
steps:
42-
- name: Check file changes
43-
uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50
44-
id: changes
45-
with:
46-
filters: |
47-
llvm: &llvm
48-
- 'llvm/**'
49-
llvm_spirv: &llvm_spirv
50-
- *llvm
51-
- 'llvm-spirv/**'
52-
clang: &clang
53-
- *llvm
54-
- 'clang/**'
55-
sycl_fusion: &sycl-fusion
56-
- *llvm
57-
- 'sycl-fusion/**'
58-
xptifw: &xptifw
59-
- 'xptifw/**'
60-
libclc: &libclc
61-
- *llvm_spirv
62-
- *clang
63-
- 'libclc/**'
64-
libdevice: &libdevice
65-
- *llvm_spirv
66-
- *clang
67-
- 'libdevice/**'
68-
sycl:
69-
- *clang
70-
- *sycl-fusion
71-
- *llvm_spirv
72-
- *xptifw
73-
- *libclc
74-
- *libdevice
75-
- 'sycl/*'
76-
- 'sycl/!(test-e2e)/**'
30+
detect_changes:
31+
uses: ./.github/workflows/sycl_detect_changes.yml
7732

7833
lint:
7934
runs-on: ubuntu-22.04
@@ -102,7 +57,7 @@ jobs:
10257
name: Linux
10358
# Only build and test patches, that have passed all linter checks, because
10459
# the next commit is likely to be a follow-up on that job.
105-
needs: [lint, test_matrix, need_check]
60+
needs: [lint, test_matrix, detect_changes]
10661
if: always() && (success() || contains(github.event.pull_request.labels.*.name, 'ignore-lint'))
10762
uses: ./.github/workflows/sycl_linux_build_and_test.yml
10863
secrets: inherit
@@ -114,24 +69,14 @@ jobs:
11469
build_cache_suffix: "default"
11570
lts_matrix: ${{ needs.test_matrix.outputs.lts_lx_matrix }}
11671
lts_aws_matrix: ${{ needs.test_matrix.outputs.lts_aws_matrix }}
117-
check_llvm: ${{ needs.need_check.outputs.llvm }}
118-
check_llvm_spirv: ${{ needs.need_check.outputs.llvm_spirv }}
119-
check_clang: ${{ needs.need_check.outputs.clang }}
120-
check_xptifw: ${{ needs.need_check.outputs.xptifw }}
121-
check_libclc: ${{ needs.need_check.outputs.libclc }}
122-
check_sycl: ${{ needs.need_check.outputs.sycl }}
72+
check_filters: ${{ needs.detect_changes.outputs.filters }}
12373

12474
windows_default:
12575
name: Windows
126-
needs: [lint, test_matrix, need_check]
76+
needs: [lint, test_matrix, detect_changes]
12777
if: github.repository == 'intel/llvm'
12878
uses: ./.github/workflows/sycl_windows_build_and_test.yml
12979
with:
13080
lts_matrix: ${{ needs.test_matrix.outputs.lts_wn_matrix }}
13181
build_ref: ${{ github.event.pull_request.head.sha }}
132-
check_llvm: ${{ needs.need_check.outputs.llvm }}
133-
check_llvm_spirv: ${{ needs.need_check.outputs.llvm_spirv }}
134-
check_clang: ${{ needs.need_check.outputs.clang }}
135-
check_xptifw: ${{ needs.need_check.outputs.xptifw }}
136-
check_libclc: ${{ needs.need_check.outputs.libclc }}
137-
check_sycl: ${{ needs.need_check.outputs.sycl }}
82+
check_filters: ${{ needs.detect_changes.outputs.filters }}

.github/workflows/sycl_windows_build_and_test.yml

Lines changed: 9 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -18,34 +18,11 @@ on:
1818
type: string
1919
required: false
2020
default: ""
21-
check_llvm:
21+
check_filters:
2222
type: string
23+
description: 'Filter matches for the changed files in the PR'
24+
default: '[llvm, clang, sycl, llvm_spirv, xptifw, libclc, libdevice]'
2325
required: false
24-
default: 'true'
25-
check_clang:
26-
type: string
27-
required: false
28-
default: 'true'
29-
check_sycl:
30-
type: string
31-
required: false
32-
default: 'true'
33-
check_llvm_spirv:
34-
type: string
35-
required: false
36-
default: 'true'
37-
check_xptifw:
38-
type: string
39-
required: false
40-
default: 'true'
41-
check_libclc:
42-
type: string
43-
required: false
44-
default: 'true'
45-
check_libdevice:
46-
type: string
47-
required: false
48-
default: 'true'
4926

5027
jobs:
5128
build:
@@ -94,33 +71,27 @@ jobs:
9471
run: |
9572
cmake --build build --target sycl-toolchain
9673
- name: check-llvm
97-
shell: bash
98-
if: ${{ always() && !cancelled() && steps.build.outcome == 'success' && inputs.check_llvm == 'true' }}
74+
if: always() && !cancelled() && contains(inputs.check_filters, 'llvm')
9975
run: |
10076
cmake --build build --target check-llvm
10177
- name: check-clang
102-
if: ${{ always() && !cancelled() && steps.build.outcome == 'success' && inputs.check_clang == 'true' }}
103-
shell: bash
78+
if: always() && !cancelled() && contains(inputs.check_filters, 'clang')
10479
run: |
10580
cmake --build build --target check-clang
10681
- name: check-sycl
107-
if: ${{ always() && !cancelled() && steps.build.outcome == 'success' && inputs.check_sycl == 'true' }}
108-
shell: bash
82+
if: always() && !cancelled() && contains(inputs.check_filters, 'sycl')
10983
run: |
11084
cmake --build build --target check-sycl
11185
- name: check-llvm-spirv
112-
if: ${{ always() && !cancelled() && steps.build.outcome == 'success' && inputs.check_llvm_spirv == 'true' }}
113-
shell: bash
86+
if: always() && !cancelled() && contains(inputs.check_filters, 'llvm_spirv')
11487
run: |
11588
cmake --build build --target check-llvm-spirv
11689
- name: check-xptifw
117-
if: ${{ always() && !cancelled() && steps.build.outcome == 'success' && inputs.check_xptifw == 'true' }}
118-
shell: bash
90+
if: always() && !cancelled() && contains(inputs.check_filters, 'xptifw')
11991
run: |
12092
cmake --build build --target check-xptifw
12193
- name: check-libdevice
122-
if: ${{ always() && !cancelled() && steps.build.outcome == 'success' && inputs.check_libdevice == 'true' }}
123-
shell: bash
94+
if: always() && !cancelled() && contains(inputs.check_filters, 'libdevice')
12495
run: |
12596
cmake --build build --target check-libdevice
12697
- name: Install

0 commit comments

Comments
 (0)