From d6a5ae437e837a13fe1630d42db1c4b9c9990738 Mon Sep 17 00:00:00 2001 From: Robert Cohn Date: Wed, 5 Jun 2024 09:36:32 -0500 Subject: [PATCH] test --- .github/workflows/pr.yml | 39 ++++++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 111e7780e..dc4488a45 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -63,34 +63,43 @@ jobs: # 64 bit int cmake ${SHARED_OPT} -DBUILD_INDEX64=on -B lapack/build64 cmake --build lapack/build64 ${PARALLEL} --target install - - name: Check for changes to this domain - id: changes - uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2 - predicate-quantifier: every + - name: Test if the changes affect this domain + id: test_domain + uses: actions/github-script@v4 with: - list-files: shell - filters: | - src: - # match everything - - '**' - # exclude other domains - - '!src/${{ matrix.exclude }}/**' - - '!tests/unit_tests/${{ matrix.exclude }}/**' + script: | + function matchesPattern(filePaths) { + console.log('files:', filePaths) + const dirs = '(examples|src|include/oneapi/mkl)' + const domains = '(blas|lapack|rng|dft)' + const domain = '${{ matrix.domain }}' + // matches the domain we want or no domain at all + const re = new RegExp(`^(${dirs}/${domain}|(?!${dirs}/${domains}))`); + return filePaths.some(filePath => re.test(filePath)); + } + const pr = context.payload.pull_request + const compare = await github.rest.repos.compareCommits({ + owner: context.repo.owner, + repo: context.repo.repo, + base: pr.base.sha, + head: pr.head.sha + }); + return matchesPattern(compare.data.files.map((f) => f.filename)); - name: Install oneapi - if: steps.changes.outputs.src == 'true' + if: steps.test_domain.outputs.result == 'true' uses: rscohn2/setup-oneapi@2ad0cf6b74bc2426bdcee825cf88f9db719dd727 # v0.1.0 with: components: | icx@2024.1.0 mkl@2024.1.0 - name: Configure/Build for a domain - if: steps.changes.outputs.src == 'true' + if: steps.test_domain.outputs.result == 'true' run: | source /opt/intel/oneapi/setvars.sh cmake -DTARGET_DOMAINS=${{ matrix.domain }} -DENABLE_MKLGPU_BACKEND=off -DCMAKE_VERBOSE_MAKEFILE=on ${{ matrix.build_options }} -B build cmake --build build ${PARALLEL} - name: Run tests - if: steps.changes.outputs.src == 'true' + if: steps.test_domain.outputs.result == 'true' run: | source /opt/intel/oneapi/setvars.sh ctest --test-dir build ${{ matrix.test_options }}