Atom/script/vsts/platforms/macos.yml

196 lines
7.3 KiB
YAML

jobs:
- job: macOS_build
displayName: macOS build
dependsOn: GetReleaseVersion
timeoutInMinutes: 180
variables:
ReleaseVersion: $[ dependencies.GetReleaseVersion.outputs['Version.ReleaseVersion'] ]
IsReleaseBranch: $[ dependencies.GetReleaseVersion.outputs['Version.IsReleaseBranch'] ]
IsSignedZipBranch: $[ dependencies.GetReleaseVersion.outputs['Version.IsSignedZipBranch'] ]
pool:
vmImage: macos-10.13
steps:
- task: NodeTool@0
inputs:
versionSpec: 10.2.1
displayName: Install Node.js 10.2.1
- script: npm install --global npm@6.2.0
displayName: Update npm
- task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreCacheV1.RestoreCache@1
displayName: Restore node_modules cache
inputs:
keyfile: 'package.json, script/vsts/platforms/macos.yml, **/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json'
targetfolder: '**/node_modules, !**/node_modules/**/node_modules'
vstsFeed: 'bae1bc26-220d-43c7-a955-4de039370de2'
- script: script/bootstrap
displayName: Bootstrap build environment
env:
CI: true
CI_PROVIDER: VSTS
NPM_BIN_PATH: /usr/local/bin/npm
condition: ne(variables['CacheRestored'], 'true')
- task: 1ESLighthouseEng.PipelineArtifactCaching.SaveCacheV1.SaveCache@1
displayName: Save node_modules cache
inputs:
keyfile: 'package.json, script/vsts/platforms/macos.yml, **/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json'
targetfolder: '**/node_modules, !**/node_modules/**/node_modules'
vstsFeed: 'bae1bc26-220d-43c7-a955-4de039370de2'
- script: script/lint
displayName: Run linter
- script: |
if [ $IS_RELEASE_BRANCH == "true" ] || [ $IS_SIGNED_ZIP_BRANCH == "true" ]; then
script/build --no-bootstrap --code-sign --compress-artifacts
else
script/build --no-bootstrap --compress-artifacts
fi
displayName: Build Atom
env:
GITHUB_TOKEN: $(GITHUB_TOKEN)
IS_RELEASE_BRANCH: $(IsReleaseBranch)
IS_SIGNED_ZIP_BRANCH: $(IsSignedZipBranch)
ATOM_RELEASE_VERSION: $(ReleaseVersion)
ATOM_MAC_CODE_SIGNING_CERT_DOWNLOAD_URL: $(ATOM_MAC_CODE_SIGNING_CERT_DOWNLOAD_URL)
ATOM_MAC_CODE_SIGNING_CERT_PASSWORD: $(ATOM_MAC_CODE_SIGNING_CERT_PASSWORD)
ATOM_MAC_CODE_SIGNING_KEYCHAIN: $(ATOM_MAC_CODE_SIGNING_KEYCHAIN)
ATOM_MAC_CODE_SIGNING_KEYCHAIN_PASSWORD: $(ATOM_MAC_CODE_SIGNING_KEYCHAIN_PASSWORD)
- script: |
cp $(Build.SourcesDirectory)/out/*.zip $(Build.ArtifactStagingDirectory)
displayName: Stage Artifacts
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: $(Build.ArtifactStagingDirectory)/atom-mac.zip
ArtifactName: atom-mac.zip
ArtifactType: Container
displayName: Upload atom-mac.zip
condition: succeeded()
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: $(Build.ArtifactStagingDirectory)/atom-mac-symbols.zip
ArtifactName: atom-mac-symbols.zip
ArtifactType: Container
displayName: Upload atom-mac-symbols.zip
condition: succeeded()
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: $(Build.SourcesDirectory)/docs/output/atom-api.json
ArtifactName: atom-api.json
ArtifactType: Container
displayName: Upload atom-api.json
condition: succeeded()
- job: macOS_tests
displayName: macOS test
dependsOn: macOS_build
timeoutInMinutes: 180
pool:
vmImage: macos-10.13
strategy:
maxParallel: 3
matrix:
core:
RunCoreTests: true
RunPackageTests: false
packages-1:
RunCoreTests: false
RunPackageTests: 1
packages-2:
RunCoreTests: false
RunPackageTests: 2
steps:
- task: NodeTool@0
inputs:
versionSpec: 10.2.1
displayName: Install Node.js 10.2.1
- script: npm install --global npm@6.2.0
displayName: Update npm
- task: 1ESLighthouseEng.PipelineArtifactCaching.RestoreCacheV1.RestoreCache@1
displayName: Restore node_modules cache
inputs:
keyfile: 'package.json, script/vsts/platforms/macos.yml, **/package-lock.json, !**/node_modules/**/package-lock.json, !**/.*/**/package-lock.json'
targetfolder: '**/node_modules, !**/node_modules/**/node_modules'
vstsFeed: 'bae1bc26-220d-43c7-a955-4de039370de2'
# The artifact caching task does not work on forks, so we need to
# bootstrap again for pull requests coming from forked repositories.
- script: script/bootstrap
displayName: Bootstrap build environment
env:
CI: true
CI_PROVIDER: VSTS
NPM_BIN_PATH: /usr/local/bin/npm
condition: ne(variables['CacheRestored'], 'true')
- task: DownloadBuildArtifacts@0
displayName: Download atom-mac.zip
inputs:
artifactName: 'atom-mac.zip'
downloadPath: $(Build.SourcesDirectory)
- script: unzip atom-mac.zip/atom-mac.zip -d out
displayName: Unzip atom-mac.zip
- task: DownloadBuildArtifacts@0
displayName: Download atom-mac-symbols.zip
inputs:
artifactName: 'atom-mac-symbols.zip'
downloadPath: $(Build.SourcesDirectory)
- script: unzip atom-mac-symbols.zip/atom-mac-symbols.zip -d out
displayName: Unzip atom-mac-symbols.zip
- script: |
osascript -e 'tell application "System Events" to keystroke "x"' # clear screen saver
caffeinate -s script/test # Run with caffeinate to prevent screen saver
env:
CI: true
CI_PROVIDER: VSTS
ATOM_JASMINE_REPORTER: list
TEST_JUNIT_XML_ROOT: $(Common.TestResultsDirectory)/junit
ATOM_RUN_CORE_TESTS: $(RunCoreTests)
ATOM_RUN_PACKAGE_TESTS: $(RunPackageTests)
displayName: Run tests
condition: and(succeeded(), ne(variables['Atom.SkipTests'], 'true'))
- script: script/postprocess-junit-results --search-folder "${TEST_JUNIT_XML_ROOT}" --test-results-files "**/*.xml"
env:
TEST_JUNIT_XML_ROOT: $(Common.TestResultsDirectory)/junit
displayName: Post-process test results
condition: ne(variables['Atom.SkipTests'], 'true')
- task: PublishTestResults@2
inputs:
testResultsFormat: JUnit
searchFolder: $(Common.TestResultsDirectory)/junit
testResultsFiles: '**/*.xml'
mergeTestResults: true
testRunTitle: MacOS
condition: ne(variables['Atom.SkipTests'], 'true')
- script: |
mkdir -p $(Build.ArtifactStagingDirectory)/crash-reports
cp ${HOME}/Library/Logs/DiagnosticReports/*.crash $(Build.ArtifactStagingDirectory)/crash-reports
displayName: Stage Crash Reports
condition: failed()
- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: $(Build.ArtifactStagingDirectory)/crash-reports
ArtifactName: crash-reports.zip
displayName: Upload Crash Reports
condition: failed()