Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add .yaml-based Azure DevOps pipelines to 4.8 branch #3075

Merged
merged 3 commits into from
Nov 18, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions build/yaml/botbuilder-js-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#
# This runs under botbuilder-js-ci.yml. Runs unit tests on Node versions 10 and 12.
#

# "name" here defines the build number format. Build number is accessed via $(Build.BuildNumber)
name: $(Build.BuildId)

pool:
vmImage: 'macOS-10.15'

variables:
PackageVersion: 4.8.0-preview.$(Build.BuildNumber)
PreviewPackageVersion: 4.8.0-preview.$(Build.BuildNumber)

stages:
- stage: Node10CI
dependsOn: [] # Run this stage in parallel
displayName: 'Node 10.x CI'
variables:
NodeVersion: 10.x
jobs:
- job: Node10UnitTests
displayName: 'Node 10.x Unit Tests'
steps:
- template: js-build-steps.yml

- powershell: |
pushd ..
Get-ChildItem -Recurse -Force | Where {$_.FullName -notlike "*node_modules*"}
displayName: 'Dir workspace except node-modules (takes 5 seconds)'
continueOnError: true
condition: succeededOrFailed()

- stage: Node12CI
dependsOn: [] # Run this stage in parallel
displayName: 'Node 12.x CI'
variables:
NodeVersion: 12.x
jobs:
- job: Node12UnitTests
displayName: 'Node 12.x Unit Tests'
steps:
- template: js-build-steps.yml

- powershell: |
pushd ..
Get-ChildItem -Recurse -Force | Where {$_.FullName -notlike "*node_modules*"}
displayName: 'Dir workspace except node-modules (takes 5 seconds)'
continueOnError: true
condition: succeededOrFailed()
111 changes: 111 additions & 0 deletions build/yaml/botbuilder-js-daily.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
# This runs under BotBuilder-JS-daily-yaml.

# "name" here defines the build number format. Build number is accessed via $(Build.BuildNumber)
name: $(Build.BuildId)

pool:
vmImage: 'macOS-10.15'

variables:
NodeVersion: 12.x
# PackageVersion: Define this in Azure to be settable at queue time. Ex: 4.8.0-dev.{DateStamp}.{CommitHash}
# PreviewPackageVersion: Define this in Azure to be settable at queue time. Ex: 4.8.0-dev.{DateStamp}.{CommitHash}

steps:
- powershell: |
# Replace {DateStamp} and {CommitHash} tokens with the actual values in vars PackageVersion and PreviewPackageVersion
$dateStamp = (Get-Date -format "yyyyMMdd");
$commitHash = "$(Build.SourceVersion)".SubString(0,7);

"Raw PackageVersion = $(PackageVersion)";
$v = "$(PackageVersion)".Replace("{DateStamp}",$dateStamp).Replace("{CommitHash}",$commitHash);
Write-Host "##vso[task.setvariable variable=PackageVersion;]$v";
"Resolved PackageVersion = $v";

"Raw PreviewPackageVersion = $(PreviewPackageVersion)";
$ppv = "$(PreviewPackageVersion)".Replace("{DateStamp}",$dateStamp).Replace("{CommitHash}",$commitHash);
Write-Host "##vso[task.setvariable variable=PreviewPackageVersion;]$ppv";
"Resolved PreviewPackageVersion = $ppv";
displayName: 'Resolve package version variables'

- template: js-daily-build-steps.yml

- script: 'lerna exec --no-private npm pack'
displayName: 'lerna exec --no-private npm pack'

- task: CopyFiles@2
displayName: 'Copy TGZ files to staging'
inputs:
SourceFolder: libraries
Contents: '*/*.tgz'
TargetFolder: '$(Build.ArtifactStagingDirectory)'
flattenFolders: true

- task: PublishBuildArtifacts@1
displayName: 'Publish staging to Build Artifacts'

- powershell: |
[string[]]$outvar = (Get-ChildItem *.tgz -Path $(Build.ArtifactStagingDirectory) ).Name;

[int] $packageCount = $outvar.Length;
$PackagesDescription = "$packageCount packages";
$PackagesDescription;
$outvar;

"##vso[task.setvariable variable=PackagesDescription;]$PackagesDescription";
[int] $maxTags = 5;

