Skip to content
This repository was archived by the owner on Jan 15, 2025. It is now read-only.

Commit 4ac1279

Browse files
authored
Build yaml files refactor (#911)
* Adding yml files to decouple build and test * Setting version to be passed as variable * Split version settings * Changing expression to be runtime * Changing step to bash * Print versions * Changing reference to variables * Trying bash script * Assigning variables to bash script * Removing typo * Assign variables check * Assignning variables * Assing variable try 3 * Set bash variable * Test 11 * Test12 * Test13 * Refactor of yaml files * Adding version file * Setting variable * Fixing typo * Try #4 variable setting * Try #5 * Try #6 * Try #7 * Try #9 * Try #10 * Try #11 * Try #12 * Try #13 * Try #14 * Try #15 * Try #15 * Try 16 * Removing second script * Trying to remove quote * Try #17 * Try #18 * Last changes to other streams * Renaming job to be compliant on mac * Fixing version for mac pr test * Fixing PR comments * Setting template name
1 parent 930f45e commit 4ac1279

File tree

6 files changed

+142
-122
lines changed

6 files changed

+142
-122
lines changed

build/bf-cli-build-test-steps.yml

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
steps:
2+
- bash: |
3+
short_hash=`git rev-parse --short=7 HEAD` ## At least 7 digits, more if needed for uniqueness
4+
echo "Full git hash: $(Build.SourceVersion)"
5+
echo "Short git hash: $short_hash"
6+
echo "##vso[task.setvariable variable=short_hash]$short_hash" ## Store variable for subsequent steps
7+
workingDirectory: $(Build.SourcesDirectory)
8+
displayName: Get commit number
9+
10+
- powershell: |
11+
$date = (Get-Date).ToString("yyyyMMdd")
12+
echo "##vso[task.setvariable variable=buildDate]$date" ## Store variable for subsequent steps
13+
displayName: Get formatted date
14+
15+
- bash: |
16+
version=`echo "$(version)"`
17+
_version=`echo "$(_version)"`
18+
echo "version: $version"
19+
echo "_version: $_version"
20+
[ -z "$version" ] && buildVersion=$_version.$(buildDate).$(short_hash) || buildVersion=$version
21+
echo "buildVersion: $buildVersion"
22+
echo "##vso[task.setvariable variable=buildVersion]$buildVersion" ## Store variable for subsequent steps
23+
workingDirectory: $(Build.SourcesDirectory)
24+
displayName: Define Build Version
25+
26+
- task: colinsalmcorner.colinsalmcorner-buildtasks.tag-build-task.tagBuildOrRelease@0
27+
displayName: 'Tag Build with version number'
28+
inputs:
29+
tags: 'Version=$(buildVersion)'
30+
continueOnError: true
31+
32+
- task: NodeTool@0
33+
displayName: 'Use Node 12.x'
34+
inputs:
35+
versionSpec: 12.x
36+
37+
- task: Npm@1
38+
displayName: 'npm install --global @microsoft/rush'
39+
inputs:
40+
command: custom
41+
verbose: false
42+
customCommand: 'install --global @microsoft/rush'
43+
44+
- script: 'rush update'
45+
displayName: 'rush update'
46+
47+
- script: 'rush build -p 2'
48+
displayName: 'rush build -p 2'
49+
50+
- script: 'rush test'
51+
displayName: 'rush test'
52+
53+
- script: 'node ./common/scripts/version-and-pack.js --version $(buildVersion)'
54+
displayName: 'Version and Pack'
55+
56+
- task: CopyFiles@2
57+
displayName: 'Copy packages to: $(Build.ArtifactStagingDirectory)/drop'
58+
inputs:
59+
SourceFolder: ./.output
60+
Contents: '**/*.tgz'
61+
TargetFolder: '$(Build.ArtifactStagingDirectory)/drop'
62+
flattenFolders: true
63+
64+
- task: PublishBuildArtifacts@1
65+
displayName: 'Publish Artifact: drop'
66+
inputs:
67+
PathtoPublish: '$(Build.ArtifactStagingDirectory)/drop'
68+
ArtifactName: drop
69+
70+
- powershell: 'Get-ChildItem .. -ErrorAction Continue -Recurse -Force | Where {$_.FullName -notlike "*node_modules*"}'
71+
displayName: 'Dir workspace except node_modules'
72+
continueOnError: true
73+
condition: succeededOrFailed()
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#
2+
# Build Botframework-CLI Azure DevOps bits on Windows agent
3+
#
4+
5+
# "name" here defines the build number format. Build number is accessed via $(Build.BuildNumber)
6+
name: $(Build.BuildId)
7+
8+
pool:
9+
name: Hosted Windows 2019 with VS2019
10+
11+
pr: none
12+
trigger: none
13+
14+
variables:
15+
- template: botframework-cli-version.yml # Template reference ${{ variables.releaseVersion }}
16+
# version: define this in Azure, settable at queue time
17+
18+
stages:
19+
- stage: Build
20+
jobs:
21+
- job:
22+
steps:
23+
- script: echo '##vso[task.setvariable variable=_version]${{ variables.releaseVersion }}-devops
24+
- template: bf-cli-build-test-steps.yml

build/botframework-cli-daily.yml

Lines changed: 10 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -18,67 +18,14 @@ schedules:
1818
include:
1919
- master
2020

21-
jobs:
22-
- job: CLI
23-
21+
variables:
22+
- template: botframework-cli-version.yml # Template reference ${{ variables.releaseVersion }}
23+
# version: define this in Azure, settable at queue time
24+
25+
stages:
26+
- stage: Build
27+
jobs:
28+
- job:
2429
steps:
25-
- bash: |
26-
short_hash=`git rev-parse --short=7 HEAD` ## At least 7 digits, more if needed for uniqueness
27-
echo "Full git hash: $(Build.SourceVersion)"
28-
echo "Short git hash: $short_hash"
29-
echo "##vso[task.setvariable variable=short_hash]$short_hash" ## Store variable for subsequent steps
30-
workingDirectory: $(Build.SourcesDirectory)
31-
displayName: Set Build Version
32-
33-
- powershell: |
34-
$date = (Get-Date).ToString("yyyyMMdd")
35-
echo "##vso[task.setvariable variable=buildDate]$date" ## Store variable for subsequent steps
36-
37-
- task: colinsalmcorner.colinsalmcorner-buildtasks.tag-build-task.tagBuildOrRelease@0
38-
displayName: 'Tag Build with version number'
39-
inputs:
40-
tags: 'Version=4.10.0-dev.$(buildDate).$(short_hash)'
41-
continueOnError: true
42-
43-
- task: NodeTool@0
44-
displayName: 'Use Node 12.x'
45-
inputs:
46-
versionSpec: 12.x
47-
48-
- task: Npm@1
49-
displayName: 'npm install --global @microsoft/rush'
50-
inputs:
51-
command: custom
52-
verbose: false
53-
customCommand: 'install --global @microsoft/rush'
54-
55-
- script: 'rush update'
56-
displayName: 'rush update'
57-
58-
- script: 'rush build -p 2'
59-
displayName: 'rush build -p 2'
60-
61-
- script: 'rush test'
62-
displayName: 'rush test'
63-
64-
- script: 'node ./common/scripts/version-and-pack.js --version 4.10.0-dev.$(buildDate).$(short_hash)'
65-
displayName: 'Version and Pack'
66-
67-
- task: CopyFiles@2
68-
displayName: 'Copy packages to: $(Build.ArtifactStagingDirectory)/drop'
69-
inputs:
70-
SourceFolder: ./.output
71-
Contents: '**/*.tgz'
72-
TargetFolder: '$(Build.ArtifactStagingDirectory)/drop'
73-
flattenFolders: true
74-
75-
- task: PublishBuildArtifacts@1
76-
displayName: 'Publish Artifact: drop'
77-
inputs:
78-
PathtoPublish: '$(Build.ArtifactStagingDirectory)/drop'
79-
ArtifactName: drop
80-
81-
- powershell: 'Get-ChildItem .. -ErrorAction Continue -Recurse -Force | Where {$_.FullName -notlike "*node_modules*"}'
82-
displayName: 'Dir workspace except node_modules'
83-
continueOnError: true
84-
condition: succeededOrFailed()
30+
- script: echo '##vso[task.setvariable variable=_version]${{ variables.releaseVersion }}-dev
31+
- template: bf-cli-build-test-steps.yml

build/botframework-cli-mac.yml

Lines changed: 9 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -25,63 +25,13 @@ pr:
2525
- LICENSE
2626
- PRIVACY.md
2727

28-
jobs:
29-
- job: CLI
30-
variables:
31-
buildVersion: '4.10.0-preview.$(Build.BuildId)'
32-
_version: ${{coalesce(variables.version, variables.buildVersion)}}
33-
28+
variables:
29+
version: '1.0.0'
30+
# version: define this in Azure, settable at queue time
31+
32+
stages:
33+
- stage: Build
34+
jobs:
35+
- job:
3436
steps:
35-
- task: colinsalmcorner.colinsalmcorner-buildtasks.tag-build-task.tagBuildOrRelease@0
36-
displayName: 'Tag Build with version number'
37-
inputs:
38-
tags: 'Version=$(_version)'
39-
continueOnError: true
40-
condition: and(succeeded(), eq(variables['System.PullRequest.IsFork'], 'False'))
41-
42-
- task: NodeTool@0
43-
displayName: 'Use Node 12.x'
44-
inputs:
45-
versionSpec: 12.x
46-
47-
- task: Npm@1
48-
displayName: 'Install rush'
49-
inputs:
50-
command: custom
51-
verbose: false
52-
customCommand: 'install --global @microsoft/rush'
53-
54-
- script: 'rush update'
55-
displayName: 'rush update'
56-
57-
- script: 'rush build'
58-
displayName: 'rush build'
59-
60-
- script: 'rush test -v'
61-
displayName: 'rush test'
62-
63-
- script: 'rush posttest'
64-
displayName: 'rush posttest'
65-
66-
- script: 'node ./common/scripts/version-and-pack.js --version $(_version)'
67-
displayName: 'Version and Pack'
68-
69-
- task: CopyFiles@2
70-
displayName: 'Copy Files to: $(Build.ArtifactStagingDirectory)'
71-
inputs:
72-
SourceFolder: ./.output
73-
Contents: '**/*.tgz'
74-
TargetFolder: '$(Build.ArtifactStagingDirectory)'
75-
flattenFolders: true
76-
77-
- task: PublishBuildArtifacts@1
78-
displayName: 'Publish Artifact: drop'
79-
inputs:
80-
artifactName: 'drop'
81-
82-
- task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
83-
displayName: 'Component Detection'
84-
85-
- script: 'rush report:coverage'
86-
displayName: 'rush report:coverage'
87-
enabled: false
37+
- template: bf-cli-build-test-steps.yml

build/botframework-cli-rc.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#
2+
# Build Botframework-CLI RC bits on Windows agent
3+
#
4+
5+
# "name" here defines the build number format. Build number is accessed via $(Build.BuildNumber)
6+
name: $(Build.BuildId)
7+
8+
pool:
9+
name: Hosted Windows 2019 with VS2019
10+
11+
pr: none
12+
trigger: none
13+
14+
variables:
15+
- template: botframework-cli-version.yml # Template reference ${{ variables.releaseVersion }}
16+
# version: define this in Azure, settable at queue time
17+
18+
stages:
19+
- stage: Build
20+
jobs:
21+
- job:
22+
steps:
23+
- script: echo '##vso[task.setvariable variable=_version]${{ variables.releaseVersion }}-rc
24+
- template: bf-cli-build-test-steps.yml

build/botframework-cli-version.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
variables:
2+
releaseVersion: '4.10.0'

0 commit comments

Comments
 (0)