-
Notifications
You must be signed in to change notification settings - Fork 383
/
azure-pipelines.yml
130 lines (111 loc) · 4.07 KB
/
azure-pipelines.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# Starter pipeline
# Start with a minimal pipeline that you can customize to build and deploy your code.
# Add steps that build, run tests, deploy, and more:
# https://aka.ms/yaml
pr: none
trigger:
branches:
include:
- master
- release/*
paths:
exclude:
- '**/*.png'
- '**/*.md'
pool:
vmImage: windows-latest
variables:
- group: common
stages:
- stage: Build
displayName: Build & test
jobs:
- job: Build
displayName: Build & test
steps:
- checkout: self
fetchDepth: 1
clean: false
lfs: true
submodules: false
fetchTags: false
- task: InstallNanoMSBuildComponents@1
displayName: Install .NET nanoFramework MSBuild components
- task: PowerShell@2
displayName: 'Build, test, pack'
inputs:
filePath: 'Build/build.ps1'
arguments: '-IncludeNanoFramework'
failOnStderr: true
showWarnings: true
pwsh: true
workingDirectory: '$(Build.SourcesDirectory)'
- task: PowerShell@2
displayName: Upload to codecov.io
env:
CODECOV_TOKEN: $(CODECOV_TOKEN)
inputs:
targetType: 'inline'
script: |
Write-Host -Foreground Green "Downloading codecov binaries..."
Invoke-WebRequest -Uri https://uploader.codecov.io/verification.gpg -OutFile codecov.asc
gpg.exe --import codecov.asc
Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe -Outfile codecov.exe
Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe.SHA256SUM -Outfile codecov.exe.SHA256SUM
Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe.SHA256SUM.sig -Outfile codecov.exe.SHA256SUM.sig
gpg.exe --verify codecov.exe.SHA256SUM.sig codecov.exe.SHA256SUM
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}
Write-Host -Foreground Green "Uploading to codecov..."
.\codecov.exe --dir "Artifacts/Coverage" -t "$env:CODECOV_TOKEN" --build "$(Build.BuildNumber)"
Write-Host -Foreground Green "✅ Uploaded to codecov."
pwsh: true
- publish: $(Build.SourcesDirectory)/Artifacts
displayName: 'Publish Artifacts'
artifact: 'Artifacts'
- task: CopyFiles@2
displayName: Copy nugets to staging
inputs:
SourceFolder: '$(Build.SourcesDirectory)/Artifacts'
Contents: |
**/*.nupkg
**/*.snupkg
TargetFolder: '$(Build.ArtifactStagingDirectory)'
flattenFolders: true
preserveTimestamp: true
retryCount: '3'
ignoreMakeDirErrors: true
- task: PublishPipelineArtifact@1
displayName: Upload nugets to pipeline
inputs:
targetPath: '$(Build.ArtifactStagingDirectory)'
artifact: 'nugets'
publishLocation: 'pipeline'
- stage: Publish
dependsOn: Build
condition: eq(variables['Build.SourceBranch'], 'refs/heads/master')
jobs:
- job: Publish
displayName: Publish nugets
steps:
- task: DownloadPipelineArtifact@2
displayName: Download nugets from pipeline
inputs:
buildType: 'current'
artifactName: 'nugets'
targetPath: '$(Build.ArtifactStagingDirectory)'
- task: Bash@3
displayName: 'Push to nuget.org'
env:
NUGET_ORG_APIKEY: '$(NUGET_ORG_APIKEY)'
inputs:
targetType: 'inline'
script: 'dotnet nuget push "*.nupkg" --skip-duplicate --api-key $NUGET_ORG_APIKEY --source https://api.nuget.org/v3/index.json'
workingDirectory: '$(Build.ArtifactStagingDirectory)'
- task: NuGetCommand@2
displayName: Push to internal NuGet feed
inputs:
command: 'push'
packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg'
nuGetFeedType: 'internal'
publishVstsFeed: 'fee4c64f-3e49-4618-9ea4-5a3167257c37/989275f4-a952-4abd-ae82-2e7a0cb97b9b'
allowPackageConflicts: true