if ($packageCount -gt $maxTags) {
# Too many packages for tags.

# Set a few package name variables for tags
for ($i = 0; $i -lt $maxTags; $i++ ) {
$p = $outvar[$i];
"##vso[task.setvariable variable=pkg$i;]$p";
}

$message = "(See 'Package names' task log for full list)";
Write-Host "##vso[task.setvariable variable=pkg$i;]$message";
Write-Host $message;
$packageCount = ++$i;
} else {
# Set package name variables for tags
for ($i = 0; $i -lt $packageCount; $i++ ) {
$p = $outvar[$i];
"##vso[task.setvariable variable=pkg$i;]$p";
}
}

for ($i = $packageCount; $i -le 30; $i++ ) {
# Set remaining variables to an empty string
"##vso[task.setvariable variable=pkg$i;]";
}
displayName: 'Package names'
continueOnError: true

- task: colinsalmcorner.colinsalmcorner-buildtasks.tag-build-task.tagBuildOrRelease@0
displayName: 'Tag Build with package names'
inputs:
tags: |
$(PACKAGESDESCRIPTION)
$(PKG0)
$(PKG1)
$(PKG2)
$(PKG3)
$(PKG4)
$(PKG5)
$(PKG6)
$(PKG7)
$(PKG8)
$(PKG9)
$(PKG10)
$(PKG11)
$(PKG12)
continueOnError: true

- powershell: |
pushd ..
ls -R
displayName: 'Dir workspace'
continueOnError: true
condition: succeededOrFailed()
85 changes: 85 additions & 0 deletions build/yaml/js-build-steps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
#variables:
# PackageVersion: Define this in the calling pipeline.

steps:
- task: colinsalmcorner.colinsalmcorner-buildtasks.tag-build-task.tagBuildOrRelease@0
displayName: 'Tag Build with version number. (Skip if a fork PR to avoid access denied error.)'
inputs:
tags: |
v: $(PackageVersion)
preview v: $(PreviewPackageVersion)
continueOnError: true
condition: and(succeeded(), eq(variables['System.PullRequest.IsFork'], 'false'))

- task: NodeTool@0
displayName: 'Use Node $(NodeVersion)'
inputs:
versionSpec: $(NodeVersion)

- task: Npm@1
displayName: 'npm install lerna ...'
inputs:
command: custom
verbose: false
customCommand: 'install --global [email protected] nyc mocha eslint-plugin-jsdoc'

- task: Npm@1
displayName: '/tools npm install'
inputs:
workingDir: tools
verbose: false

- bash: |
set -o xtrace
sed -i '' 's/${Version}/$(PackageVersion)/g' package.json
sed -i '' 's/${Version}/$(PreviewPackageVersion)/g' libraries/adaptive-expressions/package.json
sed -i '' 's/${Version}/$(PackageVersion)/g' libraries/botbuilder/package.json
sed -i '' 's/${Version}/$(PackageVersion)/g' libraries/botbuilder-ai/package.json
sed -i '' 's/${Version}/$(PackageVersion)/g' libraries/botbuilder-applicationinsights/package.json
sed -i '' 's/${Version}/$(PackageVersion)/g' libraries/botbuilder-azure/package.json
sed -i '' 's/${Version}/$(PackageVersion)/g' libraries/botbuilder-core/package.json
sed -i '' 's/${Version}/$(PackageVersion)/g' libraries/botbuilder-dialogs/package.json
sed -i '' 's/${Version}/$(PreviewPackageVersion)/g' libraries/botbuilder-lg/package.json
sed -i '' 's/${Version}/$(PackageVersion)/g' libraries/botbuilder-testing/package.json
sed -i '' 's/${Version}/$(PackageVersion)/g' libraries/botframework-config/package.json
sed -i '' 's/${Version}/$(PackageVersion)/g' libraries/botframework-connector/package.json
sed -i '' 's/${Version}/$(PackageVersion)/g' libraries/botframework-schema/package.json
sed -i '' 's/${Version}/$(PackageVersion)/g' libraries/botframework-streaming/package.json
displayName: 'Replace version number in package.json files'
continueOnError: true

- bash: |
npm run update-versions
displayName: 'npm run update-versions'
env:
Version: $(PackageVersion)
PreviewPackageVersion: $(PreviewPackageVersion)

- powershell: |
$fileName = 'package-lock.json'
Get-ChildItem -Path ./tools -File | Where-Object {$_.Name -eq $fileName};
Write-Host "`nDeleting any files listed above";
Get-ChildItem -Path ./tools -File | Where-Object {$_.Name -eq $fileName} | Remove-Item -Force;
displayName: 'Delete tools/package-lock.json. Maybe avoids intermittent error in \"npm run postinstall\" ENOENT: no such file or directory, lchown ''/Users/runner/.npm/_locks/staging-7c222bec8116519f.lock'''
continueOnError: true

