Skip to content

Commit e5d0159

Browse files
[CI] Unify check-* in Build/LIT task between Linux/Windows
1 parent 4852210 commit e5d0159

File tree

5 files changed

+155
-175
lines changed

5 files changed

+155
-175
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: 8 additions & 58 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,38 +113,11 @@ jobs:
136113
- name: Compile
137114
id: build
138115
run: cmake --build $GITHUB_WORKSPACE/build
139-
# TODO allow to optionally disable in-tree checks
140-
- name: check-llvm
141-
if: ${{ always() && !cancelled() && steps.build.outcome == 'success' && inputs.check_llvm == 'true' }}
142-
run: |
143-
cmake --build $GITHUB_WORKSPACE/build --target check-llvm
144-
- name: check-clang
145-
if: ${{ always() && !cancelled() && steps.build.outcome == 'success' && inputs.check_clang == 'true' }}
146-
run: |
147-
export XDG_CACHE_HOME=$GITHUB_WORKSPACE/os_cache
148-
cmake --build $GITHUB_WORKSPACE/build --target check-clang
149-
- name: check-sycl
150-
if: ${{ always() && !cancelled() && steps.build.outcome == 'success' && inputs.check_sycl == 'true' }}
151-
run: |
152-
# TODO consider moving this to Dockerfile
153-
export LD_LIBRARY_PATH=/usr/local/cuda/compat/:/usr/local/cuda/lib64:$LD_LIBRARY_PATH
154-
cmake --build $GITHUB_WORKSPACE/build --target check-sycl
155-
- name: check-llvm-spirv
156-
if: ${{ always() && !cancelled() && steps.build.outcome == 'success' && inputs.check_llvm_spirv == 'true' }}
157-
run: |
158-
cmake --build $GITHUB_WORKSPACE/build --target check-llvm-spirv
159-
- name: check-xptifw
160-
if: ${{ always() && !cancelled() && steps.build.outcome == 'success' && inputs.check_xptifw == 'true' }}
161-
run: |
162-
cmake --build $GITHUB_WORKSPACE/build --target check-xptifw
163-
- name: check-libclc
164-
if: ${{ always() && !cancelled() && steps.build.outcome == 'success' && inputs.check_libclc == 'true' }}
165-
run: |
166-
cmake --build $GITHUB_WORKSPACE/build --target check-libclc
167-
- name: check-libdevice
168-
if: ${{ always() && !cancelled() && steps.build.outcome == 'success' && inputs.check_libdevice == 'true' }}
169-
run: |
170-
cmake --build $GITHUB_WORKSPACE/build --target check-libdevice
116+
- name: LIT tests
117+
uses: ./src/devops/actions/lit-tests
118+
with:
119+
build_path: "$GITHUB_WORKSPACE/build"
120+
filters: ${{ inputs.check_filters }}
171121
- name: Install
172122
# TODO replace utility installation with a single CMake target
173123
run: |

.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: 10 additions & 56 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:
@@ -93,36 +70,13 @@ jobs:
9370
shell: bash
9471
run: |
9572
cmake --build build --target sycl-toolchain
96-
- name: check-llvm
97-
shell: bash
98-
if: ${{ always() && !cancelled() && steps.build.outcome == 'success' && inputs.check_llvm == 'true' }}
99-
run: |
100-
cmake --build build --target check-llvm
101-
- name: check-clang
102-
if: ${{ always() && !cancelled() && steps.build.outcome == 'success' && inputs.check_clang == 'true' }}
103-
shell: bash
104-
run: |
105-
cmake --build build --target check-clang
106-
- name: check-sycl
107-
if: ${{ always() && !cancelled() && steps.build.outcome == 'success' && inputs.check_sycl == 'true' }}
108-
shell: bash
109-
run: |
110-
cmake --build build --target check-sycl
111-
- name: check-llvm-spirv
112-
if: ${{ always() && !cancelled() && steps.build.outcome == 'success' && inputs.check_llvm_spirv == 'true' }}
113-
shell: bash
114-
run: |
115-
cmake --build build --target check-llvm-spirv
116-
- name: check-xptifw
117-
if: ${{ always() && !cancelled() && steps.build.outcome == 'success' && inputs.check_xptifw == 'true' }}
118-
shell: bash
119-
run: |
120-
cmake --build build --target check-xptifw
121-
- name: check-libdevice
122-
if: ${{ always() && !cancelled() && steps.build.outcome == 'success' && inputs.check_libdevice == 'true' }}
123-
shell: bash
124-
run: |
125-
cmake --build build --target check-libdevice
73+
- name: LIT tests
74+
uses: ./src/devops/actions/lit-tests
75+
with:
76+
build_path: build
77+
filters: ${{ inputs.check_filters }}
78+
# TODO: Enable CUDA/HIP testing on Windows?
79+
skip_targets: '[libclc]'
12680
- name: Install
12781
shell: bash
12882
# TODO replace utility installation with a single CMake target

