Skip to content

Commit 9ca197e

Browse files
Use stages in Azure Pipelines
1 parent 10f11c2 commit 9ca197e

File tree

1 file changed

+155
-148
lines changed

1 file changed

+155
-148
lines changed

.azure.yml

Lines changed: 155 additions & 148 deletions
Original file line numberDiff line numberDiff line change
@@ -1,154 +1,161 @@
1-
jobs:
2-
3-
######################
4-
###### Linux #########
5-
######################
6-
7-
- job: Linux
8-
timeoutInMinutes: 120
9-
pool:
10-
vmImage: 'ubuntu-16.04'
11-
strategy:
12-
matrix:
13-
AMD64 (x64):
14-
dockerTag: 'amd64'
15-
dockerName: 'Debian Stretch (AMD64)'
16-
platform: 'x11'
17-
i386 (x86):
18-
dockerTag: 'i386'
19-
dockerName: 'Debian Stretch (i386)'
20-
platform: 'x11'
21-
ARMv6hf (Raspberry Pi v1 & ZERO):
22-
dockerTag: 'armv6hf'
23-
dockerName: 'Debian Stretch (Raspberry Pi v1 & ZERO)'
24-
platform: 'rpi'
25-
ARMv7hf (Raspberry Pi 2 & 3):
26-
dockerTag: 'armv7hf'
27-
dockerName: 'Debian Stretch (Raspberry Pi 2 & 3)'
28-
platform: 'rpi'
29-
ARMv8 (Generic AARCH64):
30-
dockerTag: 'aarch64'
31-
dockerName: 'ARMv8 (Generic AARCH64)'
32-
platform: 'amlogic'
33-
34-
steps:
35-
- checkout: self # represents the repo where the initial Pipelines YAML file was found
36-
submodules: recursive # set to 'recursive' to get submodules of submodules
37-
38-
# build process
39-
- bash: ./.ci/ci_build.sh
40-
displayName: 'Build $(dockerName) packages'
41-
env:
42-
DOCKER_TAG: $(dockerTag)
43-
DOCKER_NAME: $(dockerName)
44-
PLATFORM: $(platform)
45-
46-
# move files
47-
- bash: 'mv -v deploy/Hyperion-* $(Build.ArtifactStagingDirectory) 2>/dev/null || :'
48-
workingDirectory: $(Build.SourcesDirectory)
49-
condition: and(succeeded(), ne(variables['system.pullrequest.isfork'], true), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
50-
displayName: 'Collect artifacts'
51-
52-
# publish artifacts
53-
- task: PublishBuildArtifacts@1
54-
inputs:
55-
pathtoPublish: $(Build.ArtifactStagingDirectory)
56-
ArtifactName: $(dockerTag)
57-
condition: and(succeeded(), ne(variables['system.pullrequest.isfork'], true), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
58-
displayName: 'Publish artifacts'
59-
60-
######################
61-
###### macOS #########
62-
######################
63-
64-
- job: macOS
65-
timeoutInMinutes: 120
66-
pool:
67-
vmImage: 'macOS-10.14'
68-
69-
steps:
70-
- checkout: self # represents the repo where the initial Pipelines YAML file was found
71-
submodules: recursive # set to 'recursive' to get submodules of submodules
72-
73-
# install dependencies
74-
- bash: ./.ci/ci_install.sh
75-
displayName: 'Install dependencies'
76-
77-
# build process
78-
- bash: ./.ci/ci_build.sh
79-
env:
80-
PLATFORM: 'osx'
81-
condition: succeeded()
82-
displayName: 'Build macOS 10.13 packages'
83-
84-
# move files
85-
- bash: 'mv -v build/Hyperion-* $(Build.ArtifactStagingDirectory) 2>/dev/null || :'
86-
workingDirectory: $(Build.SourcesDirectory)
87-
condition: and(succeeded(), ne(variables['system.pullrequest.isfork'], true), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
88-
displayName: 'Collect artifacts'
89-
90-
# publish artifacts
91-
- task: PublishBuildArtifacts@1
92-
inputs:
93-
pathtoPublish: $(Build.ArtifactStagingDirectory)
94-
ArtifactName: 'macos'
95-
condition: and(succeeded(), ne(variables['system.pullrequest.isfork'], true), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
96-
displayName: 'Publish artifacts'
1+
stages:
2+
- stage: Build
3+
displayName: Build packages
4+
5+
jobs:
6+
7+
######################
8+
###### Linux #########
9+
######################
10+
11+
- job: Linux
12+
timeoutInMinutes: 120
13+
pool:
14+
vmImage: 'ubuntu-16.04'
15+
strategy:
16+
matrix:
17+
AMD64 (x64):
18+
dockerTag: 'amd64'
19+
dockerName: 'Debian Stretch (AMD64)'
20+
platform: 'x11'
21+
i386 (x86):
22+
dockerTag: 'i386'
23+
dockerName: 'Debian Stretch (i386)'
24+
platform: 'x11'
25+
ARMv6hf (Raspberry Pi v1 & ZERO):
26+
dockerTag: 'armv6hf'
27+
dockerName: 'Debian Stretch (Raspberry Pi v1 & ZERO)'
28+
platform: 'rpi'
29+
ARMv7hf (Raspberry Pi 2 & 3):
30+
dockerTag: 'armv7hf'
31+
dockerName: 'Debian Stretch (Raspberry Pi 2 & 3)'
32+
platform: 'rpi'
33+
ARMv8 (Generic AARCH64):
34+
dockerTag: 'aarch64'
35+
dockerName: 'ARMv8 (Generic AARCH64)'
36+
platform: 'amlogic'
37+
38+
steps:
39+
- checkout: self # represents the repo where the initial Pipelines YAML file was found
40+
submodules: recursive # set to 'recursive' to get submodules of submodules
41+
42+
# build process
43+
- bash: ./.ci/ci_build.sh
44+
displayName: 'Build $(dockerName) packages'
45+
env:
46+
DOCKER_TAG: $(dockerTag)
47+
DOCKER_NAME: $(dockerName)
48+
PLATFORM: $(platform)
49+
50+
# move files
51+
- bash: 'mv -v deploy/Hyperion-* $(Build.ArtifactStagingDirectory) 2>/dev/null || :'
52+
workingDirectory: $(Build.SourcesDirectory)
53+
condition: and(succeeded(), ne(variables['system.pullrequest.isfork'], true), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
54+
displayName: 'Collect artifacts'
55+
56+
# publish artifacts
57+
- task: PublishBuildArtifacts@1
58+
inputs:
59+
pathtoPublish: $(Build.ArtifactStagingDirectory)
60+
ArtifactName: $(dockerTag)
61+
condition: and(succeeded(), ne(variables['system.pullrequest.isfork'], true), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
62+
displayName: 'Publish artifacts'
63+
64+
######################
65+
###### macOS #########
66+
######################
67+
68+
- job: macOS
69+
timeoutInMinutes: 120
70+
pool:
71+
vmImage: 'macOS-10.14'
72+
73+
steps:
74+
- checkout: self # represents the repo where the initial Pipelines YAML file was found
75+
submodules: recursive # set to 'recursive' to get submodules of submodules
76+
77+
# install dependencies
78+
- bash: ./.ci/ci_install.sh
79+
displayName: 'Install dependencies'
80+
81+
# build process
82+
- bash: ./.ci/ci_build.sh
83+
env:
84+
PLATFORM: 'osx'
85+
condition: succeeded()
86+
displayName: 'Build macOS 10.13 packages'
87+
88+
# move files
89+
- bash: 'mv -v build/Hyperion-* $(Build.ArtifactStagingDirectory) 2>/dev/null || :'
90+
workingDirectory: $(Build.SourcesDirectory)
91+
condition: and(succeeded(), ne(variables['system.pullrequest.isfork'], true), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
92+
displayName: 'Collect artifacts'
93+
94+
# publish artifacts
95+
- task: PublishBuildArtifacts@1
96+
inputs:
97+
pathtoPublish: $(Build.ArtifactStagingDirectory)
98+
ArtifactName: 'macos'
99+
condition: and(succeeded(), ne(variables['system.pullrequest.isfork'], true), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
100+
displayName: 'Publish artifacts'
97101

98102
################################
99103
###### Publish Releases ########
100104
################################
101105

102-
- job: PublishReleases
103-
timeoutInMinutes: 120
106+
- stage: Publish
107+
displayName: Publish Releases
104108
dependsOn:
105-
- Linux
106-
- macOS
107-
condition: and(succeeded(), ne(variables['system.pullrequest.isfork'], true), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
108-
pool:
109-
vmImage: ubuntu-16.04
110-
111-
steps:
112-
- checkout: self # represents the repo where the initial Pipelines YAML file was found
113-
114-
# download deployables artifacts
115-
- task: DownloadPipelineArtifact@2
116-
inputs:
117-
path: $(Build.ArtifactStagingDirectory)
118-
displayName: Download artifacts
119-
120-
# read version file
121-
- bash: |
122-
echo "##vso[task.setvariable variable=semVer]$(cat version)"
123-
echo "##vso[task.setvariable variable=preRel]$(grep -oE 'alpha|beta' version)"
124-
workingDirectory: '$(Build.SourcesDirectory)'
125-
condition: succeeded()
126-
displayName: 'Read and generate pipeline variables'
127-
128-
# set release to pre-release
129-
- bash: echo '##vso[task.setvariable variable=preRelease;]true'
130-
condition: and(succeeded(), or(contains(variables['preRel'], 'alpha'), contains(variables['preRel'], 'beta')), ne(variables['system.pullrequest.isfork'], true), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
131-
displayName: 'Mark alpha or beta as pre-release'
132-
133-
# create github releases
134-
- task: GithubRelease@0
135-
inputs:
136-
gitHubConnection: Hyperion-Bot
137-
repositoryName: $(Build.Repository.Name)
138-
action: create
139-
target: $(Build.SourceVersion)
140-
tagSource: manual
141-
tag: $(Build.SourceBranchName)
142-
title: 'Hyperion $(semVer)'
143-
assets: |
144-
$(Build.ArtifactStagingDirectory)/amd64/*
145-
$(Build.ArtifactStagingDirectory)/i386/*
146-
$(Build.ArtifactStagingDirectory)/armv6hf/*
147-
$(Build.ArtifactStagingDirectory)/armv7hf/*
148-
$(Build.ArtifactStagingDirectory)/aarch64/*
149-
$(Build.ArtifactStagingDirectory)/macos/*
150-
assetUploadMode: 'replace'
151-
addChangeLog: false
152-
isPreRelease: $(preRelease)
153-
condition: succeeded()
154-
displayName: Create GitHub releases
109+
- Build
110+
condition: and(succeeded('Build'), ne(variables['system.pullrequest.isfork'], true), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
111+
112+
jobs:
113+
- job: PublishReleases
114+
timeoutInMinutes: 120
115+
pool:
116+
vmImage: ubuntu-16.04
117+
118+
steps:
119+
- checkout: self # represents the repo where the initial Pipelines YAML file was found
120+
121+
# download deployables artifacts
122+
- task: DownloadPipelineArtifact@2
123+
inputs:
124+
path: $(Build.ArtifactStagingDirectory)
125+
displayName: Download artifacts
126+
127+
# read version file
128+
- bash: |
129+
echo "##vso[task.setvariable variable=semVer]$(cat version)"
130+
echo "##vso[task.setvariable variable=preRel]$(grep -oE 'alpha|beta' version)"
131+
workingDirectory: '$(Build.SourcesDirectory)'
132+
condition: succeeded()
133+
displayName: 'Read and generate pipeline variables'
134+
135+
# set release to pre-release
136+
- bash: echo '##vso[task.setvariable variable=preRelease;]true'
137+
condition: and(succeeded(), or(contains(variables['preRel'], 'alpha'), contains(variables['preRel'], 'beta')), ne(variables['system.pullrequest.isfork'], true), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))
138+
displayName: 'Mark alpha or beta as pre-release'
139+
140+
# create github releases
141+
- task: GithubRelease@0
142+
inputs:
143+
gitHubConnection: Hyperion-Bot
144+
repositoryName: $(Build.Repository.Name)
145+
action: create
146+
target: $(Build.SourceVersion)
147+
tagSource: manual
148+
tag: $(Build.SourceBranchName)
149+
title: 'Hyperion $(semVer)'
150+
assets: |
151+
$(Build.ArtifactStagingDirectory)/amd64/*
152+
$(Build.ArtifactStagingDirectory)/i386/*
153+
$(Build.ArtifactStagingDirectory)/armv6hf/*
154+
$(Build.ArtifactStagingDirectory)/armv7hf/*
155+
$(Build.ArtifactStagingDirectory)/aarch64/*
156+
$(Build.ArtifactStagingDirectory)/macos/*
157+
assetUploadMode: 'replace'
158+
addChangeLog: false
159+
isPreRelease: $(preRelease)
160+
condition: succeeded()
161+
displayName: Create GitHub releases

0 commit comments

Comments
 (0)