Fix Azure pipelines
[betaflight.git] / azure-pipelines.yml
blob1d1738bcb8a6a132503dd0161541a4834929ca3a
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.**
19   vmImage: 'ubuntu-20.04'
21 name: $(Build.RequestedFor)_$(Build.SourceBranchName)_$(BuildID)
23 # For some reason the trigger does not pick up on "*-maintenance" - manually adding the current maintenance branch for now
24 trigger:
25   batch: true
26   branches:
27     include:
28     - master
29     - 4.2-maintenance
30     - "*-maintenance"
32 pr:
33   drafts: false
34   branches:
35     include:
36     - master
37     - 4.2-maintenance
38     - "*-maintenance"
40 stages:
41 - stage: Build
42   jobs:
43   - job: 'Linux'
44     pool:
45       vmImage: '$(vmImage)'
46     steps:
47     - script: make arm_sdk_install
48       displayName: 'Install the build toolchain'
49     - script: sudo apt-get install -y libblocksruntime-dev
50       displayName: 'Install extra packages'
51     - script: make  EXTRA_FLAGS=-Werror checks
52       displayName: 'Run sanity checks'
53     - script: make  EXTRA_FLAGS=-Werror test-all
54       displayName: 'Run all unit tests'
55     - script: make  EXTRA_FLAGS=-Werror all
56       displayName: 'Build all official targets'
57     - script: mkdir release; cp obj/*.hex release/
58       displayName: 'Copy artifacts'
59     - task: PublishPipelineArtifact@1
60       displayName: 'Publish Linux release'
61       inputs: 
62         artifactName: betaflight
63         targetPath: '$(System.DefaultWorkingDirectory)/release/'
65 - stage: Release
66   jobs:
67   - job: Release
68     pool:
69       vmImage: '$(vmImage)'
70     steps:
71     - task: DownloadPipelineArtifact@2
72       inputs:
73         buildType: 'current'
74         targetPath: '$(Pipeline.Workspace)'
75     - powershell: Write-Output ("##vso[task.setvariable variable=today;]$(Get-Date -Format yyyyMMdd)")
76     - task: GitHubReleasePublish@1
77       inputs:
78         githubEndpoint: '$(endpoint)'
79         manuallySetRepository: true
80         githubOwner: '$(owner)'
81         githubRepositoryName: '$(repoName)'
82         githubTag: $(today).$(Build.Repository.Name).$(Build.SourceBranchName)
83         githubReleaseTitle: '$(Build.Repository.Name): $(Build.SourceBranchName) ($(today))'
84         githubReleaseNotes: |+
85           $(releaseNotes)
87           ### Repository:
88           $(Build.Repository.Name) ([link]($(Build.Repository.Uri)))
90           ### Pull request branch:
91           $(Build.SourceBranchName) ([link]($(Build.Repository.Uri)/tree/$(Build.SourceBranchName)))
93           ### Author:
94           $(Build.RequestedFor)
96           ### Latest changeset:
97           $(Build.SourceVersion) ([link]($(Build.Repository.Uri)/commit/$(Build.SourceVersion)))
99           ### Changes:
100           $(Build.SourceVersionMessage)
102           ### Debug:
103           Build.SourceBranchName
104           $(Build.SourceBranchName)
105           Build.Repository.Name
106           $(Build.Repository.Name)
107           Build.Repository.ID
108           $(Build.Repository.ID)
109           Build.Repository.Uri
110           $(Build.Repository.Uri)
111           Build.RequestedFor
112           $(Build.RequestedFor)
113           Build.QueuedBy
114           $(Build.QueuedBy)
115         githubReleaseDraft: false
116         githubReleasePrerelease: false
117         githubIgnoreAssets: false
118         githubReleaseAsset: |
119           $(Pipeline.Workspace)/betaflight/**
120         githubReuseRelease: true
121         githubReuseDraftOnly: false
122         githubSkipDuplicatedAssets: false
123         githubEditRelease: true
124         githubDeleteEmptyTag: false