Skip to content

Commit 02e8276

Browse files
rscohn2normallytangent
authored andcommitted
Selective CI basecd on changes to a domain (#508)
1 parent 7dace7a commit 02e8276

File tree

1 file changed

+39
-14
lines changed

1 file changed

+39
-14
lines changed

.github/workflows/pr.yml

Lines changed: 39 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,23 +21,22 @@ jobs:
2121
matrix:
2222
include:
2323
- config: portBLAS
24-
options: -DTARGET_DOMAINS=blas -DREF_BLAS_ROOT=${PWD}/lapack/install -DENABLE_PORTBLAS_BACKEND=ON -DENABLE_MKLCPU_BACKEND=OFF -DPORTBLAS_TUNING_TARGET=INTEL_CPU
25-
tests: '.*'
24+
domain: blas
25+
build_options: -DREF_BLAS_ROOT=${PWD}/lapack/install -DENABLE_PORTBLAS_BACKEND=ON -DENABLE_MKLCPU_BACKEND=OFF -DPORTBLAS_TUNING_TARGET=INTEL_CPU
2626
- config: portFFT
27-
options: -DENABLE_PORTFFT_BACKEND=ON -DENABLE_MKLCPU_BACKEND=OFF -DTARGET_DOMAINS=dft -DCMAKE_CXX_FLAGS="-fsycl -fsycl-targets=spir64"
28-
tests: 'DFT/CT/.*ComputeTests_in_place_COMPLEX.COMPLEX_SINGLE_in_place_buffer.sizes_8_batches_1*'
27+
domain: dft
28+
build_options: -DENABLE_PORTFFT_BACKEND=ON -DENABLE_MKLCPU_BACKEND=OFF -DCMAKE_CXX_FLAGS="-fsycl -fsycl-targets=spir64"
29+
test_options: -R 'DFT/CT/.*ComputeTests_in_place_COMPLEX.COMPLEX_SINGLE_in_place_buffer.sizes_8_batches_1*'
2930
- config: MKL BLAS
30-
options: -DTARGET_DOMAINS=blas -DREF_BLAS_ROOT=${PWD}/lapack/install
31-
tests: '.*'
31+
domain: blas
32+
build_options: -DREF_BLAS_ROOT=${PWD}/lapack/install
3233
- config: MKL DFT
33-
options: -DTARGET_DOMAINS=dft
34-
tests: '.*'
34+
domain: dft
3535
- config: MKL LAPACK
36-
options: -DTARGET_DOMAINS=lapack -DREF_LAPACK_ROOT=${PWD}/lapack/install
37-
tests: '.*'
36+
domain: lapack
37+
build_options: -DREF_LAPACK_ROOT=${PWD}/lapack/install
3838
- config: MKL RNG
39-
options: -DTARGET_DOMAINS=rng
40-
tests: '.*'
39+
domain: rng
4140
name: unit tests ${{ matrix.config }} CPU
4241
steps:
4342
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
@@ -58,18 +57,44 @@ jobs:
5857
# 64 bit int
5958
cmake ${SHARED_OPT} -DBUILD_INDEX64=on -B lapack/build64
6059
cmake --build lapack/build64 ${PARALLEL} --target install
60+
- name: Test if the changes affect this domain
61+
id: test_domain
62+
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
63+
with:
64+
script: |
65+
function matchesPattern(filePaths) {
66+
console.log('files:', filePaths)
67+
// These directories contain domain specific code
68+
const dirs = '(tests/unit_tests|examples|src|include/oneapi/mkl)'
69+
const domains = '(blas|lapack|rng|dft)'
70+
const domain = '${{ matrix.domain }}'
71+
// matches changes to the domain of interest or non domain-specific code
72+
const re = new RegExp(`^(${dirs}/${domain}|(?!${dirs}/${domains}))`);
73+
return filePaths.some(filePath => re.test(filePath));
74+
}
75+
const pr = context.payload.pull_request
76+
const compare = await github.rest.repos.compareCommits({
77+
owner: context.repo.owner,
78+
repo: context.repo.repo,
79+
base: pr.base.sha,
80+
head: pr.head.sha
81+
});
82+
return matchesPattern(compare.data.files.map((f) => f.filename));
6183
- name: Install oneapi
84+
if: steps.test_domain.outputs.result == 'true'
6285
uses: rscohn2/setup-oneapi@2ad0cf6b74bc2426bdcee825cf88f9db719dd727 # v0.1.0
6386
with:
6487
components: |
6588
6689
6790
- name: Configure/Build for a domain
91+
if: steps.test_domain.outputs.result == 'true'
6892
run: |
6993
source /opt/intel/oneapi/setvars.sh
70-
cmake -DENABLE_MKLGPU_BACKEND=off -DCMAKE_VERBOSE_MAKEFILE=on ${{ matrix.options }} -B build
94+
cmake -DTARGET_DOMAINS=${{ matrix.domain }} -DENABLE_MKLGPU_BACKEND=off -DCMAKE_VERBOSE_MAKEFILE=on ${{ matrix.build_options }} -B build
7195
cmake --build build ${PARALLEL}
7296
- name: Run tests
97+
if: steps.test_domain.outputs.result == 'true'
7398
run: |
7499
source /opt/intel/oneapi/setvars.sh
75-
ctest --test-dir build -R ${{ matrix.tests }}
100+
ctest --test-dir build ${{ matrix.test_options }}

0 commit comments

Comments
 (0)