-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7d3609e
commit 6f98058
Showing
1 changed file
with
181 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,181 @@ | ||
# Node.js | ||
# Build a general Node.js project with npm. | ||
# Add steps that analyze code, save build artifacts, deploy, and more: | ||
# https://docs.microsoft.com/azure/devops/pipelines/languages/javascript | ||
|
||
resources: | ||
repositories: | ||
- repository: Service # The name used to reference this repository in the checkout step | ||
type: github | ||
endpoint: dmitrykurmanov:admin | ||
name: surveyjs/service | ||
|
||
trigger: | ||
batch: true | ||
branches: | ||
include: | ||
- legacy/1.12.15 | ||
tags: | ||
exclude: | ||
- v*.*.* | ||
|
||
pool: | ||
vmImage: "ubuntu-latest" | ||
|
||
steps: | ||
- checkout: self | ||
- checkout: Service | ||
persistCredentials: true | ||
clean: true | ||
fetchDepth: 1 | ||
|
||
- task: NodeTool@0 | ||
inputs: | ||
versionSpec: "16.x" | ||
displayName: "Install Node.js" | ||
|
||
- task: CopyFiles@2 | ||
inputs: | ||
SourceFolder: "$(Build.SourcesDirectory)/survey-analytics/" | ||
Contents: "package.json" | ||
TargetFolder: "$(Build.SourcesDirectory)/Temp/" | ||
OverWrite: true | ||
displayName: "Copy package.json for cache key" | ||
|
||
- task: Cache@2 | ||
inputs: | ||
key: 'npm-cache-analytics | $(Build.SourcesDirectory)/Temp/package.json' | ||
path: $(Build.SourcesDirectory)/survey-analytics/node_modules | ||
cacheHitVar: NPM_CACHE_RESTORED | ||
displayName: Cache NPM | ||
|
||
- powershell: | | ||
$env:GIT_REDIRECT_STDERR = '2>&1' | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "dmitrykurmanov" | ||
displayName: 'set up Git config' | ||
- task: Npm@1 | ||
displayName: 'NPM install' | ||
inputs: | ||
command: custom | ||
customCommand: install --legacy-peer-deps | ||
verbose: false | ||
workingDir: $(Build.SourcesDirectory)/survey-analytics | ||
condition: ne(variables.NPM_CACHE_RESTORED, 'true') | ||
|
||
- script: | | ||
cd $(Build.SourcesDirectory)/survey-analytics | ||
npx puppeteer browsers install chrome | ||
displayName: "install chrome" | ||
- task: DownloadBuildArtifacts@0 | ||
inputs: | ||
buildType: 'specific' | ||
project: '44ed9012-3b38-49f8-a488-0e764469a04f' | ||
pipeline: '96' | ||
specificBuildWithTriggering: true | ||
buildVersionToDownload: 'latest' | ||
downloadType: 'single' | ||
artifactName: 'SurveyJSLibraryBuildCoreAngularJquery' | ||
downloadPath: '$(System.ArtifactsDirectory)' | ||
|
||
- task: CopyFiles@2 | ||
inputs: | ||
SourceFolder: "$(System.ArtifactsDirectory)/SurveyJSLibraryBuildCoreAngularJquery/packages/survey-core" | ||
Contents: "**" | ||
TargetFolder: "$(Build.SourcesDirectory)/survey-analytics/node_modules/survey-core" | ||
OverWrite: true | ||
|
||
# npm run release with version | ||
- task: CopyFiles@2 | ||
inputs: | ||
SourceFolder: '$(System.ArtifactsDirectory)/SurveyJSLibraryBuildCoreAngularJquery/' | ||
Contents: 'version.txt' | ||
TargetFolder: '$(Build.SourcesDirectory)/' | ||
OverWrite: true | ||
displayName: 'Copy Build Artifact - SurveyJSVersion File' | ||
|
||
- powershell: | | ||
$version = Get-Content $(Build.SourcesDirectory)/version.txt | ||
Write-Host "##vso[task.setvariable variable=SurveyJSVersion;]$version" | ||
displayName: 'setup SurveyJSVersion variable from SurveyJSVersionFile' | ||
- powershell: | | ||
cd $(Build.SourcesDirectory)/survey-analytics | ||
npm run release -- --release-as $(SurveyJSVersion) | ||
displayName: 'npm run release specific version' | ||
##################################################### | ||
|
||
- script: | | ||
cd $(Build.SourcesDirectory)/survey-analytics | ||
npm run build:prod | ||
displayName: "npm build" | ||
- script: | | ||
cd $(Build.SourcesDirectory)/survey-analytics | ||
npm run build:types:summary | ||
npm run build:types:datatables | ||
npm run build:types:tabulator | ||
displayName: "npm build typings" | ||
- script: | | ||
cd $(Build.SourcesDirectory)/survey-analytics | ||
npm test | ||
displayName: "unit tests" | ||
- script: | | ||
cd $(Build.SourcesDirectory)/survey-analytics | ||
npm run testcafe_ci | ||
displayName: "functional tests" | ||
env: | ||
TESTCAFE_DASHBOARD_AUTHENTICATION_TOKEN: $(TESTCAFE_DASHBOARD_AUTHENTICATION_TOKEN) | ||
TESTCAFE_DASHBOARD_URL: $(TESTCAFE_DASHBOARD_URL) | ||
- task: PublishCodeCoverageResults@1 | ||
inputs: | ||
codeCoverageTool: Cobertura # or JaCoCo | ||
summaryFileLocation: '$(System.DefaultWorkingDirectory)/**/*coverage.xml' | ||
reportDirectory: '$(System.DefaultWorkingDirectory)/**/coverage' | ||
|
||
- script: | | ||
cd $(Build.SourcesDirectory)/survey-analytics | ||
npm run doc_gen | ||
displayName: 'generate docs' | ||
- task: CopyFiles@2 | ||
inputs: | ||
SourceFolder: '$(Build.SourcesDirectory)/survey-analytics/docs' | ||
Contents: | | ||
classes.json | ||
pmes.json | ||
surveyjs_definition.json | ||
TargetFolder: '$(Build.SourcesDirectory)/service/surveyjs.io/App_Data/DocsAnalytics' | ||
OverWrite: true | ||
CleanTargetFolder: false | ||
displayName: 'copy generated docs to the local surveyjs/service repo' | ||
|
||
# read about the problem with git output ($env:GIT_REDIRECT_STDERR = '2>&1') : | ||
# https://github.com/microsoft/azure-pipelines-yaml/issues/248 | ||
# https://stackoverflow.com/questions/58485585/azure-pipeline-powershell-and-git-on-windows-server-2019-gives-error-in-output | ||
- powershell: | | ||
cd $(Build.SourcesDirectory)/service | ||
git pull origin master | ||
git fetch origin master --tags --force | ||
git checkout master | ||
git add surveyjs.io/App_Data/DocsAnalytics | ||
git commit -m "updated survey-analytics docs" | ||
git pull origin master | ||
git push origin master | ||
displayName: 'git surveyjs/service push updated docs' | ||
- task: CopyFiles@2 | ||
inputs: | ||
SourceFolder: '$(Build.SourcesDirectory)/survey-analytics/packages' | ||
targetFolder: $(Build.ArtifactStagingDirectory)/SurveyJSAnalyticsBuild/packages/survey-analytics | ||
|
||
- task: PublishBuildArtifacts@1 | ||
inputs: | ||
PathtoPublish: '$(Build.ArtifactStagingDirectory)/SurveyJSAnalyticsBuild/' | ||
ArtifactName: 'SurveyJSAnalyticsBuild' | ||
publishLocation: 'Container' |