Skip to content

Commit 0b33efd

Browse files
committed
ci: 🔧Copy pipeline from master
- Disable PR builds in CI pipeline - Two-stage build and publish
1 parent b5671c9 commit 0b33efd

File tree

1 file changed

+108
-82
lines changed

1 file changed

+108
-82
lines changed

azure-pipelines.yml

Lines changed: 108 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
# Add steps that build, run tests, deploy, and more:
44
# https://aka.ms/yaml
55

6+
pr: none
67
trigger:
78
branches:
89
include:
@@ -19,92 +20,117 @@ pool:
1920
variables:
2021
- group: common
2122

22-
steps:
23-
- checkout: self
24-
fetchDepth: 1
25-
clean: false
26-
lfs: true
27-
submodules: false
28-
fetchTags: false
29-
30-
- task: InstallNanoMSBuildComponents@1
31-
displayName: Install .NET nanoFramework MSBuild components
23+
stages:
24+
- stage: Build
25+
displayName: Build & test
26+
jobs:
27+
- job: Build
28+
displayName: Build & test
29+
steps:
30+
- checkout: self
31+
fetchDepth: 1
32+
clean: false
33+
lfs: true
34+
submodules: false
35+
fetchTags: false
36+
37+
- task: InstallNanoMSBuildComponents@1
38+
displayName: Install .NET nanoFramework MSBuild components
3239

3340
- task: UseDotNet@2
3441
displayName: Install net5.0
3542
inputs:
3643
packageType: 'sdk'
3744
version: '5.0.x'
3845

