Skip to content

Commit 0ad0a50

Browse files
committed
Run windows tests in parallel
1 parent a107d31 commit 0ad0a50

File tree

2 files changed

+179
-81
lines changed

2 files changed

+179
-81
lines changed

script/test

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -205,28 +205,24 @@ function requestedTestSuites () {
205205

206206
function testSuitesForPlatform (platform) {
207207
let suites = []
208-
switch (platform) {
209-
case 'darwin':
210-
const PACKAGES_TO_TEST_IN_PARALLEL = 23
211-
212-
if (process.env.ATOM_RUN_CORE_TESTS === 'true') {
213-
suites = [runCoreMainProcessTests, runCoreRenderProcessTests]
214-
} else if (process.env.ATOM_RUN_PACKAGE_TESTS === '1') {
215-
suites = packageTestSuites.slice(0, PACKAGES_TO_TEST_IN_PARALLEL)
216-
} else if (process.env.ATOM_RUN_PACKAGE_TESTS === '2') {
217-
suites = packageTestSuites.slice(PACKAGES_TO_TEST_IN_PARALLEL)
218-
} else {
219-
suites = [runCoreMainProcessTests, runCoreRenderProcessTests].concat(packageTestSuites)
220-
}
221-
break
222-
case 'win32':
223-
suites = (process.arch === 'x64') ? [runCoreMainProcessTests, runCoreRenderProcessTests] : [runCoreMainProcessTests]
224-
break
225-
case 'linux':
226-
suites = [runCoreMainProcessTests]
227-
break
228-
default:
229-
console.log(`Unrecognized platform: ${platform}`)
208+
if ((platform === 'darwin') || (platform === 'win32' && process.arch === 'x64')) {
209+
const PACKAGES_TO_TEST_IN_PARALLEL = 23
210+
211+
if (process.env.ATOM_RUN_CORE_TESTS === 'true') {
212+
suites = [runCoreMainProcessTests, runCoreRenderProcessTests]
213+
} else if (process.env.ATOM_RUN_PACKAGE_TESTS === '1') {
214+
suites = packageTestSuites.slice(0, PACKAGES_TO_TEST_IN_PARALLEL)
215+
} else if (process.env.ATOM_RUN_PACKAGE_TESTS === '2') {
216+
suites = packageTestSuites.slice(PACKAGES_TO_TEST_IN_PARALLEL)
217+
} else {
218+
suites = [runCoreMainProcessTests, runCoreRenderProcessTests].concat(packageTestSuites)
219+
}
220+
}
221+
else if ((platform === 'linux') || (platform === 'win32' && process.arch === 'x86')) {
222+
suites = [runCoreMainProcessTests]
223+
}
224+
else {
225+
console.log(`Unrecognized platform: ${platform}`)
230226
}
231227

232228
if (argv.skipMainProcessTests) {

script/vsts/platforms/windows.yml

Lines changed: 161 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
jobs:
2-
- job: Windows
2+
- job: Windows_Build
33
dependsOn: GetReleaseVersion
44
timeoutInMinutes: 180
55
strategy:
@@ -114,69 +114,13 @@ jobs:
114114
npm_config_build_from_source: true
115115
displayName: Build Atom
116116
117-
- script: |
118-
%RunCommand% script\test.cmd
119-
env:
120-
CI: true
121-
CI_PROVIDER: VSTS
122-
ATOM_JASMINE_REPORTER: list
123-
TEST_JUNIT_XML_ROOT: $(Common.TestResultsDirectory)\junit
124-
BUILD_ARCH: $(buildArch)
125-
displayName: Run tests
126-
condition: and(succeeded(), ne(variables['Atom.SkipTests'], 'true'))
127-
128-
- script: >
129-
%RunCommand% script\postprocess-junit-results.cmd
130-
--search-folder %TEST_JUNIT_XML_ROOT% --test-results-files "**/*.xml"
131-
env:
132-
TEST_JUNIT_XML_ROOT: $(Common.TestResultsDirectory)\junit
133-
displayName: Post-process test results
134-
condition: ne(variables['Atom.SkipTests'], 'true')
135-
136-
- task: PublishTestResults@2
137-
inputs:
138-
testResultsFormat: JUnit
139-
searchFolder: $(Common.TestResultsDirectory)\junit
140-
testResultsFiles: '**/*.xml'
141-
mergeTestResults: true
142-
testRunTitle: Windows $(buildArch)
143-
condition: ne(variables['Atom.SkipTests'], 'true')
144-
145-
- script: |
146-
IF NOT EXIST "%ARTIFACT_STAGING_DIR%\crash-reports" MKDIR "%ARTIFACT_STAGING_DIR%\crash-reports"
147-
IF EXIST "%Temp%\Atom Crashes" (
148-
FOR %%a in ("%Temp%\Atom Crashes\*.dmp") DO XCOPY "%%a" "%ARTIFACT_STAGING_DIR%\crash-reports" /I
149-
)
150-
displayName: Stage crash reports
151-
condition: failed()
152-
env:
153-
ARTIFACT_STAGING_DIR: $(Build.ArtifactStagingDirectory)
154-
155-
- task: PublishBuildArtifacts@1
156-
inputs:
157-
PathtoPublish: $(Build.ArtifactStagingDirectory)/crash-reports
158-
ArtifactName: crash-reports
159-
displayName: Publish crash reports on non-release branch
160-
condition: and(failed(), eq(variables['ATOM_RELEASES_S3_KEY'], ''))
161-
162-
- script: >
163-
node $(Build.SourcesDirectory)\script\vsts\upload-crash-reports.js --crash-report-path "%ARTIFACT_STAGING_DIR%\crash-reports" --s3-path "vsts-artifacts/%BUILD_ID%/"
164-
env:
165-
ATOM_RELEASES_S3_KEY: $(ATOM_RELEASES_S3_KEY)
166-
ATOM_RELEASES_S3_SECRET: $(ATOM_RELEASES_S3_SECRET)
167-
ATOM_RELEASES_S3_BUCKET: $(ATOM_RELEASES_S3_BUCKET)
168-
ARTIFACT_STAGING_DIR: $(Build.ArtifactStagingDirectory)
169-
BUILD_ID: $(Build.BuildId)
170-
displayName: Upload crash reports to S3 on release branch
171-
condition: and(failed(), ne(variables['ATOM_RELEASES_S3_KEY'], ''))
172-
173117
- task: PublishBuildArtifacts@1
174118
inputs:
175119
PathtoPublish: $(Build.SourcesDirectory)/out/atom-x64-windows.zip
176120
ArtifactName: atom-x64-windows.zip
177121
ArtifactType: Container
178122
displayName: Upload atom-x64-windows.zip
179-
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'), eq(variables['buildArch'], 'x64'))
123+
condition: and(succeeded(), eq(variables['buildArch'], 'x64'))
180124

181125
- task: PublishBuildArtifacts@1
182126
inputs:
@@ -217,7 +161,7 @@ jobs:
217161
ArtifactName: atom-windows.zip
218162
ArtifactType: Container
219163
displayName: Upload atom-windows.zip
220-
condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest'), eq(variables['buildArch'], 'x86'))
164+
condition: and(succeeded(), eq(variables['buildArch'], 'x86'))
221165

222166
- task: PublishBuildArtifacts@1
223167
inputs:
@@ -251,3 +195,161 @@ jobs:
251195
ArtifactType: Container
252196
displayName: Upload RELEASES
253197
condition: and(succeeded(), eq(variables['IsReleaseBranch'], 'true'), eq(variables['buildArch'], 'x86'))
198+
199+
- job: Windows_Tets
200+
dependsOn: Windows_Build
201+
timeoutInMinutes: 180
202+
strategy:
203+
maxParallel: 4
204+
matrix:
205+
core_x64:
206+
RunCoreTests: true
207+
RunPackageTests: false
208+
buildArch: x64
209+
core_x86:
210+
RunCoreTests: true
211+
RunPackageTests: false
212+
buildArch: x86
213+
packages-1:
214+
RunCoreTests: false
215+
RunPackageTests: 1
216+
buildArch: x64
217+
packages-2:
218+
RunCoreTests: false
219+
RunPackageTests: 2
220+
buildArch: x64
221+
222+
pool:
223+
vmImage: vs2017-win2016
224+
225+
variables:
226+
AppName: $[ dependencies.GetReleaseVersion.outputs['Version.AppName'] ]
227+
ReleaseVersion: $[ dependencies.GetReleaseVersion.outputs['Version.ReleaseVersion'] ]
228+
IsReleaseBranch: $[ dependencies.GetReleaseVersion.outputs['Version.IsReleaseBranch'] ]
229+
IsSignedZipBranch: $[ dependencies.GetReleaseVersion.outputs['Version.IsSignedZipBranch'] ]
230+
231+
steps:
232+
- script: |
233+
IF [%BUILD_ARCH%]==[x64] (
234+
SET RunCommand=
235+
) ELSE (
236+
SET RunCommand=node script\vsts\windows-run.js
237+
)
238+
echo RunCommand set to: %RunCommand%
239+
env:
240+
BUILD_ARCH: $(buildArch)
241+
displayName: Set RunCommand based on the arch
242+
243+
- task: UsePythonVersion@0
244+
inputs:
245+
versionSpec: '2.7'
246+
247+
- task: NodeTool@0
248+
inputs:
249+
versionSpec: 12.13.1
250+
displayName: Install Node.js 12.13.1
251+
252+
- script: |
253+
ECHO Installing npm-windows-upgrade
254+
npm install --global --production npm-windows-upgrade
255+
displayName: Install npm-windows-upgrade
256+
257+
- script: |
258+
ECHO Upgrading npm
259+
npm-windows-upgrade --no-spinner --no-prompt --npm-version 6.12.1
260+
displayName: Install npm 6.12.1
261+
262+
- script: |
263+
npm install --global --production [email protected]
264+
displayName: Install windows build tools
265+
266+
- script: |
267+
cd script\vsts
268+
npm install
269+
displayName: Install Windows build dependencies
270+
271+
- template: cache.yml
272+
parameters:
273+
OS: windows
274+
275+
# Downloading the build artifacts
276+
- task: DownloadBuildArtifacts@0
277+
displayName: Download atom-x64-windows.zip
278+
inputs:
279+
artifactName: 'atom-x64-windows.zip'
280+
downloadPath: $(Build.SourcesDirectory)
281+
condition: and(succeeded(), eq(variables['buildArch'], 'x64'))
282+
283+
- script: unzip atom-x64-windows.zip/atom-x64-windows.zip -d out
284+
displayName: Unzip atom-x64-windows.zip
285+
condition: and(succeeded(), eq(variables['buildArch'], 'x64'))
286+
287+
- task: DownloadBuildArtifacts@0
288+
displayName: Download atom-windows.zip
289+
inputs:
290+
artifactName: 'atom-windows.zip'
291+
downloadPath: $(Build.SourcesDirectory)
292+
condition: and(succeeded(), eq(variables['buildArch'], 'x86'))
293+
294+
- script: unzip atom-windows.zip/atom-windows.zip -d out
295+
displayName: Unzip atom-windows.zip
296+
condition: and(succeeded(), eq(variables['buildArch'], 'x86'))
297+
298+
# Run the tests
299+
- script: |
300+
%RunCommand% script\test.cmd
301+
env:
302+
CI: true
303+
CI_PROVIDER: VSTS
304+
ATOM_JASMINE_REPORTER: list
305+
TEST_JUNIT_XML_ROOT: $(Common.TestResultsDirectory)\junit
306+
ATOM_RUN_CORE_TESTS: $(RunCoreTests)
307+
ATOM_RUN_PACKAGE_TESTS: $(RunPackageTests)
308+
BUILD_ARCH: $(buildArch)
309+
displayName: Run tests
310+
condition: and(succeeded(), ne(variables['Atom.SkipTests'], 'true'))
311+
312+
- script: >
313+
%RunCommand% script\postprocess-junit-results.cmd
314+
--search-folder %TEST_JUNIT_XML_ROOT% --test-results-files "**/*.xml"
315+
env:
316+
TEST_JUNIT_XML_ROOT: $(Common.TestResultsDirectory)\junit
317+
displayName: Post-process test results
318+
condition: ne(variables['Atom.SkipTests'], 'true')
319+
320+
- task: PublishTestResults@2
321+
inputs:
322+
testResultsFormat: JUnit
323+
searchFolder: $(Common.TestResultsDirectory)\junit
324+
testResultsFiles: '**/*.xml'
325+
mergeTestResults: true
326+
testRunTitle: Windows $(buildArch)
327+
condition: ne(variables['Atom.SkipTests'], 'true')
328+
329+
- script: |
330+
IF NOT EXIST "%ARTIFACT_STAGING_DIR%\crash-reports" MKDIR "%ARTIFACT_STAGING_DIR%\crash-reports"
331+
IF EXIST "%Temp%\Atom Crashes" (
332+
FOR %%a in ("%Temp%\Atom Crashes\*.dmp") DO XCOPY "%%a" "%ARTIFACT_STAGING_DIR%\crash-reports" /I
333+
)
334+
displayName: Stage crash reports
335+
condition: failed()
336+
env:
337+
ARTIFACT_STAGING_DIR: $(Build.ArtifactStagingDirectory)
338+
339+
- task: PublishBuildArtifacts@1
340+
inputs:
341+
PathtoPublish: $(Build.ArtifactStagingDirectory)/crash-reports
342+
ArtifactName: crash-reports
343+
displayName: Publish crash reports on non-release branch
344+
condition: and(failed(), eq(variables['ATOM_RELEASES_S3_KEY'], ''))
345+
346+
- script: >
347+
node $(Build.SourcesDirectory)\script\vsts\upload-crash-reports.js --crash-report-path "%ARTIFACT_STAGING_DIR%\crash-reports" --s3-path "vsts-artifacts/%BUILD_ID%/"
348+
env:
349+
ATOM_RELEASES_S3_KEY: $(ATOM_RELEASES_S3_KEY)
350+
ATOM_RELEASES_S3_SECRET: $(ATOM_RELEASES_S3_SECRET)
351+
ATOM_RELEASES_S3_BUCKET: $(ATOM_RELEASES_S3_BUCKET)
352+
ARTIFACT_STAGING_DIR: $(Build.ArtifactStagingDirectory)
353+
BUILD_ID: $(Build.BuildId)
354+
displayName: Upload crash reports to S3 on release branch
355+
condition: and(failed(), ne(variables['ATOM_RELEASES_S3_KEY'], ''))

0 commit comments

Comments
 (0)