Skip to content

Commit 722432a

Browse files
committed
Work CI-CD
- Add new step to build smoke test project. ***NO_CI***
1 parent e5e121b commit 722432a

1 file changed

Lines changed: 194 additions & 164 deletions

File tree

azure-pipelines.yml

Lines changed: 194 additions & 164 deletions
Original file line numberDiff line numberDiff line change
@@ -41,177 +41,207 @@ stages:
4141
########################
4242
- stage: Build
4343
jobs:
44-
- job: Build_SDK
45-
pool:
46-
vmImage: 'windows-latest'
47-
48-
variables:
49-
- group: sign-client-credentials
50-
- name: buildPlatform
51-
value: 'Any CPU'
52-
- name: buildConfiguration
53-
value: 'Release'
54-
- name: solution
55-
value: 'nanoFramework.NET.Sdk.sln'
56-
57-
steps:
58-
- checkout: self
59-
submodules: true
60-
fetchDepth: 0
61-
62-
- script: |
63-
git config --global user.email nanoframework@outlook.com
64-
git config --global user.name nfbot
65-
git config --global core.autocrlf true
66-
displayName: Setup git identity
67-
68-
- template: install-nbgv-tool.yml@templates
69-
70-
# waiting for project to be public to enable SonarCloud analysis
71-
# - task: SonarCloudPrepare@3
72-
# condition: >-
73-
# and(
74-
# succeeded(),
75-
# eq(variables['StartReleaseCandidate'], false),
76-
# not(startsWith(variables['Build.SourceBranch'], 'refs/tags/v')),
77-
# not(${{ parameters.skipSonarCloudAnalysis }})
78-
# )
79-
# displayName: 'Prepare analysis on SonarCloud'
80-
# inputs:
81-
# SonarCloud: 'sonarcloud-$(System.TeamProject)'
82-
# organization: 'nanoframework'
83-
# scannerMode: 'dotnet'
84-
# projectKey: 'nanoframework_net-sdk'
85-
# extraProperties: |
86-
# sonar.exclusions=**/obj/**,**/*.dll
87-
# sonar.cs.vscoveragexml.reportsPaths=$(Agent.TempDirectory)/**/**.coverage
88-
# sonar.cs.vstest.reportsPaths=$(Agent.TempDirectory)/**/**.trx
89-
# sonar.scanner.skipJreProvisioning=true
90-
91-
- template: install-nuget.yml@templates
92-
93-
- task: DotNetCoreCLI@2
94-
displayName: Build
95-
inputs:
96-
command: 'build'
97-
projects: '$(solution)'
98-
arguments: '--configuration $(buildConfiguration) /p:PublicRelease=true'
99-
100-
# waiting for project to be public to enable SonarCloud analysis
101-
# - task: SonarCloudAnalyze@3
102-
# condition: >-
103-
# and(
104-
# succeeded(),
105-
# eq(variables['StartReleaseCandidate'], false),
106-
# not(startsWith(variables['Build.SourceBranch'], 'refs/tags/v'))
107-
# )
108-
# displayName: 'Run Code Analysis'
109-
# continueOnError: true
110-
111-
# waiting for project to be public to enable SonarCloud analysis
112-
# - task: SonarCloudPublish@3
113-
# condition: >-
114-
# and(
115-
# succeeded(),
116-
# eq(variables['StartReleaseCandidate'], false),
117-
# not(startsWith(variables['Build.SourceBranch'], 'refs/tags/v'))
118-
# )
119-
# displayName: 'Publish Quality Gate Result'
120-
# continueOnError: true
121-
122-
- task: DotNetCoreCLI@2
123-
displayName: Install Sign Client CLI
124-
condition: >-
125-
and(
126-
succeeded(),
127-
eq(variables['StartReleaseCandidate'], false),
128-
not(startsWith(variables['Build.SourceBranch'], 'refs/tags/v'))
129-
)
130-
inputs:
131-
command: custom
132-
custom: tool
133-
arguments: install --tool-path . sign --version 0.9.1-beta.23530.1
134-
135-
- pwsh: |
136-
.\sign code azure-key-vault `
137-
"**/nanoFramework.Tools.BuildTasks.*" `
138-
--base-directory "$(Build.SourcesDirectory)/nanoFramework.NET.Sdk/build/Release" `
139-
--description "$(Build.Repository.Name)" `
140-
--description-url "https://github.com/$(Build.Repository.Name)" `
141-
--azure-key-vault-tenant-id "$(SignTenantId)" `
142-
--azure-key-vault-client-id "$(SignClientId)" `
143-
--azure-key-vault-client-secret "$(SignClientSecret)" `
144-
--azure-key-vault-certificate "$(SignKeyVaultCertificate)" `
145-
--azure-key-vault-url "$(SignKeyVaultUrl)" `
146-
--timestamp-url http://timestamp.digicert.com
147-
displayName: Sign DLLs
148-
continueOnError: false
149-
condition: >-
150-
and(
151-
succeeded(),
152-
eq(variables['StartReleaseCandidate'], false),
153-
not(startsWith(variables['Build.SourceBranch'], 'refs/tags/v'))
154-
)
44+
- job: Build_SDK
45+
pool:
46+
vmImage: 'windows-latest'
15547