39-
- task: PowerShell@2
40-
displayName: 'Build, test, pack'
41-
inputs:
42-
filePath: 'Build/build.ps1'
43-
arguments: '-IncludeNanoFramework'
44-
# arguments: '-IncludeWindowsRuntimeComponent -IncludeNanoFramework'
45-
failOnStderr: true
46-
showWarnings: true
47-
pwsh: true
48-
workingDirectory: '$(Build.SourcesDirectory)'
49-
50-
- task: PowerShell@2
51-
displayName: Upload to codecov.io
52-
env:
53-
CODECOV_TOKEN: $(CODECOV_TOKEN)
54-
inputs:
55-
targetType: 'inline'
56-
script: |
57-
Write-Host -Foreground Green "Downloading codecov binaries..."
58-
59-
Invoke-WebRequest -Uri https://uploader.codecov.io/verification.gpg -OutFile codecov.asc
60-
gpg.exe --import codecov.asc
61-
62-
Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe -Outfile codecov.exe
63-
Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe.SHA256SUM -Outfile codecov.exe.SHA256SUM
64-
Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe.SHA256SUM.sig -Outfile codecov.exe.SHA256SUM.sig
65-
66-
gpg.exe --verify codecov.exe.SHA256SUM.sig codecov.exe.SHA256SUM
67-
If ($(Compare-Object -ReferenceObject $(($(certUtil -hashfile codecov.exe SHA256)[1], "codecov.exe") -join " ") -DifferenceObject $(Get-Content codecov.exe.SHA256SUM)).length -eq 0) { echo "SHASUM verified" } Else {exit 1}
68-
69-
Write-Host -Foreground Green "Uploading to codecov..."
70-
71-
.\codecov.exe --dir "Artifacts/Coverage" -t "$env:CODECOV_TOKEN" --build "$(Build.BuildNumber)"
72-
73-
Write-Host -Foreground Green "✅ Uploaded to codecov."
74-
pwsh: true
75-
76-
- publish: $(Build.SourcesDirectory)/Artifacts
77-
displayName: 'Publish Artifacts'
78-
artifact: 'Artifacts'
79-
80-
- task: CopyFiles@2
81-
displayName: Copy nugets to staging
82-
inputs:
83-
SourceFolder: '$(Build.SourcesDirectory)/Artifacts'
84-
Contents: |
85-
**/*.nupkg
86-
**/*.snupkg
87-
**/*.symbols.nupkg
88-
TargetFolder: '$(Build.ArtifactStagingDirectory)'
89-
flattenFolders: true
90-
preserveTimestamp: true
91-
retryCount: '3'
92-
ignoreMakeDirErrors: true
93-
94-
- task: Bash@3
95-
displayName: 'Push to nuget.org'
96-
env:
97-
NUGET_ORG_APIKEY: '$(NUGET_ORG_APIKEY)'
98-
inputs:
99-
targetType: 'inline'
100-
script: 'dotnet nuget push "*.nupkg" --skip-duplicate --api-key $NUGET_ORG_APIKEY --source https://api.nuget.org/v3/index.json'
101-
workingDirectory: '$(Build.ArtifactStagingDirectory)'
102-
103-
- task: NuGetCommand@2
104-
displayName: Push to internal NuGet feed
105-
inputs:
106-
command: 'push'
107-
packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg'
108-
nuGetFeedType: 'internal'
109-
publishVstsFeed: 'fee4c64f-3e49-4618-9ea4-5a3167257c37/989275f4-a952-4abd-ae82-2e7a0cb97b9b'
110-
allowPackageConflicts: true
46+
- task: PowerShell@2
47+
displayName: 'Build, test, pack'
48+
inputs:
49+
filePath: 'Build/build.ps1'
50+
arguments: '-IncludeNanoFramework'
51+
failOnStderr: true
52+
showWarnings: true
53+
pwsh: true
54+
workingDirectory: '$(Build.SourcesDirectory)'
55+
56+
- task: PowerShell@2
57+
displayName: Upload to codecov.io
58+
env:
59+
CODECOV_TOKEN: $(CODECOV_TOKEN)
60+
inputs:
61+
targetType: 'inline'
62+
script: |
63+
Write-Host -Foreground Green "Downloading codecov binaries..."
64+
65+
Invoke-WebRequest -Uri https://uploader.codecov.io/verification.gpg -OutFile codecov.asc
66+
gpg.exe --import codecov.asc
67+
68+
Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe -Outfile codecov.exe
69+
Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe.SHA256SUM -Outfile codecov.exe.SHA256SUM
70+
Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe.SHA256SUM.sig -Outfile codecov.exe.SHA256SUM.sig
71+
72+
gpg.exe --verify codecov.exe.SHA256SUM.sig codecov.exe.SHA256SUM
73+
If ($(Compare-Object -ReferenceObject $(($(certUtil -hashfile codecov.exe SHA256)[1], "codecov.exe") -join " ") -DifferenceObject $(Get-Content codecov.exe.SHA256SUM)).length -eq 0) { echo "SHASUM verified" } Else {exit 1}
74+
75+
Write-Host -Foreground Green "Uploading to codecov..."
76+
77+
.\codecov.exe --dir "Artifacts/Coverage" -t "$env:CODECOV_TOKEN" --build "$(Build.BuildNumber)"
78+
79+
Write-Host -Foreground Green "✅ Uploaded to codecov."
80+
pwsh: true
81+
82+
- publish: $(Build.SourcesDirectory)/Artifacts
83+
displayName: 'Publish Artifacts'
84+
artifact: 'Artifacts'
85+
86+
- task: CopyFiles@2
87+
displayName: Copy nugets to staging
88+
inputs:
89+
SourceFolder: '$(Build.SourcesDirectory)/Artifacts'
90+
Contents: |
91+
**/*.nupkg
92+
**/*.snupkg
93+
TargetFolder: '$(Build.ArtifactStagingDirectory)'
94+
flattenFolders: true
95+
preserveTimestamp: true
96+
retryCount: '3'
97+
ignoreMakeDirErrors: true
98+
99+
- task: PublishPipelineArtifact@1
100+
displayName: Upload nugets to pipeline
101+
inputs:
102+
targetPath: '$(Build.ArtifactStagingDirectory)'
103+
artifact: 'nugets'
104+
publishLocation: 'pipeline'
105+
106+
- stage: Publish
107+
dependsOn: Build
108+
condition: eq(variables['Build.SourceBranch'], 'refs/heads/master')
109+
jobs:
110+
- job: Publish
111+
displayName: Publish nugets
112+
steps:
113+
- task: DownloadPipelineArtifact@2
114+
displayName: Download nugets from pipeline
115+
inputs:
116+
buildType: 'current'
117+
artifactName: 'nugets'
118+
targetPath: '$(Build.ArtifactStagingDirectory)'
119+
120+
- task: Bash@3
121+
displayName: 'Push to nuget.org'
122+
env:
123+
NUGET_ORG_APIKEY: '$(NUGET_ORG_APIKEY)'
124+
inputs:
125+
targetType: 'inline'
126+
script: 'dotnet nuget push "*.nupkg" --skip-duplicate --api-key $NUGET_ORG_APIKEY --source https://api.nuget.org/v3/index.json'
127+
workingDirectory: '$(Build.ArtifactStagingDirectory)'
128+
129+
- task: NuGetCommand@2
130+
displayName: Push to internal NuGet feed
131+
inputs:
132+
command: 'push'
133+
packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg'
134+
nuGetFeedType: 'internal'
135+
publishVstsFeed: 'fee4c64f-3e49-4618-9ea4-5a3167257c37/989275f4-a952-4abd-ae82-2e7a0cb97b9b'
136+
allowPackageConflicts: true

0 commit comments

Comments
 (0)