Skip to content

Commit 4bef513

Browse files
committed
Work CD-CI
- Move Discord webhook call to separate job. Signed-off-by: José Simões <[email protected]>
1 parent 4edf74b commit 4bef513

File tree

1 file changed

+130
-113
lines changed

1 file changed

+130
-113
lines changed

azure-pipelines.yml

Lines changed: 130 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -13,116 +13,133 @@ resources:
1313
name: nanoframework/nf-tools
1414
endpoint: nfbot
1515

16-
pool:
17-
vmImage: 'VS2017-Win2016'
18-
19-
variables:
20-
solution: '**/source/*.sln'
21-
buildPlatform: 'Any CPU'
22-
buildConfiguration: 'Release'
23-
nugetPackageName: 'nanoFramework.Networking.Sntp'
24-
25-
steps:
26-
27-
# need this here in order to persist GitHub credentials
28-
- checkout: self
29-
persistCredentials: true
30-
31-
- task: NuGetToolInstaller@0
32-
33-
- task: NuGetCommand@2
34-
inputs:
35-
restoreSolution: '$(solution)'
36-
feedsToUse: config
37-
nugetConfigPath: source/NuGet.config
38-
39-
- template: azure-pipelines-templates/nb-gitversioning-class-lib.yml@templates
40-
41-
- task: InstallnFBuildComponents@1
42-
displayName: Install nanoFramework MSBuild components
43-
44-
- task: VSBuild@1
45-
inputs:
46-
solution: '$(solution)'
47-
platform: '$(buildPlatform)'
48-
configuration: '$(buildConfiguration)'
49-
50-
# we don't have tests (yet)
51-
# - task: VSTest@2
52-
# inputs:
53-
# platform: '$(buildPlatform)'
54-
# configuration: '$(buildConfiguration)'
55-
56-
- task: NuGetCommand@2
57-
inputs:
58-
command: 'custom'
59-
arguments: 'pack source\$(nugetPackageName).nuspec -Version 1.0.2-preview-020'
60-
displayName: Pack NuGet with class library
61-
62-
- task: CopyFiles@1
63-
inputs:
64-
sourceFolder: $(Build.SourcesDirectory)
65-
Contents: |
66-
**\$(nugetPackageName)*.nupkg
67-
TargetFolder: '$(Build.ArtifactStagingDirectory)'
68-
flattenFolders: true
69-
condition: and( succeeded(), ne(variables['Build.Reason'], 'PullRequest') )
70-
displayName: Collecting deployable artifacts
71-
72-
- task: PublishBuildArtifacts@1
73-
inputs:
74-
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
75-
ArtifactName: deployables
76-
ArtifactType: Container
77-
condition: and( succeeded(), ne(variables['Build.Reason'], 'PullRequest') )
78-
displayName: Publish deployables artifacts
79-
80-
# push NuGet packages to MyGet feed (always happens except on PR builds)
81-
- task: NuGetCommand@2
82-
inputs:
83-
command: push
84-
nuGetFeedType: external
85-
packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg'
86-
publishFeedCredentials: 'MyGet'
87-
condition: and( succeeded(), ne(variables['Build.Reason'], 'PullRequest') )
88-
displayName: Push NuGet packages to MyGet
89-
90-
# push NuGet packages to NuGet (happens on tag builds for any branch)
91-
- task: NuGetCommand@2
92-
inputs:
93-
command: push
94-
nuGetFeedType: external
95-
packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg'
96-
publishFeedCredentials: 'NuGet'
97-
condition: and( succeeded(), ne(variables['Build.Reason'], 'PullRequest'), contains(variables['Build.SourceBranchName'], 'tags') )
98-
displayName: Push NuGet packages to NuGet
99-
100-
- task: UseRubyVersion@0
101-
inputs:
102-
versionSpec: '>= 2.4'
103-
addToPath: true
104-
condition: and( succeeded(), ne(variables['Build.Reason'], 'PullRequest') )
105-
displayName: Setup Ruby
106-
107-
# generate change log including future version
108-
- script: |
109-
gem install github_changelog_generator
110-
bundle exec github_changelog_generator --token $(GitHubToken) --future-release "v$(NBGV_Version)"
111-
condition: and( in(variables['Agent.JobStatus'], 'Succeeded', 'SucceededWithIssues'), or( eq(variables['Build.SourceBranchName'], 'master'), contains(variables['Build.SourceBranchName'], 'release') ) )
112-
displayName: Generate change log
113-
114-
# generate change log including future version
115-
- script: |
116-
gem install github_changelog_generator
117-
bundle exec github_changelog_generator --token $(GitHubToken)
118-
condition: and( in(variables['Agent.JobStatus'], 'Succeeded', 'SucceededWithIssues'), not( or( eq(variables['Build.SourceBranchName'], 'master'), contains(variables['Build.SourceBranchName'], 'release') ) ) )
119-
displayName: Generate change log
120-
121-
# step from template @ nf-tools repo
122-
- template: azure-pipelines-templates/discord-webhook.yml@templates
123-
parameters:
124-
status: 'failure'
125-
webhookUrl: '$(DiscordWebhook)'
126-
message: ''
127-
condition: eq(variables['Agent.JobStatus'], 'Failed')
128-
displayName: report build failure to Discord
16+
jobs:
17+
18+
#######################
19+
- job: Build_Class_Lib
20+
pool:
21+
vmImage: 'VS2017-Win2016'
22+
23+
variables:
24+
solution: '**/source/*.sln'
25+
buildPlatform: 'Any CPU'
26+
buildConfiguration: 'Release'
27+
nugetPackageName: 'nanoFramework.Networking.Sntp'
28+
29+
steps:
30+
31+
# need this here in order to persist GitHub credentials
32+
- checkout: self
33+
persistCredentials: true
34+
35+
- task: NuGetToolInstaller@0
36+
37+
- task: NuGetCommand@2
38+
inputs:
39+
restoreSolution: '$(solution)'
40+
feedsToUse: config
41+
nugetConfigPath: source/NuGet.config
42+
43+
- template: azure-pipelines-templates/nb-gitversioning-class-lib.yml@templates
44+
45+
- task: InstallnFBuildComponents@1
46+
displayName: Install nanoFramework MSBuild components
47+
48+
- task: VSBuild@1
49+
inputs:
50+
solution: '$(solution)'
51+
platform: '$(buildPlatform)'
52+
configuration: '$(buildConfiguration)'
53+
54+
# we don't have tests (yet)
55+
# - task: VSTest@2
56+
# inputs:
57+
# platform: '$(buildPlatform)'
58+
# configuration: '$(buildConfiguration)'
59+
60+
- task: NuGetCommand@2
61+
inputs:
62+
command: 'custom'
63+
arguments: 'pack source\$(nugetPackageName).nuspec -Version 1.0.2-preview-020'
64+
displayName: Pack NuGet with class library
65+
66+
- task: CopyFiles@1
67+
inputs:
68+
sourceFolder: $(Build.SourcesDirectory)
69+
Contents: |
70+
**\$(nugetPackageName)*.nupkg
71+
TargetFolder: '$(Build.ArtifactStagingDirectory)'
72+
flattenFolders: true
73+
condition: and( succeeded(), ne(variables['Build.Reason'], 'PullRequest') )
74+
displayName: Collecting deployable artifacts
75+
76+
- task: PublishBuildArtifacts@1
77+
inputs:
78+
PathtoPublish: '$(Build.ArtifactStagingDirectory)'
79+
ArtifactName: deployables
80+
ArtifactType: Container
81+
condition: and( succeeded(), ne(variables['Build.Reason'], 'PullRequest') )
82+
displayName: Publish deployables artifacts
83+
84+
# push NuGet packages to MyGet feed (always happens except on PR builds)
85+
- task: NuGetCommand@2
86+
inputs:
87+
command: push
88+
nuGetFeedType: external
89+
packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg'
90+
publishFeedCredentials: 'MyGet'
91+
condition: and( succeeded(), ne(variables['Build.Reason'], 'PullRequest') )
92+
displayName: Push NuGet packages to MyGet
93+
94+
# push NuGet packages to NuGet (happens on tag builds for any branch)
95+
- task: NuGetCommand@2
96+
inputs:
97+
command: push
98+
nuGetFeedType: external
99+
packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg;!$(Build.ArtifactStagingDirectory)/**/*.symbols.nupkg'
100+
publishFeedCredentials: 'NuGet'
101+
condition: and( succeeded(), ne(variables['Build.Reason'], 'PullRequest'), contains(variables['Build.SourceBranchName'], 'tags') )
102+
displayName: Push NuGet packages to NuGet
103+
104+
- task: UseRubyVersion@0
105+
inputs:
106+
versionSpec: '>= 2.4'
107+
addToPath: true
108+
condition: and( succeeded(), ne(variables['Build.Reason'], 'PullRequest') )
109+
displayName: Setup Ruby
110+
111+
# generate change log including future version
112+
- script: |
113+
gem install github_changelog_generator
114+
bundle exec github_changelog_generator --token $(GitHubToken) --future-release "v$(NBGV_Version)"
115+
condition: and( succeeded(), or( eq(variables['Build.SourceBranchName'], 'master'), contains(variables['Build.SourceBranchName'], 'release') ) )
116+
displayName: Generate change log
117+
118+
# generate change log including future version
119+
- script: |
120+
gem install github_changelog_generator
121+
bundle exec github_changelog_generator --token $(GitHubToken)
122+
condition: and( succeeded(), not( or( eq(variables['Build.SourceBranchName'], 'master'), contains(variables['Build.SourceBranchName'], 'release') ) ) )
123+
displayName: Generate change log
124+
125+
##################################
126+
# report build failure to Discord
127+
- job: Report_Build_Failure
128+
dependsOn:
129+
- Build_Class_Lib
130+
condition: failed('Build_Class_Lib')
131+
132+
pool:
133+
vmImage: 'VS2017-Win2016'
134+
135+
steps:
136+
137+
- checkout: self
138+
fetchDepth: 1
139+
140+
# step from template @ nf-tools repo
141+
- template: azure-pipelines-templates/discord-webhook.yml@templates
142+
parameters:
143+
status: 'failure'
144+
webhookUrl: '$(DiscordWebhook)'
145+
message: ''

0 commit comments

Comments
 (0)