156-
- task: DotNetCoreCLI@2
157-
displayName: Pack
158-
inputs:
159-
command: 'pack'
160-
packagesToPack: '**/src/nanoFramework.NET.Sdk.csproj'
161-
versioningScheme: 'off'
162-
arguments: '--configuration $(buildConfiguration) /p:PublicRelease=true --output $(Build.ArtifactStagingDirectory)'
163-
164-
- pwsh: |
165-
.\sign code azure-key-vault `
166-
"**/*.nupkg" `
167-
--base-directory "$(Build.ArtifactStagingDirectory)" `
168-
--description "$(Build.Repository.Name)" `
169-
--description-url "https://github.com/$(Build.Repository.Name)" `
170-
--azure-key-vault-tenant-id "$(SignTenantId)" `
171-
--azure-key-vault-client-id "$(SignClientId)" `
172-
--azure-key-vault-client-secret "$(SignClientSecret)" `
173-
--azure-key-vault-certificate "$(SignKeyVaultCertificate)" `
174-
--azure-key-vault-url "$(SignKeyVaultUrl)" `
175-
--timestamp-url http://timestamp.digicert.com
176-
displayName: Sign NuGet package
177-
continueOnError: true
178-
condition: >-
179-
and(
180-
succeeded(),
181-
eq(variables['StartReleaseCandidate'], false),
182-
not(startsWith(variables['Build.SourceBranch'], 'refs/tags/v'))
183-
)
48+
variables:
49+
- group: sign-client-credentials
50+
- name: buildPlatform
51+
value: 'Any CPU'
52+
- name: buildConfiguration
53+
value: 'Release'
54+
- name: solution
55+
value: 'nanoFramework.NET.Sdk.sln'
56+
57+
steps:
58+
- checkout: self
59+
submodules: true
60+
fetchDepth: 0
61+
62+
- script: |
63+
git config --global user.email nanoframework@outlook.com
64+
git config --global user.name nfbot
65+
git config --global core.autocrlf true
66+
displayName: Setup git identity
67+
68+
- template: azure-pipelines-templates/install-nbgv-tool.yml@templates
69+
70+
# waiting for project to be public to enable SonarCloud analysis
71+
# - task: SonarCloudPrepare@3
72+
# condition: >-
73+
# and(
74+
# succeeded(),
75+
# eq(variables['StartReleaseCandidate'], false),
76+
# not(startsWith(variables['Build.SourceBranch'], 'refs/tags/v')),
77+
# not(${{ parameters.skipSonarCloudAnalysis }})
78+
# )
79+
# displayName: 'Prepare analysis on SonarCloud'
80+
# inputs:
81+
# SonarCloud: 'sonarcloud-$(System.TeamProject)'
82+
# organization: 'nanoframework'
83+
# scannerMode: 'dotnet'
84+
# projectKey: 'nanoframework_net-sdk'
85+
# extraProperties: |
86+
# sonar.exclusions=**/obj/**,**/*.dll
87+
# sonar.cs.vscoveragexml.reportsPaths=$(Agent.TempDirectory)/**/**.coverage
88+
# sonar.cs.vstest.reportsPaths=$(Agent.TempDirectory)/**/**.trx
89+
# sonar.scanner.skipJreProvisioning=true
18490

