Skip to content

Commit

Permalink
Work CD-CI
Browse files Browse the repository at this point in the history
- ZIP files are now added to artifacts.
- GitHub release is now created on build from master.
- Drop preview from version.
- Bump release version to 1.4.2.
  • Loading branch information
josesimoes committed Jun 8, 2020
1 parent 216add0 commit ca47777
Show file tree
Hide file tree
Showing 8 changed files with 77 additions and 32 deletions.
4 changes: 2 additions & 2 deletions azure-pipelines-templates/build-chibios-stm32.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ steps:

- task: CMake@1
inputs:
cmakeArgs: '-G Ninja -DCMAKE_TOOLCHAIN_FILE=CMake/toolchain.arm-none-eabi.cmake -DTOOLCHAIN_PREFIX=$(GNU_GCC_TOOLCHAIN_PATH) -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_VERSION=$(NBGV_Version).$(NBGV_VersionHeight) -DCHIBIOS_BOARD=$(BoardName) $(BuildOptions) -DTOOL_HEX2DFU_PREFIX=$(HEX2DFU_PATH) ..'
cmakeArgs: '-G Ninja -DCMAKE_TOOLCHAIN_FILE=CMake/toolchain.arm-none-eabi.cmake -DTOOLCHAIN_PREFIX=$(GNU_GCC_TOOLCHAIN_PATH) -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_VERSION=$(NBGV_Version) -DCHIBIOS_BOARD=$(BoardName) $(BuildOptions) -DTOOL_HEX2DFU_PREFIX=$(HEX2DFU_PATH) ..'
workingDirectory: ${{ parameters.buildDirectory }}
displayName: Setup build with CMake and DFU
condition: eq(variables['NeedsDFU'], true)

- task: CMake@1
inputs:
cmakeArgs: '-G Ninja -DCMAKE_TOOLCHAIN_FILE=CMake/toolchain.arm-none-eabi.cmake -DTOOLCHAIN_PREFIX=$(GNU_GCC_TOOLCHAIN_PATH) -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_VERSION=$(NBGV_Version).$(NBGV_VersionHeight) -DCHIBIOS_BOARD=$(BoardName) $(BuildOptions) ..'
cmakeArgs: '-G Ninja -DCMAKE_TOOLCHAIN_FILE=CMake/toolchain.arm-none-eabi.cmake -DTOOLCHAIN_PREFIX=$(GNU_GCC_TOOLCHAIN_PATH) -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_VERSION=$(NBGV_Version) -DCHIBIOS_BOARD=$(BoardName) $(BuildOptions) ..'
workingDirectory: ${{ parameters.buildDirectory }}
displayName: Setup build with CMake without DFU
condition: eq(variables['NeedsDFU'], false)
Expand Down
2 changes: 1 addition & 1 deletion azure-pipelines-templates/build-esp32.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ parameters:
steps:
- task: CMake@1
inputs:
cmakeArgs: '-G Ninja -DCMAKE_TOOLCHAIN_FILE=CMake/toolchain.xtensa-esp32-elf.cmake -DTOOLCHAIN_PREFIX=$(ESP32_TOOLCHAIN_PATH) -DESP32_IDF_PATH=$(ESP32_IDF_PATH) -DESP32_LIBS_PATH=$(ESP32_LIBS_PATH) -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_VERSION=$(NBGV_Version).$(NBGV_VersionHeight) -DESP32_BOARD=$(BoardName) $(BuildOptions) ..'
cmakeArgs: '-G Ninja -DCMAKE_TOOLCHAIN_FILE=CMake/toolchain.xtensa-esp32-elf.cmake -DTOOLCHAIN_PREFIX=$(ESP32_TOOLCHAIN_PATH) -DESP32_IDF_PATH=$(ESP32_IDF_PATH) -DESP32_LIBS_PATH=$(ESP32_LIBS_PATH) -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_VERSION=$(NBGV_Version) -DESP32_BOARD=$(BoardName) $(BuildOptions) ..'
workingDirectory: ${{ parameters.buildDirectory }}
displayName: Setup build with CMake

Expand Down
2 changes: 1 addition & 1 deletion azure-pipelines-templates/build-freertos-nxp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ steps:

