Welcome to mirror list, hosted at ThFree Co, Russian Federation.

netci.groovy - github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 5877dd7c0ecececdf2523906a716f83389df1e6b (plain)
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
// Import the utility functionality.

import jobs.generation.Utilities;
import jobs.generation.JobReport;

// The input project name (e.g. dotnet/coreclr)
def project = GithubProject
// The input branch name (e.g. master)
def branch = GithubBranchName

class Constants {

    def static imageVersionMap = ['Windows_NT':'latest-or-auto',
                           'OSX10.12':'latest-or-auto',
                           'Ubuntu':'20170118']

    def static scenarios = ['coreclr', 'corefx']
    
    // Innerloop build OS's
    def static osList = ['Ubuntu', 'OSX10.12', 'Windows_NT', 'Windows_NT_Wasm']

}

// Generate the builds for debug and release, commit and PRJob
Constants.scenarios.each { scenario ->
    [true, false].each { isPR -> // Defines a closure over true and false, value assigned to isPR
        ['Debug', 'Release'].each { configuration ->
            Constants.osList.each { os ->

                if (configuration == 'Release' && scenario == 'corefx') {
                    return
                }

                // Disable the corefx scenario for wasm for now since 
                // the tests won't work
                if (os == 'Windows_NT_Wasm' && scenario == 'corefx') {
                    return
                }

                // Define build string
                def lowercaseConfiguration = configuration.toLowerCase()

                // Determine the name for the new job.  The first parameter is the project,
                // the second parameter is the base name for the job, and the last parameter
                // is a boolean indicating whether the job will be a PR job.  If true, the
                // suffix _prtest will be appended.
                def baseJobName = lowercaseConfiguration + '_' + os.toLowerCase()
                if (scenario != 'coreclr') {
                    baseJobName += '_' + scenario
                }
                def newJobName = Utilities.getFullJobName(project, baseJobName, isPR)
                def buildString = "";
                def prJobDescription = "${os} ${configuration}";
                if (configuration == 'Debug') {
                    if (scenario == 'coreclr') {
                        prJobDescription += " and CoreCLR tests"
                    }
                    if (scenario == 'corefx') {
                        prJobDescription += " and CoreFX tests"
                    }
                }
                
                def buildCommands = calculateBuildCommands(os, configuration, scenario, isPR)

                // Create a new job with the specified name.  The brace opens a new closure
                // and calls made within that closure apply to the newly created job.
                def newJob = job(newJobName) {
                    // This opens the set of build steps that will be run.
                    steps {
                        if (os.startsWith('Windows_NT')) {
                        // Indicates that a batch script should be run with each build command
                            buildCommands.each { buildCommand -> 
                                batchFile(buildCommand) 
                            }
                        }
                        else {
                            buildCommands.each { buildCommand -> 
                                shell(buildCommand)
                            }
                        }
                    }
                }

                // This call performs test run checks for the CI.
                Utilities.addXUnitDotNETResults(newJob, '**/testResults.xml')
                Utilities.addArchival(newJob, "**/testResults.xml")
                if (os == 'Windows_NT_Wasm') {
                    Utilities.setMachineAffinity(newJob, 'Windows.10.Wasm.Open')
                    prJobDescription += " WebAssembly"
                }
                else {
                    Utilities.setMachineAffinity(newJob, os, Constants.imageVersionMap[os])
                }
                Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}")

                if (isPR) {
                    Utilities.addGithubPRTriggerForBranch(newJob, branch, prJobDescription)
                }
                else {
                    // Set a large timeout since the default (2 hours) is insufficient
                    Utilities.setJobTimeout(newJob, 1440)
                    Utilities.addGithubPushTrigger(newJob)
                }
            }
        }
    }
}

def static calculateBuildCommands(def os, def configuration, def scenario, def isPR) {
    
    def buildCommands = []
    def lowercaseConfiguration = configuration.toLowerCase()
    def testScriptString= ''

    if (os == 'Windows_NT') {
        // Calculate the build commands
        buildCommands += "build.cmd ${lowercaseConfiguration} skiptests"
    
        if (scenario == 'coreclr'){
            // Run simple tests and multimodule tests only under CoreCLR mode
            buildCommands += "tests\\runtest.cmd ${configuration} "
            buildCommands += "tests\\runtest.cmd ${configuration} /multimodule"
            if (configuration == 'Debug')
            {
                // Run CoreCLR tests
                testScriptString = "tests\\runtest.cmd ${configuration} /coreclr "
                if (isPR) {
                    // Run a small set of BVTs during PR validation
                    buildCommands += testScriptString + "Top200"
                }
                else {
                    // Run the full set of known passing tests in the post-commit job
                    buildCommands += testScriptString + "KnownGood /multimodule"
                }
            }
        }
        else if (scenario == 'corefx')
        {
            // CoreFX tests are currently run only under Debug, so skip the configuration check
            testScriptString = "tests\\runtest.cmd ${configuration} /corefx "
            
            //Todo: Add json config files for different testing scenarios
            buildCommands += testScriptString 
        }
    }
    else if (os == 'Windows_NT_Wasm') {
        // Emsdk isn't necessarily activated correctly on CI machines (but should be on the path), so activate it now
        buildCommands += "emsdk activate latest"

        buildCommands += "build.cmd wasm ${lowercaseConfiguration} skiptests"
        buildCommands += "tests\\runtest.cmd wasm ${configuration}"
    }
    else {
        // Calculate the build commands        
        buildCommands += "./build.sh ${lowercaseConfiguration} skiptests"
        
        // Calculate the test commands
        if (scenario == 'coreclr' )
        {
            // Run simple tests and multimodule tests only under CoreCLR mode
            buildCommands += "tests/runtest.sh ${configuration} "

            if (configuration == 'Debug')
            {
                testScriptString = "tests/runtest.sh ${configuration} -coredumps -coreclr "
                if (isPR) {
                    // Run a small set of BVTs during PR validation
                    buildCommands += testScriptString + "top200"
                }
                else {
                    // Run the full set of known passing tests in the post-commit job

                    // Todo: Enable push test jobs once we establish a reasonable passing set of tests
                    // shell(testScriptString + "KnownGood")
                }
            }
        }
        else if (scenario == 'corefx')
        {
            // CoreFX tests are currently run only under Debug, so skip the configuration check
            testScriptString = "tests/runtest.sh ${configuration} -corefx "
            
            //Todo: Add json config files for different testing scenarios
            buildCommands += testScriptString                 
        }
    }

    return buildCommands
}

JobReport.Report.generateJobReport(out)