cosmos-explorer/azure-pipelines.yaml
2020-05-25 21:30:55 -05:00

212 lines
7.3 KiB
YAML

trigger:
branches:
include:
- master
- "*"
paths:
include:
- "*"
exclude:
- Product/Portal/CapacityCalculator/*
- Product/Portal/DefaultConsistency/*
pool:
vmImage: "windows-latest"
jobs:
- job: FormatLintCompile
displayName: "Format/Lint/Compile"
steps:
- task: Npm@1
displayName: "Install Dependencies"
inputs:
workingDir: 'Product\Portal\DataExplorer'
verbose: false
- task: Npm@1
displayName: "Format"
inputs:
command: custom
workingDir: 'Product\Portal\DataExplorer'
verbose: false
customCommand: "run format:check"
- task: Npm@1
displayName: "Lint"
inputs:
command: custom
workingDir: 'Product\Portal\DataExplorer'
verbose: false
customCommand: "run lint"
- task: Npm@1
displayName: "Compile"
inputs:
command: custom
workingDir: 'Product\Portal\DataExplorer'
verbose: false
customCommand: "run compile"
- task: Npm@1
displayName: "Compile Strict Mode Files"
inputs:
command: custom
workingDir: 'Product\Portal\DataExplorer'
verbose: false
customCommand: "run compile:strict"
- job: EndToEndTests
displayName: "End to End Tests"
steps:
- powershell: |
Write-Host "Starting Comsos DB Emulator"
Start-Process "$env:ProgramFiles\Azure Cosmos DB Emulator\CosmosDB.Emulator.exe" "/NoUI /DisableRateLimiting" -Verb RunAs
displayName: "Start Emulator"
- bash: |
npm ci --prefix ./Product/Portal/DataExplorer
npm start --prefix ./Product/Portal/DataExplorer &
npm ci --prefix ./Product/Portal/DataExplorer/cypress
npm run test:ci --prefix ./Product/Portal/DataExplorer/cypress -- --spec ./integration/dataexplorer/ci-tests/createDatabase.spec.ts
displayName: "Start Server and Run Tests"
env:
EMULATOR_ENDPOINT: https://0.0.0.0:8081/
NODE_TLS_REJECT_UNAUTHORIZED: 0
- task: PublishBuildArtifacts@1
displayName: "Publish Screenshots"
inputs:
targetPath: $(System.DefaultWorkingDirectory)/Product/Portal/DataExplorer/cypress/cypress/screenshots
artifactName: e2e-screenshots
condition: failed()
continueOnError: true
- task: PublishBuildArtifacts@1
displayName: "Publish Videos"
inputs:
pathtoPublish: $(System.DefaultWorkingDirectory)/Product/Portal/DataExplorer/cypress/cypress/videos
artifactName: e2e-videos
condition: succeededOrFailed()
continueOnError: true
- job: UnitTests
displayName: "Unit Tests"
steps:
- task: NodeTool@0
displayName: "Use Node 12.x"
inputs:
versionSpec: 12.x
- task: Npm@1
displayName: "Install Dependencies"
inputs:
command: custom
workingDir: "$(System.DefaultWorkingDirectory)/Product/Portal/DataExplorer"
verbose: false
customCommand: "ci"
- task: Npm@1
displayName: "Run Unit Tests"
inputs:
command: custom
workingDir: "$(System.DefaultWorkingDirectory)/Product/Portal/DataExplorer"
verbose: false
customCommand: "run test"
- task: PublishTestResults@2
displayName: "Publish Test Results"
inputs:
testResultsFormat: VSTest
testResultsFiles: "**/*.trx"
mergeTestResults: true
testRunTitle: "Check-in Tests"
condition: succeededOrFailed()
- task: PublishCodeCoverageResults@1
displayName: "Publish Code Coverage Report"
inputs:
codeCoverageTool: Cobertura
summaryFileLocation: "$(System.DefaultWorkingDirectory)/Product/Portal/DataExplorer/coverage/cobertura-coverage.xml"
pathToSources: "$(System.DefaultWorkingDirectory)/Product/Portal/DataExplorer"
reportDirectory: "$(System.DefaultWorkingDirectory)/Product/Portal/DataExplorer/coverage/html"
- job: Build
steps:
- task: Cache@2
inputs:
key: 'dataexplorer | "$(Agent.OS)" |'
restoreKeys: 'dataexplorer | "$(Agent.OS)" |'
path: $(System.DefaultWorkingDirectory)/Product/Portal/DataExplorer/.cache
displayName: Restore Build Caches
- task: NodeTool@0
displayName: "Use Node 12.x"
inputs:
versionSpec: 12.x
- task: Npm@1
displayName: "Install Dependencies"
inputs:
workingDir: 'Product\Portal\DataExplorer'
verbose: false
- task: Npm@1
displayName: "Build Contracts"
inputs:
command: custom
workingDir: 'Product\Portal\DataExplorer'
verbose: false
customCommand: "run build:contracts"
- task: Npm@1
displayName: "Bundle - Production"
inputs:
command: custom
workingDir: 'Product\Portal\DataExplorer'
verbose: false
customCommand: "run pack:prod"
- task: Npm@1
displayName: "Copy Output Files to Consumers"
inputs:
command: custom
workingDir: 'Product\Portal\DataExplorer'
verbose: false
customCommand: "run copyToConsumers"
- powershell: |
$GitCommitSHA = $env:BUILD_SOURCEVERSION
$NuspecPath = "$env:BUILD_ARTIFACTSTAGINGDIRECTORY"
$VersionToReplace = "0.0.1-preview"
((Get-Content -path "$NuspecPath\DataExplorer.nuspec" -Raw) -replace $VersionToReplace ,("1.2.0-$GitCommitSHA")) | Set-Content -Path "$NuspecPath\DataExplorer.nuspec"
cat "$NuspecPath\DataExplorer.nuspec"
displayName: "Bump Package Version"
continueOnError: true
- task: NuGetCommand@2
displayName: "Create NuGet package"
inputs:
command: pack
packagesToPack: "$(Build.ArtifactStagingDirectory)/**/*.nuspec"
packDestination: '$(Build.ArtifactStagingDirectory)\NuGet'
- task: NuGetCommand@2
displayName: "NuGet push"
inputs:
command: push
publishVstsFeed: "4e0718b3-a885-4d77-b8c2-09bb2f6eecec"
allowPackageConflicts: true
- powershell: |
$NuspecPath = "$env:BUILD_ARTIFACTSTAGINGDIRECTORY"
$PackageId= "Azure.Cosmos.DB.Data.Explorer"
((Get-Content -path "$NuspecPath\DataExplorer.nuspec" -Raw) -replace $PackageId,("$PackageId.MPAC")) | Set-Content -Path "$NuspecPath\DataExplorer.nuspec"
cat "$NuspecPath\DataExplorer.nuspec"
displayName: "Create MPAC nuspec"
continueOnError: true
- task: NuGetCommand@2
displayName: "Create NuGet MPAC package "
inputs:
command: pack
packagesToPack: "$(Build.ArtifactStagingDirectory)/**/*.nuspec"
packDestination: '$(Build.ArtifactStagingDirectory)\NuGet'
- task: NuGetCommand@2
displayName: "NuGet push MPAC"
inputs:
command: push
publishVstsFeed: "4e0718b3-a885-4d77-b8c2-09bb2f6eecec"
allowPackageConflicts: true
- task: PublishBuildArtifacts@1
displayName: "Publish Artifact: DataExplorer NuGet"
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)\NuGet'
ArtifactName: DataExplorerNuGet