- task: CMake@1
inputs:
cmakeArgs: '-G Ninja -DCMAKE_TOOLCHAIN_FILE=CMake/toolchain.arm-none-eabi.cmake -DTOOLCHAIN_PREFIX=$(GNU_GCC_TOOLCHAIN_PATH) -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_VERSION=$(NBGV_Version).$(NBGV_VersionHeight) -DFREERTOS_BOARD=$(BoardName) $(BuildOptions) -DTOOL_SRECORD_PREFIX=$(SRECORD_PATH)/srecord/ ..'
cmakeArgs: '-G Ninja -DCMAKE_TOOLCHAIN_FILE=CMake/toolchain.arm-none-eabi.cmake -DTOOLCHAIN_PREFIX=$(GNU_GCC_TOOLCHAIN_PATH) -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_VERSION=$(NBGV_Version) -DFREERTOS_BOARD=$(BoardName) $(BuildOptions) -DTOOL_SRECORD_PREFIX=$(SRECORD_PATH)/srecord/ ..'
workingDirectory: ${{ parameters.buildDirectory }}
displayName: Setup build with CMake

Expand Down
2 changes: 1 addition & 1 deletion azure-pipelines-templates/build-ti-simplelink.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ steps:

- task: CMake@1
inputs:
cmakeArgs: '-G Ninja -DCMAKE_TOOLCHAIN_FILE=CMake/toolchain.arm-none-eabi.cmake -DTOOLCHAIN_PREFIX=$(GNU_GCC_TOOLCHAIN_PATH) -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_VERSION=$(NBGV_Version).$(NBGV_VersionHeight) -DTI_BOARD=$(BoardName) $(BuildOptions) ..'
cmakeArgs: '-G Ninja -DCMAKE_TOOLCHAIN_FILE=CMake/toolchain.arm-none-eabi.cmake -DTOOLCHAIN_PREFIX=$(GNU_GCC_TOOLCHAIN_PATH) -DCMAKE_BUILD_TYPE=MinSizeRel -DBUILD_VERSION=$(NBGV_Version) -DTI_BOARD=$(BoardName) $(BuildOptions) ..'
workingDirectory: ${{ parameters.buildDirectory }}
displayName: Setup build with CMake

Expand Down
8 changes: 0 additions & 8 deletions azure-pipelines-templates/pack-publish-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,3 @@ steps:
flattenFolders: true
condition: and( succeeded(), ne(variables['Build.Reason'], 'PullRequest') )
displayName: Collecting deployable artifacts

- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)\$(BoardName)'
ArtifactName: $(BoardName)
ArtifactType: Container
condition: and( succeeded(), ne(variables['Build.Reason'], 'PullRequest') )
displayName: Publish deployables artifacts
54 changes: 50 additions & 4 deletions azure-pipelines-templates/publish-bintray.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,53 @@ steps:
rootFolderOrFile: '$(Build.ArtifactStagingDirectory)\$(BoardName)'
includeRootFolder: false
archiveType: 'zip'
archiveFile: '$(Agent.TempDirectory)\$(BoardName)-$(NBGV_SimpleVersion)$(NBGV_PrereleaseVersion).zip'
archiveFile: '$(Agent.TempDirectory)\$(BoardName)-$(NBGV_AssemblyVersion).zip'
replaceExistingArchive: true
# skip task on PR build and when on branch other than master or nf community targets
# execute on 'ForceUpload' parameter
condition: or( eq(variables['ForceUpload'], true), and( succeeded(), ne(variables['Build.Reason'], 'PullRequest'), or( eq(variables['Build.SourceBranchName'], 'master'), eq(variables['Build.Repository_Name'], 'nf-Community-Targets')) ) )
displayName: Zip binary files

- task: CopyFiles@1
inputs:
sourceFolder: $(Agent.TempDirectory)
Contents: |
'$(Agent.TempDirectory)\$(BoardName)-$(NBGV_AssemblyVersion).zip'
TargetFolder: '$(Build.ArtifactStagingDirectory)\$(BoardName)'
flattenFolders: true
condition: or( eq(variables['ForceUpload'], true), and( succeeded(), ne(variables['Build.Reason'], 'PullRequest'), or( eq(variables['Build.SourceBranchName'], 'master'), eq(variables['Build.Repository_Name'], 'nf-Community-Targets')) ) )
displayName: Collecting deployable artifacts

