Skip to content

Commit cddb2e0

Browse files
committed
Run windows tests in parallel
1 parent d5f6ee7 commit cddb2e0

File tree

2 files changed

+194
-79
lines changed

2 files changed

+194
-79
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: 176 additions & 57 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:
@@ -131,62 +131,6 @@ jobs:
131131
npm_config_build_from_source: true
132132
displayName: Build Atom
133133
134-
- script: |
135-
%RunCommand% script\test.cmd
136-
env:
137-
CI: true
138-
CI_PROVIDER: VSTS
139-
ATOM_JASMINE_REPORTER: list
140-
TEST_JUNIT_XML_ROOT: $(Common.TestResultsDirectory)\junit
141-
BUILD_ARCH: $(buildArch)
142-
displayName: Run tests
143-
condition: and(succeeded(), ne(variables['Atom.SkipTests'], 'true'))
144-
145-
- script: >
146-
%RunCommand% script\postprocess-junit-results.cmd
147-
--search-folder %TEST_JUNIT_XML_ROOT% --test-results-files "**/*.xml"
148-
env:
149-
TEST_JUNIT_XML_ROOT: $(Common.TestResultsDirectory)\junit
150-
displayName: Post-process test results
151-
condition: ne(variables['Atom.SkipTests'], 'true')
152-
153-
- task: PublishTestResults@2
154-
inputs:
155-
testResultsFormat: JUnit
156-
searchFolder: $(Common.TestResultsDirectory)\junit
157-
testResultsFiles: '**/*.xml'
158-
mergeTestResults: true
159-
testRunTitle: Windows $(buildArch)
160-
condition: ne(variables['Atom.SkipTests'], 'true')
161-
162-
- script: |
163-
IF NOT EXIST "%ARTIFACT_STAGING_DIR%\crash-reports" MKDIR "%ARTIFACT_STAGING_DIR%\crash-reports"
164-
IF EXIST "%Temp%\Atom Crashes" (
165-
FOR %%a in ("%Temp%\Atom Crashes\*.dmp") DO XCOPY "%%a" "%ARTIFACT_STAGING_DIR%\crash-reports" /I
166-
)
167-
displayName: Stage crash reports
168-
condition: failed()
169-
env:
170-
ARTIFACT_STAGING_DIR: $(Build.ArtifactStagingDirectory)
171-
172-
- task: PublishBuildArtifacts@1
173-
inputs:
174-
PathtoPublish: $(Build.ArtifactStagingDirectory)/crash-reports
175-
ArtifactName: crash-reports
176-
displayName: Publish crash reports on non-release branch
177-
condition: and(failed(), eq(variables['ATOM_RELEASES_S3_KEY'], ''))
178-
179-
- script: >
180-
node $(Build.SourcesDirectory)\script\vsts\upload-crash-reports.js --crash-report-path "%ARTIFACT_STAGING_DIR%\crash-reports" --s3-path "vsts-artifacts/%BUILD_ID%/"
181-
env:
182-
ATOM_RELEASES_S3_KEY: $(ATOM_RELEASES_S3_KEY)
183-
ATOM_RELEASES_S3_SECRET: $(ATOM_RELEASES_S3_SECRET)
184-
ATOM_RELEASES_S3_BUCKET: $(ATOM_RELEASES_S3_BUCKET)
185-
ARTIFACT_STAGING_DIR: $(Build.ArtifactStagingDirectory)
186-
BUILD_ID: $(Build.BuildId)
187-
displayName: Upload crash reports to S3 on release branch
188-
condition: and(failed(), ne(variables['ATOM_RELEASES_S3_KEY'], ''))
189-
190134
- task: PublishBuildArtifacts@1
191135
inputs:
192136
PathtoPublish: $(Build.SourcesDirectory)/out/atom-x64-windows.zip
@@ -268,3 +212,178 @@ jobs:
268212
ArtifactType: Container
269213
displayName: Upload RELEASES
270214
condition: and(succeeded(), eq(variables['IsReleaseBranch'], 'true'), eq(variables['buildArch'], 'x86'))
215+
216+
- job: Windows_Tets
217+
dependsOn: Windows_Build
218+
timeoutInMinutes: 180
219+
strategy:
220+
maxParallel: 4
221+
matrix:
222+
core_x64:
223+
RunCoreTests: true
224+
RunPackageTests: false
225+
buildArch: x64
226+
core_x86:
227+
RunCoreTests: true
228+
RunPackageTests: false
229+
buildArch: x86
230+
packages-1:
231+
RunCoreTests: false
232+
RunPackageTests: 1
233+
buildArch: x64
234+
packages-2:
235+
RunCoreTests: false
236+
RunPackageTests: 2
237+
buildArch: x64
238+
239+
pool:
240+
vmImage: vs2017-win2016
241+
242+
variables:
243+
AppName: $[ dependencies.GetReleaseVersion.outputs['Version.AppName'] ]
244+
ReleaseVersion: $[ dependencies.GetReleaseVersion.outputs['Version.ReleaseVersion'] ]
245+
IsReleaseBranch: $[ dependencies.GetReleaseVersion.outputs['Version.IsReleaseBranch'] ]
246+
IsSignedZipBranch: $[ dependencies.GetReleaseVersion.outputs['Version.IsSignedZipBranch'] ]
247+
248+
steps:
249+
- script: |
250+
IF [%BUILD_ARCH%]==[x64] (
251+
SET RunCommand=
252+
) ELSE (
253+
SET RunCommand=node script\vsts\windows-run.js
254+
)
255+
echo RunCommand set to: %RunCommand%
256+
env:
257+
BUILD_ARCH: $(buildArch)
258+
displayName: Set RunCommand based on the arch
259+
260+
- task: UsePythonVersion@0
261+
inputs:
262+
versionSpec: '2.7'
263+
264+
- task: NodeTool@0
265+
inputs:
266+
versionSpec: 12.13.1
267+
displayName: Install Node.js 12.13.1
268+
269+
- script: |
270+
ECHO Installing npm-windows-upgrade
271+
npm install --global --production npm-windows-upgrade
272+
displayName: Install npm-windows-upgrade
273+
274+
- script: |
275+
ECHO Upgrading npm
276+
npm-windows-upgrade --no-spinner --no-prompt --npm-version 6.12.1
277+
displayName: Install npm 6.12.1
278+
279+
- script: |
280+
npm install --global --production [email protected]
281+
displayName: Install windows build tools
282+
283+
- script: |
284+
cd script\vsts
285+
npm install
286+
displayName: Install Windows build dependencies
287+
288+
- task: Cache@2
289+
displayName: Cache node_modules
290+
inputs:
291+
key: 'npm | "$(Agent.OS)" | "$(buildArch)" | package.json, package-lock.json, script/vsts/platforms/windows.yml'
292+
path: 'node_modules'
293+
cacheHitVar: MainNodeModulesRestored
294+
295+
- task: Cache@2
296+
displayName: Cache script/node_modules
297+
inputs:
298+
key: 'npm | "$(Agent.OS)" | "$(buildArch)" | script/package.json, script/package-lock.json, script/vsts/platforms/windows.yml'
299+
path: 'script/node_modules'
300+
cacheHitVar: ScriptNodeModulesRestored
301+
302+
- task: Cache@2
303+
displayName: Cache apm/node_modules
304+
inputs:
305+
key: 'npm | "$(Agent.OS)" | "$(buildArch)" | apm/package.json, apm/package-lock.json, script/vsts/platforms/windows.yml'
306+
path: 'apm/node_modules'
307+
cacheHitVar: ApmNodeModulesRestored
308+
309+
# Downloading the build artifacts
310+
- task: DownloadBuildArtifacts@0
311+
displayName: Download atom-windows-x64.zip
312+
inputs:
313+
artifactName: 'atom-windows-x64.zip'
314+
downloadPath: $(Build.SourcesDirectory)
315+
condition: and(succeeded(), eq(variables['buildArch'], 'x64'))
316+
317+
- script: unzip atom-windows-x64.zip/atom-windows-x64.zip -d out
318+
displayName: Unzip atom-windows-x64.zip
319+
condition: and(succeeded(), eq(variables['buildArch'], 'x64'))
320+
321+
- task: DownloadBuildArtifacts@0
322+
displayName: Download atom-windows-x86.zip
323+
inputs:
324+
artifactName: 'atom-windows-x86.zip'
325+
downloadPath: $(Build.SourcesDirectory)
326+
condition: and(succeeded(), eq(variables['buildArch'], 'x86'))
327+
328+
- script: unzip atom-windows-x86.zip/atom-windows-x86.zip -d out
329+
displayName: Unzip atom-windows-x86.zip
330+
condition: and(succeeded(), eq(variables['buildArch'], 'x86'))
331+
332+
# Run the tests
333+
- script: |
334+
%RunCommand% script\test.cmd
335+
env:
336+
CI: true
337+
CI_PROVIDER: VSTS
338+
ATOM_JASMINE_REPORTER: list
339+
TEST_JUNIT_XML_ROOT: $(Common.TestResultsDirectory)\junit
340+
ATOM_RUN_CORE_TESTS: $(RunCoreTests)
341+
ATOM_RUN_PACKAGE_TESTS: $(RunPackageTests)
342+
BUILD_ARCH: $(buildArch)
343+
displayName: Run tests
344+
condition: and(succeeded(), ne(variables['Atom.SkipTests'], 'true'))
345+
346+
- script: >
347+
%RunCommand% script\postprocess-junit-results.cmd
348+
--search-folder %TEST_JUNIT_XML_ROOT% --test-results-files "**/*.xml"
349+
env:
350+
TEST_JUNIT_XML_ROOT: $(Common.TestResultsDirectory)\junit
351+
displayName: Post-process test results
352+
condition: ne(variables['Atom.SkipTests'], 'true')
353+
354+
- task: PublishTestResults@2
355+
inputs:
356+
testResultsFormat: JUnit
357+
searchFolder: $(Common.TestResultsDirectory)\junit
358+
testResultsFiles: '**/*.xml'
359+
mergeTestResults: true
360+
testRunTitle: Windows $(buildArch)
361+
condition: ne(variables['Atom.SkipTests'], 'true')
362+
363+
- script: |
364+
IF NOT EXIST "%ARTIFACT_STAGING_DIR%\crash-reports" MKDIR "%ARTIFACT_STAGING_DIR%\crash-reports"
365+
IF EXIST "%Temp%\Atom Crashes" (
366+
FOR %%a in ("%Temp%\Atom Crashes\*.dmp") DO XCOPY "%%a" "%ARTIFACT_STAGING_DIR%\crash-reports" /I
367+
)
368+
displayName: Stage crash reports
369+
condition: failed()
370+
env:
371+
ARTIFACT_STAGING_DIR: $(Build.ArtifactStagingDirectory)
372+
373+
- task: PublishBuildArtifacts@1
374+
inputs:
375+
PathtoPublish: $(Build.ArtifactStagingDirectory)/crash-reports
376+
ArtifactName: crash-reports
377+
displayName: Publish crash reports on non-release branch
378+
condition: and(failed(), eq(variables['ATOM_RELEASES_S3_KEY'], ''))
379+
380+
- script: >
381+
node $(Build.SourcesDirectory)\script\vsts\upload-crash-reports.js --crash-report-path "%ARTIFACT_STAGING_DIR%\crash-reports" --s3-path "vsts-artifacts/%BUILD_ID%/"
382+
env:
383+
ATOM_RELEASES_S3_KEY: $(ATOM_RELEASES_S3_KEY)
384+
ATOM_RELEASES_S3_SECRET: $(ATOM_RELEASES_S3_SECRET)
385+
ATOM_RELEASES_S3_BUCKET: $(ATOM_RELEASES_S3_BUCKET)
386+
ARTIFACT_STAGING_DIR: $(Build.ArtifactStagingDirectory)
387+
BUILD_ID: $(Build.BuildId)
388+
displayName: Upload crash reports to S3 on release branch
389+
condition: and(failed(), ne(variables['ATOM_RELEASES_S3_KEY'], ''))

0 commit comments

Comments
 (0)