File: ProjectCiFileChangeLogic.py

package info (click to toggle)
trilinos 12.18.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 825,604 kB
  • sloc: cpp: 3,352,065; ansic: 432,926; fortran: 169,495; xml: 61,903; python: 40,836; sh: 32,697; makefile: 26,612; javascript: 8,535; perl: 7,136; f90: 6,372; csh: 4,183; objc: 2,620; lex: 1,469; lisp: 810; yacc: 497; awk: 364; ml: 281; php: 145
file content (86 lines) | stat: -rw-r--r-- 3,745 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#
# Specialized logic for what file changes should trigger a global build in CI
# testing where testing should only occur package impacted by the change.
#

class ProjectCiFileChangeLogic:

  def isGlobalBuildFileRequiringGlobalRebuild(self, modifiedFileFullPath):
    modifiedFileFullPathArray = modifiedFileFullPath.split('/')
    lenPathArray = len(modifiedFileFullPathArray)
    if lenPathArray==1:
      # Files directly under <projectDir>/
      if modifiedFileFullPathArray[0] == "CMakeLists.txt":
        return True
      elif modifiedFileFullPathArray[0].rfind(".cmake") != -1:
        # Any <projectDir>/*.cmake files should trigger testing all packages
        return True
      else:
        # Other files under <projectDir>/ likely don't require a global
        # rebuild
        return False
    elif modifiedFileFullPathArray[0] == 'cmake':
      # cmake/
      if lenPathArray==2:
        # Files directly under cmake/
        if modifiedFileFullPathArray[1]=='ExtraRepositoriesList.cmake':
          return False
        elif modifiedFileFullPathArray[1].rfind(".cmake") != -1:
          # All CMake files directly under cmake/ should trigger
          # testing of all packages.
          return True
        else:
          # Any other files directly under cmake/ don't require a global
          # rebuild
          return False
      elif modifiedFileFullPathArray[1] == 'std':
        # cmake/std/
        if lenPathArray==3:
          # Files directly under Trilinos/cmake/std/.  These may be used for
          # CI or PR testing so we need to test all packages if any of these
          # files change.
          return True
        elif modifiedFileFullPathArray[2] == "atdm":
          # Files under Trilinos/cmake/std/atdm/.  Currently, none of these
          # files are being used for CI or PR testing so we don't need to
          # enable all packages when these change.
          return False
        elif modifiedFileFullPathArray[2] == "sems":
          # Files under Trilinos/cmake/std/sems/.  Currently, none of these
          # files are being used for CI or PR testing so we don't need to
          # enable all packages when these change.
          return False
      elif modifiedFileFullPathArray[1] == 'TPLs':
        # cmake/TPLs/.  Any TPL file modules that change really needs to
        # trigger a global build to be safe
        return True

      elif modifiedFileFullPathArray[1] == 'ctest':
        # cmake/ctest/
        if lenPathArray==3:
          # Files directly under <project>/cmake/ctest/.  These could impact
          # CI and PR testing if they use the TriBITS CTest driver so to be
          # safe, we should test all packages if these changes.
          return True
        elif modifiedFileFullPathArray[2] == 'drivers':
          # cmake/ctest/drivers/
          if lenPathArray==4:
            # Files directly under <project>/cmake/ctest/drivers/.
            # These files could be used by CI or PR testing, and they don't
            # change very often, so changes to these files should trigger a
            # global rebuild.
            return True
          else:
            # This is a file under
            # cmake/ctest/<something>/[...something...] so this
            # is likely build files for a specific system that CI and PR
            # testing does not depend on.  Therefore, we should not need to
            # test all packages.
            return False
      elif modifiedFileFullPath.rfind(".cmake") != -1:
        # All other *.cmake files under any subdir of cmake/ should trigger
        # a global rebuild to be safe.
       return True
    # Any other files not already covered abvoe should not trigger a global
    # build
    return False