- task: ArchiveFiles@2
inputs:
rootFolderOrFile: '$(Build.ArtifactStagingDirectory)\$(BoardName)'
includeRootFolder: false
archiveType: 'zip'
archiveFile: '$(Agent.TempDirectory)\$(BoardName)-$(NBGV_AssemblyVersion)-preview.zip'
replaceExistingArchive: true
# skip task on PR build and when on branch other than develop, master or release
# execute on 'ForceUpload' parameter
condition: or( eq(variables['ForceUpload'], true), and( succeeded(), ne(variables['Build.Reason'], 'PullRequest'), or( eq(variables['Build.SourceBranchName'], 'develop'), eq(variables['Build.SourceBranchName'], 'master'), contains(variables['Build.SourceBranchName'], 'release') ) ) )
condition: or( eq(variables['ForceUpload'], true), and( succeeded(), ne(variables['Build.Reason'], 'PullRequest'), or( contains(variables['Build.SourceBranchName'], 'develop'), contains(variables['Build.SourceBranchName'], 'release') ) ) )
displayName: Zip binary files

- task: CopyFiles@1
inputs:
sourceFolder: $(Agent.TempDirectory)
Contents: |
'$(Agent.TempDirectory)\$(BoardName)-$(NBGV_AssemblyVersion)-preview.zip'
TargetFolder: '$(Build.ArtifactStagingDirectory)\$(BoardName)'
flattenFolders: true
condition: or( eq(variables['ForceUpload'], true), and( succeeded(), ne(variables['Build.Reason'], 'PullRequest'), or( contains(variables['Build.SourceBranchName'], 'develop'), contains(variables['Build.SourceBranchName'], 'release') ) ) )
displayName: Collecting deployable artifacts

- task: PublishBuildArtifacts@1
inputs:
PathtoPublish: '$(Build.ArtifactStagingDirectory)\$(BoardName)'
ArtifactName: $(BoardName)
ArtifactType: Container
condition: and( succeeded(), ne(variables['Build.Reason'], 'PullRequest') )
displayName: Publish deployables artifacts

- task: PowerShell@2
inputs:
targetType: 'inline'
Expand All @@ -32,6 +72,8 @@ steps:
{
# this is a build for a community target
Write-Host "$("##vso[task.setvariable variable=BINTRAY_REPO]")nanoframework-images-community-targets"
# set package name
Write-Host "$("##vso[task.setvariable variable=PACKAGE_NAME]")$(BoardName)-$(NBGV_AssemblyVersion)"
}
else
{
Expand All @@ -40,11 +82,15 @@ steps:
{
# this a dev or release branch, publish to Bintray dev repo
Write-Host "$("##vso[task.setvariable variable=BINTRAY_REPO]")nanoframework-images-dev"
# set package name
Write-Host "$("##vso[task.setvariable variable=PACKAGE_NAME]")$(BoardName)-$(NBGV_AssemblyVersion)-preview"
}
else
{
# this master branch, publish to Bintray stable repo
Write-Host "$("##vso[task.setvariable variable=BINTRAY_REPO]")nanoframework-images"
# set package name
Write-Host "$("##vso[task.setvariable variable=PACKAGE_NAME]")$(BoardName)-$(NBGV_AssemblyVersion)"
}
}
errorActionPreference: 'stop'
Expand All @@ -55,12 +101,12 @@ steps:

- task: cURLUploader@2
inputs:
files: '$(Agent.TempDirectory)\$(BoardName)-$(NBGV_SimpleVersion)$(NBGV_PrereleaseVersion).zip'
files: '$(Agent.TempDirectory)\$(PACKAGE_NAME).zip'
authType: 'userAndPass'
username: 'nfbot'
password: '$(BinTrayKey)'
url: 'https://api.bintray.com/'
remotePath: 'content/nfbot/$(BINTRAY_REPO)/$(BoardName)/$(NBGV_SimpleVersion)$(NBGV_PrereleaseVersion)/$(BoardName)-$(NBGV_SimpleVersion)$(NBGV_PrereleaseVersion).zip;publish=1'
remotePath: 'content/nfbot/$(BINTRAY_REPO)/$(BoardName)/$(NBGV_AssemblyVersion)/$(PACKAGE_NAME).zip;publish=1'
# execute on 'ForceUpload' parameter
condition: or( eq(variables['ForceUpload'], true), and( succeeded(), ne(variables['Build.Reason'], 'PullRequest'), or( eq(variables['Build.SourceBranchName'], 'develop'), eq(variables['Build.SourceBranchName'], 'master'), contains(variables['Build.SourceBranchName'], 'release') ) ) )
displayName: Upload artifact to Bintray
35 changes: 21 additions & 14 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -365,15 +365,9 @@ jobs:
condition: succeeded()
displayName: Install NBGV tool

