Publish nightly packages to Azure DevOps (#1020)

* Update nightly build definitions

* Update nightly package feed name

* Update feed information

* Use scoped name in publishVstsFeed argument

* Remove nightly.ps1

* Update nightly documentation

* ADO doesn't let us check package metadata
This commit is contained in:
Toni Solarin-Sodara
2020-12-18 05:53:18 +01:00
committed by GitHub
parent 511a3074bb
commit fcb2ec039f
8 changed files with 34 additions and 52 deletions
+5 -23
View File
@@ -1,11 +1,5 @@
# Consume nightly build
You can check the metadata of nightly build packages here:
MSBuild https://www.myget.org/feed/coverlet-dev/package/nuget/coverlet.msbuild
VSTest collector https://www.myget.org/feed/coverlet-dev/package/nuget/coverlet.collector
.NET tools https://www.myget.org/feed/coverlet-dev/package/nuget/coverlet.console
To consume nightly builds, create a `NuGet.Config` in your root solution directory and add the following content:
```xml
@@ -14,7 +8,7 @@ To consume nightly builds, create a `NuGet.Config` in your root solution directo
<packageSources>
<clear />
<!-- Coverlet nightly build feed -->
<add key="coverletNightly" value="https://www.myget.org/F/coverlet-dev/api/v3/index.json" />
<add key="coverletNightly" value="https://pkgs.dev.azure.com/tonerdo/coverlet/_packaging/coverlet-nightly/nuget/v3/index.json" />
<!-- Default nuget feed -->
<add key="nuget" value="https://api.nuget.org/v3/index.json" />
<!-- Add all other needed feed -->
@@ -31,31 +25,19 @@ Visual Studio:
NuGet (Package Manager console):
```powershell
PM> Install-Package coverlet.msbuild -Version 2.6.25-g6209239d69 -Source https://www.myget.org/F/coverlet-dev/api/v3/index.json
PM> Install-Package coverlet.msbuild -Version 3.0.0-preview.18.g183cbed8a6 -Source https://pkgs.dev.azure.com/tonerdo/coverlet/_packaging/coverlet-nightly/nuget/v3/index.json
```
.NET CLI:
```bash
dotnet add package coverlet.msbuild --version 2.6.25-g6209239d69 --source https://www.myget.org/F/coverlet-dev/api/v3/index.json
dotnet add package coverlet.msbuild --version 3.0.0-preview.18.g183cbed8a6 --source https://pkgs.dev.azure.com/tonerdo/coverlet/_packaging/coverlet-nightly/nuget/v3/index.json
```
MSBuild project file:
```xml
<PackageReference Include="coverlet.msbuild" Version="2.6.25-g6209239d69" />
<PackageReference Include="coverlet.msbuild" Version="3.0.0-preview.18.g183cbed8a6" />
```
### How to verify version
You can understand which version you're using by comparing nightly build release date with repo commits.
For instance if we want to consume last msbuild nightly build:
* Go to https://www.myget.org/feed/coverlet-dev/package/nuget/coverlet.msbuild
* Scroll down the page and check release date
![File](images/nightly_1.PNG)
* Go to repo commits and compare date and first part of commit hash
![File](images/nightly_2.PNG)
As you can see we build at 00.00 UTC and build takes some seconds, so it's possible that release date won't be the same as repo commits.
_Note: The version provided here is just an example, you should use the latest when possible_
Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 134 KiB

-1
View File
@@ -35,7 +35,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
Directory.Build.props = Directory.Build.props
Directory.Build.targets = Directory.Build.targets
global.json = global.json
eng\nightly.ps1 = eng\nightly.ps1
EndProjectSection
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "coverlet.tests.projectsample.excludedbyattribute", "test\coverlet.tests.projectsample.excludedbyattribute\coverlet.tests.projectsample.excludedbyattribute.csproj", "{D6B14F2F-9E7D-4D2C-BAC8-48834F853ED6}"
+26 -6
View File
@@ -1,15 +1,35 @@
pool:
vmImage: 'windows-2019'
steps:
- task: UseDotNet@2
inputs:
version: 2.2.402
displayName: Install .NET Core SDK 2.2.402
- task: UseDotNet@2
inputs:
version: 3.1.401
- powershell:
.\eng\nightly.ps1 -apiKey $env:APIKEY -source $env:SOURCE
ignoreLASTEXITCODE: true
env:
APIKEY: $(apikey)
SOURCE: $(source)
displayName: Install .NET Core SDK 3.1.401
- task: NuGetAuthenticate@0
displayName: Authenticate with NuGet feeds
- script: dotnet pack -c Release /p:PublicRelease=false
displayName: Create NuGet packages
- task: NuGetCommand@2
inputs:
command: push
packagesToPush: $(Build.SourcesDirectory)/bin/Release/Packages/*.nupkg
nuGetFeedType: internal
publishVstsFeed: coverlet/coverlet-nightly
displayName: Publish NuGet packages
- task: NuGetCommand@2
inputs:
command: push
packagesToPush: $(Build.SourcesDirectory)/bin/Release/Packages/*.snupkg
nuGetFeedType: internal
publishVstsFeed: coverlet/coverlet-nightly
displayName: Publish NuGet symbol packages
+3 -3
View File
@@ -2,12 +2,12 @@ steps:
- task: UseDotNet@2
inputs:
version: 2.2.402
displayName: Install .NET Core SDK
displayName: Install .NET Core SDK 2.2.402
- task: UseDotNet@2
inputs:
version: 3.1.401
displayName: Install .NET Core SDK
displayName: Install .NET Core SDK 3.1.401
- script: dotnet restore
displayName: Restore packages
@@ -19,7 +19,7 @@ steps:
displayName: Pack
- task: DotNetCoreCLI@2
displayName: Test
displayName: Run tests
inputs:
command: test
arguments: -c $(BuildConfiguration) --no-build /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:Include="[coverlet.collector]*%2c[coverlet.core]*%2c[coverlet.msbuild.tasks]*" /p:Exclude="[coverlet.core.tests.samples.netstandard]*%2c[coverlet.tests.xunit.extensions]*"
-19
View File
@@ -1,19 +0,0 @@
param (
[string]$apiKey,
[string]$source
)
if (!$apiKey -or !$source)
{
Write-Host -ForegroundColor Red Specify apiKey and source
exit
}
Write-Host -ForegroundColor Blue Publish with .NET CLI
& dotnet --info
Write-Host -ForegroundColor Green Create Packages
& dotnet pack -c Release /p:PublicRelease=false
Write-Host -ForegroundColor Green Upload Packages
& dotnet nuget push "$PSScriptRoot\..\bin\Release\Packages\*.nupkg" -k $apiKey -s $source