- task: Npm@1
displayName: 'npm run postinstall'
inputs:
command: custom
verbose: false
customCommand: 'run postinstall'

- task: Npm@1
displayName: 'npm run build'
inputs:
command: custom
verbose: false
customCommand: 'run build'

- task: Npm@1
displayName: 'npm run test'
inputs:
command: custom
verbose: false
customCommand: 'run test'
86 changes: 86 additions & 0 deletions build/yaml/js-daily-build-steps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
#variables:
# PackageVersion: Define this in the calling pipeline.
# PreviewPackageVersion: Define this in Azure to be settable at queue time. Ex: 4.9.0-dev.{DateStamp}.{CommitHash}

steps:
- task: colinsalmcorner.colinsalmcorner-buildtasks.tag-build-task.tagBuildOrRelease@0
displayName: 'Tag Build with version number. (Skip if a fork PR to avoid access denied error.)'
inputs:
tags: |
v: $(PackageVersion)
preview v: $(PreviewPackageVersion)
continueOnError: true
condition: and(succeeded(), eq(variables['System.PullRequest.IsFork'], 'false'))

- task: NodeTool@0
displayName: 'Use Node $(NodeVersion)'
inputs:
versionSpec: $(NodeVersion)

- task: Npm@1
displayName: 'npm install lerna ...'
inputs:
command: custom
verbose: false
customCommand: 'install --global [email protected] nyc mocha eslint-plugin-jsdoc'

- task: Npm@1
displayName: '/tools npm install'
inputs:
workingDir: tools
verbose: false

- bash: |
set -o xtrace
sed -i '' 's/${Version}/$(PackageVersion)/g' package.json
sed -i '' 's/${Version}/$(PreviewPackageVersion)/g' libraries/adaptive-expressions/package.json
sed -i '' 's/${Version}/$(PackageVersion)/g' libraries/botbuilder/package.json
sed -i '' 's/${Version}/$(PackageVersion)/g' libraries/botbuilder-ai/package.json
sed -i '' 's/${Version}/$(PackageVersion)/g' libraries/botbuilder-applicationinsights/package.json
sed -i '' 's/${Version}/$(PackageVersion)/g' libraries/botbuilder-azure/package.json
sed -i '' 's/${Version}/$(PackageVersion)/g' libraries/botbuilder-core/package.json
sed -i '' 's/${Version}/$(PackageVersion)/g' libraries/botbuilder-dialogs/package.json
sed -i '' 's/${Version}/$(PreviewPackageVersion)/g' libraries/botbuilder-lg/package.json
sed -i '' 's/${Version}/$(PackageVersion)/g' libraries/botbuilder-testing/package.json
sed -i '' 's/${Version}/$(PackageVersion)/g' libraries/botframework-config/package.json
sed -i '' 's/${Version}/$(PackageVersion)/g' libraries/botframework-connector/package.json
sed -i '' 's/${Version}/$(PackageVersion)/g' libraries/botframework-schema/package.json
sed -i '' 's/${Version}/$(PackageVersion)/g' libraries/botframework-streaming/package.json
displayName: 'Replace version number in package.json files'
continueOnError: true

- bash: |
npm run update-versions
displayName: 'npm run update-versions'
env:
Version: $(PackageVersion)
PreviewPackageVersion: $(PreviewPackageVersion)

- powershell: |
$fileName = 'package-lock.json'
Get-ChildItem -Path ./tools -File | Where-Object {$_.Name -eq $fileName};
Write-Host "`nDeleting any files listed above";
Get-ChildItem -Path ./tools -File | Where-Object {$_.Name -eq $fileName} | Remove-Item -Force;
displayName: 'Delete tools/package-lock.json. Maybe avoids intermittent error in \"npm run postinstall\" ENOENT: no such file or directory, lchown ''/Users/runner/.npm/_locks/staging-7c222bec8116519f.lock'''
continueOnError: true

- task: Npm@1
displayName: 'npm run postinstall'
inputs:
command: custom
verbose: false
customCommand: 'run postinstall'

- task: Npm@1
displayName: 'npm run build'
inputs:
command: custom
verbose: false
customCommand: 'run build'

- task: Npm@1
displayName: 'npm run test'
inputs:
command: custom
verbose: false
customCommand: 'run test'