185-
- task: PublishPipelineArtifact@1
186-
displayName: Publish NuGet package
187-
inputs:
188-
targetPath: '$(Build.ArtifactStagingDirectory)'
189-
artifactName: 'NuGetPackage'
190-
artifactType: 'pipeline'
191-
192-
- task: NuGetCommand@2
193-
condition: >-
194-
and(
195-
succeeded(),
196-
eq(variables['System.PullRequest.PullRequestId'], ''),
197-
not(startsWith(variables['Build.SourceBranch'], 'refs/pull/')),
198-
eq(variables['StartReleaseCandidate'], false),
199-
not(startsWith(variables['Build.SourceBranch'], 'refs/tags/v'))
91+
- template: azure-pipelines-templates/install-nuget.yml@templates
92+
93+
- task: DotNetCoreCLI@2
94+
displayName: Build
95+
inputs:
96+
command: 'build'
97+
projects: '$(solution)'
98+
arguments: '--configuration $(buildConfiguration) /p:PublicRelease=true'
99+
100+
# waiting for project to be public to enable SonarCloud analysis
101+
# - task: SonarCloudAnalyze@3
102+
# condition: >-
103+
# and(
104+
# succeeded(),
105+
# eq(variables['StartReleaseCandidate'], false),
106+
# not(startsWith(variables['Build.SourceBranch'], 'refs/tags/v'))
107+
# )
108+
# displayName: 'Run Code Analysis'
109+
# continueOnError: true
110+
111+
# waiting for project to be public to enable SonarCloud analysis
112+
# - task: SonarCloudPublish@3
113+
# condition: >-
114+
# and(
115+
# succeeded(),
116+
# eq(variables['StartReleaseCandidate'], false),
117+
# not(startsWith(variables['Build.SourceBranch'], 'refs/tags/v'))
118+
# )
119+
# displayName: 'Publish Quality Gate Result'
120+
# continueOnError: true
121+
122+
- task: DotNetCoreCLI@2
123+
displayName: Install Sign Client CLI
124+
condition: >-
125+
and(
126+
succeeded(),
127+
eq(variables['StartReleaseCandidate'], false),
128+
not(startsWith(variables['Build.SourceBranch'], 'refs/tags/v'))
129+
)
130+
inputs:
131+
command: custom
132+
custom: tool
133+
arguments: install --tool-path . sign --version 0.9.1-beta.23530.1
134+
135+
- pwsh: |
136+
.\sign code azure-key-vault `
137+
"**/nanoFramework.Tools.BuildTasks.*" `
138+
--base-directory "$(Build.SourcesDirectory)/nanoFramework.NET.Sdk/build/Release" `
139+
--description "$(Build.Repository.Name)" `
140+
--description-url "https://github.com/$(Build.Repository.Name)" `
141+
--azure-key-vault-tenant-id "$(SignTenantId)" `
142+
--azure-key-vault-client-id "$(SignClientId)" `
143+
--azure-key-vault-client-secret "$(SignClientSecret)" `
144+
--azure-key-vault-certificate "$(SignKeyVaultCertificate)" `
145+
--azure-key-vault-url "$(SignKeyVaultUrl)" `
146+
--timestamp-url http://timestamp.digicert.com
147+
displayName: Sign DLLs
148+
continueOnError: false
149+
condition: >-
150+
and(
151+
succeeded(),
152+
eq(variables['StartReleaseCandidate'], false),
153+
not(startsWith(variables['Build.SourceBranch'], 'refs/tags/v'))
154+
)
155+
156+
- task: DotNetCoreCLI@2
157+
displayName: Pack
158+
inputs:
159+
command: 'pack'
160+
packagesToPack: '**/src/nanoFramework.NET.Sdk.csproj'
161+
versioningScheme: 'off'
162+
arguments: '--configuration $(buildConfiguration) /p:PublicRelease=true --output $(Build.ArtifactStagingDirectory)'
163+
164+
- pwsh: |
165+
.\sign code azure-key-vault `
166+
"**/*.nupkg" `
167+
--base-directory "$(Build.ArtifactStagingDirectory)" `
168+
--description "$(Build.Repository.Name)" `
169+
--description-url "https://github.com/$(Build.Repository.Name)" `
170+
--azure-key-vault-tenant-id "$(SignTenantId)" `
171+
--azure-key-vault-client-id "$(SignClientId)" `
172+
--azure-key-vault-client-secret "$(SignClientSecret)" `
173+
--azure-key-vault-certificate "$(SignKeyVaultCertificate)" `
174+
--azure-key-vault-url "$(SignKeyVaultUrl)" `
175+
--timestamp-url http://timestamp.digicert.com
176+
displayName: Sign NuGet package
177+
continueOnError: true
178+
condition: >-
179+
and(
180+
succeeded(),
181+
eq(variables['StartReleaseCandidate'], false),
182+
not(startsWith(variables['Build.SourceBranch'], 'refs/tags/v'))
183+
)
184+
185+
- task: PublishPipelineArtifact@1
186+
displayName: Publish NuGet package
187+
inputs:
188+
targetPath: '$(Build.ArtifactStagingDirectory)'
189+
artifactName: 'NuGetPackage'
190+
artifactType: pipeline
191+
192+
- task: PowerShell@2
193+
displayName: Create NuGet config for SmokeTest
194+
inputs:
195+
targetType: inline
196+
script: |
197+
$nugetConfig = @(
198+
'<?xml version="1.0" encoding="utf-8"?>'
199+
'<configuration>'
200+
' <packageSources>'
201+
' <clear />'
202+
' <add key="local-sdk" value="$(Build.ArtifactStagingDirectory)" />'
203+
' <add key="nuget.org" value="https://api.nuget.org/v3/index.json" />'
204+
' </packageSources>'
205+
'</configuration>'
200206
)
201-
continueOnError: true
202-
displayName: Push NuGet package to NuGet
203-
inputs:
204-
command: push
205-
nuGetFeedType: external
206-
allowPackageConflicts: true
207-
packagesToPush: '$(Build.ArtifactStagingDirectory)/*.nupkg'
208-
publishFeedCredentials: 'NuGet-$(System.TeamProject)'
207+
$nugetConfig | Set-Content -Path "$(Build.SourcesDirectory)/test/SmokeTest/NuGet.Azdo.Config"
208+
209+
- task: DotNetCoreCLI@2
210+
displayName: Restore SmokeTest
211+
inputs:
212+
command: 'restore'
213+
projects: 'test/SmokeTest/SmokeTest.csproj'
214+
feedsToUse: 'config'
215+
nugetConfigPath: '$(Build.SourcesDirectory)/test/SmokeTest/NuGet.Azdo.Config'
209216

217+
- task: DotNetCoreCLI@2
218+
displayName: Build SmokeTest
219+
inputs:
220+
command: 'build'
221+
projects: 'test/SmokeTest/SmokeTest.csproj'
222+
arguments: '--configuration $(buildConfiguration) --no-restore'
223+
224+
- task: NuGetCommand@2
225+
condition: >-
226+
and(
227+
succeeded(),
228+
eq(variables['System.PullRequest.PullRequestId'], ''),
229+
not(startsWith(variables['Build.SourceBranch'], 'refs/pull/')),
230+
eq(variables['StartReleaseCandidate'], false),
231+
not(startsWith(variables['Build.SourceBranch'], 'refs/tags/v'))
232+
)
233+
continueOnError: true
234+
displayName: Push NuGet package to NuGet
235+
inputs:
236+
command: push
237+
nuGetFeedType: external
238+
allowPackageConflicts: true
239+
packagesToPush: '$(Build.ArtifactStagingDirectory)/*.nupkg'
240+
publishFeedCredentials: 'NuGet-$(System.TeamProject)'
210241

211242
# report build failure to Discord
212243
- stage: Report_Build_Failure
213-
dependsOn:
214-
- Build
244+
dependsOn: Build
215245
condition: failed('Build')
216246

217247
jobs:

0 commit comments

Comments
 (0)