major rc changes ctzsnooze 2021
[betaflight.git] / azure-pipelines.yml
blob6f542639f31746fd0c3668aed72158feaac414a0
1 # Builds the Betaflight firmware
3 # After building, artifacts are released to a seperate repository.
5 # Azure Pipelines requires the following extensions to be installed:
6 # - GitHub Tool: https://marketplace.visualstudio.com/items?itemName=marcelo-formentao.github-tools
8 # You'll also need to setup the follwing pipeline variables: 
9 #     "releaseNotes" - This is used to add the release notes in the windows job in the build stage so they can be published as part of the github release in the release stage
10 #     "endpoint" - The name of the github endpoint link setup in AzDo - setup when linking AzDo and GitHub
11 #     "owner" - The owner of the repository to release to e.g. betaflight
12 #     "repoName" - The name of the repository to release to e.g. betaflight-configurator-nightly
15 variables:
16   owner: betaflight
17   repoName: betaflight-pull-requests
18   releaseNotes: This is a build of a community provided pull request. It may be unstable and result in corrupted configurations or data loss. **Use only for testing.**
20 name: $(Build.RequestedFor)_$(Build.SourceBranchName)_$(BuildID)
22 # For some reason the trigger does not pick up on "*-maintenance" - manually adding the current maintenance branch for now
23 trigger:
24   batch: true
25   branches:
26     include:
27     - master
28     - 4.2-maintenance
29     - "*-maintenance"
31 pr:
32   drafts: false
33   branches:
34     include:
35     - master
36     - 4.2-maintenance
37     - "*-maintenance"
39 stages:
40 - stage: Build
41   jobs:
42   - job: 'Linux'
43     pool:
44       vmImage: 'ubuntu-16.04'
45     steps:
46     - script: make arm_sdk_install
47       displayName: 'Install the build toolchain'
48     - script: sudo apt-get install -y libblocksruntime-dev
49       displayName: 'Install extra packages'
50     - script: make  EXTRA_FLAGS=-Werror checks
51       displayName: 'Run sanity checks'
52     - script: make  EXTRA_FLAGS=-Werror test-all
53       displayName: 'Run all unit tests'
54     - script: make  EXTRA_FLAGS=-Werror all
55       displayName: 'Build all official targets'
56     - script: mkdir release; cp obj/*.hex release/
57       displayName: 'Copy artifacts'
58     - task: PublishPipelineArtifact@1
59       displayName: 'Publish Linux release'
60       inputs: 
61         artifactName: betaflight
62         targetPath: '$(System.DefaultWorkingDirectory)/release/'
64 - stage: Release
65   jobs:
66   - job: Release
68     steps:
69     - task: DownloadPipelineArtifact@2
70       inputs:
71         buildType: 'current'
72         targetPath: '$(Pipeline.Workspace)'
73     - powershell: Write-Output ("##vso[task.setvariable variable=today;]$(Get-Date -Format yyyyMMdd)")
74     - task: GitHubReleasePublish@1
75       inputs:
76         githubEndpoint: '$(endpoint)'
77         manuallySetRepository: true
78         githubOwner: '$(owner)'
79         githubRepositoryName: '$(repoName)'
80         githubTag: $(today).$(Build.Repository.Name).$(Build.SourceBranchName)
81         githubReleaseTitle: '$(Build.Repository.Name): $(Build.SourceBranchName) ($(today))'
82         githubReleaseNotes: |+
83           $(releaseNotes)
85           ### Repository:
86           $(Build.Repository.Name) ([link]($(Build.Repository.Uri)))
88           ### Pull request branch:
89           $(Build.SourceBranchName) ([link]($(Build.Repository.Uri)/tree/$(Build.SourceBranchName)))
91           ### Author:
92           $(Build.RequestedFor)
94           ### Latest changeset:
95           $(Build.SourceVersion) ([link]($(Build.Repository.Uri)/commit/$(Build.SourceVersion)))
97           ### Changes:
98           $(Build.SourceVersionMessage)
100           ### Debug:
101           Build.SourceBranchName
102           $(Build.SourceBranchName)
103           Build.Repository.Name
104           $(Build.Repository.Name)
105           Build.Repository.ID
106           $(Build.Repository.ID)
107           Build.Repository.Uri
108           $(Build.Repository.Uri)
109           Build.RequestedFor
110           $(Build.RequestedFor)
111           Build.QueuedBy
112           $(Build.QueuedBy)
113         githubReleaseDraft: false
114         githubReleasePrerelease: false
115         githubIgnoreAssets: false
116         githubReleaseAsset: |
117           $(Pipeline.Workspace)/betaflight/**
118         githubReuseRelease: true
119         githubReuseDraftOnly: false
120         githubSkipDuplicatedAssets: false
121         githubEditRelease: true
122         githubDeleteEmptyTag: false