devops/actions/lit-tests/action.yml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: Device-agnostic LIT tests
2+
inputs:
3+
filters:
4+
description: 'Filter matches for the changed files in the PR'
5+
# TODO: If that is used by a re-usable workflow, then the caller has to
6+
# provide the same defaults explicitly in its inputs. Make sure those are
7+
# modified whenever changes are being made here.
8+
default: '[llvm, clang, sycl, llvm_spirv, xptifw, libclc, libdevice]'
9+
required: false
10+
skip_targets:
11+
description: 'Checks to skip'
12+
default: '[]'
13+
required: false
14+
build_path:
15+
description: 'Path to the build directory'
16+
required: true
17+
18+
runs:
19+
using: "composite"
20+
steps:
21+
- name: check-llvm
22+
shell: bash
23+
if: |
24+
always() && !cancelled()
25+
&& contains(inputs.filters, 'llvm')
26+
&& !contains(inputs.skip_targets, 'llvm')
27+
run: |
28+
cmake --build ${{ inputs.build_path }} --target check-llvm
29+
- name: check-clang
30+
shell: bash
31+
if: |
32+
always() && !cancelled()
33+
&& contains(inputs.filters, 'clang')
34+
&& !contains(inputs.skip_targets, 'clang')
35+
run: |
36+
# Can we move this to Dockerfile? Hopefully, noop on Windows.
37+
export XDG_CACHE_HOME=$GITHUB_WORKSPACE/os_cache
38+
cmake --build ${{ inputs.build_path }} --target check-clang
39+
- name: check-sycl
40+
shell: bash
41+
if: |
42+
always() && !cancelled()
43+
&& contains(inputs.filters, 'sycl')
44+
&& !contains(inputs.skip_targets, 'sycl')
45+
run: |
46+
# TODO consider moving this to Dockerfile.
47+
# Will be ignored on Windows even when executed.
48+
export LD_LIBRARY_PATH=/usr/local/cuda/compat/:/usr/local/cuda/lib64:$LD_LIBRARY_PATH
49+
cmake --build ${{ inputs.build_path }} --target check-sycl
50+
- name: check-llvm-spirv
51+
shell: bash
52+
if: |
53+
always() && !cancelled()
54+
&& contains(inputs.filters, 'llvm_spirv')
55+
&& !contains(inputs.skip_targets, 'llvm_spirv')
56+
run: |
57+
cmake --build ${{ inputs.build_path }} --target check-llvm-spirv
58+
- name: check-xptifw
59+
shell: bash
60+
if: |
61+
always() && !cancelled()
62+
&& contains(inputs.filters, 'xptifw')
63+
&& !contains(inputs.skip_targets, 'xptifw')
64+
run: |
65+
cmake --build ${{ inputs.build_path }} --target check-xptifw
66+
- name: check-libclc
67+
shell: bash
68+
if: |
69+
always() && !cancelled()
70+
&& contains(inputs.filters, 'libclc')
71+
&& !contains(inputs.skip_targets, 'libclc')
72+
run: |
73+
cmake --build ${{ inputs.build_path }} --target check-libclc
74+
- name: check-libdevice
75+
shell: bash
76+
if: |
77+
always() && !cancelled()
78+
&& contains(inputs.filters, 'libdevice')
79+
&& !contains(inputs.skip_targets, 'libdevice')
80+
run: |
81+
cmake --build ${{ inputs.build_path }} --target check-libdevice

0 commit comments

Comments
 (0)