- task: PowerShell@2
inputs:
targetType: 'inline'
script: nbgv cloud -a -c
errorActionPreference: 'silentlyContinue'
failOnStderr: 'false'
- script: nbgv cloud -a -c
condition: succeeded()
displayName: Set build number
# condition: ne(variables['system.pullrequest.isfork'], true)

- task: UseRubyVersion@0
inputs:
Expand All @@ -385,7 +379,7 @@ jobs:
- powershell: |
gem install github_changelog_generator --quiet --no-document
# need to call it passing both cache options with full path otherwise it won't work
github_changelog_generator --token $(GitHubToken) --cache-log $env:AGENT_TEMPDIRECTORY\github-changelog-logger.log --cache-file $env:AGENT_TEMPDIRECTORY\github-changelog-http-cache --pr-wo-labels --future-release "v$(NBGV_Version)"
github_changelog_generator --token $(GitHubToken) --cache-log $env:AGENT_TEMPDIRECTORY\github-changelog-logger.log --cache-file $env:AGENT_TEMPDIRECTORY\github-changelog-http-cache --pr-wo-labels --future-release "v$env:NBGV_AssemblyVersion"
condition: and( succeeded(), not( startsWith(variables['Build.SourceBranch'], 'refs/pull') ), or( eq(variables['Build.SourceBranchName'], 'master'), startsWith(variables['Build.SourceBranch'], 'refs/tags/v') ) )
displayName: Generate change log
Expand Down Expand Up @@ -416,7 +410,7 @@ jobs:
displayName: Push changelog to GitHub
#######################
# create or update GitHub release ON tags from release or master branches
# create or update GitHub release ON tags from master branche or tags
- job: Publish_Release
dependsOn:
- Build_STM32_targets
Expand All @@ -425,27 +419,40 @@ jobs:
- Build_TI_SimpleLink_targets
- Build_WIN32_nanoCLR
- Generate_change_log
# skip build if this is a PR, submitted by nfbot and the commit message contains [version update]
condition: and( succeeded('Build_STM32_targets'), succeeded('Build_ESP32_targets'), succeeded('Build_NXP_targets'), succeeded('Build_TI_SimpleLink_targets'), not( eq(variables['Build.Reason'], 'PullRequest') ), or( endsWith(variables['Build.SourceBranchName'], 'master'), startsWith(variables['Build.SourceBranch'], 'refs/tags/v') ), ne( variables['StartReleaseCandidate'], true ) )

pool:
vmImage: 'VS2017-Win2016'

steps:
- task: DotNetCoreCLI@2
inputs:
command: custom
custom: tool
arguments: install --tool-path . nbgv
displayName: Install NBGV tool

- script: nbgv cloud -a -c
displayName: Set build number

- task: GitHubReleasePublish@1
inputs:
githubEndpoint: 'nanoframework'
githubOwner: 'nanoframework'
githubRepositoryName: nf-interpreter
githubTag: v$(NBGV_Version)
githubReleaseTitle: 'nf Interpreter v$(NBGV_Version)'
githubTag: v$(NBGV_AssemblyVersion)
githubReleaseTitle: 'nf Interpreter v$(NBGV_AssemblyVersion)'
githubReleaseNotes: ''
githubTargetCommitsh: $(Build.SourceVersion)
githubReleaseDraft: false
githubReleasePrerelease: false
githubReleasePrerelease: true
githubReuseDraftOnly: false
githubReuseRelease: true
githubEditRelease: false
githubDeleteEmptyTag: true
githubReleaseAsset:
condition: and( succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v'), not(contains(variables['Build.SourceBranch'], 'preview') ), ne( variables['StartReleaseCandidate'], true ) )
githubReleaseAsset: '$(Build.ArtifactStagingDirectory)/**.zip'
condition: endsWith(variables['Build.SourceBranch'], 'master')
displayName: Create/Update GitHub stable release

##################################
Expand Down
2 changes: 1 addition & 1 deletion version.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
"version": "1.4",
"version": "1.4.2",
"assemblyVersion": {
"precision": "revision"
},
Expand Down

0 comments on commit ca47777

Please sign in to comment.