Skip to content

Commit

Permalink
Publish nightly packages to Azure DevOps (coverlet-coverage#1020)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
tonerdo authored Dec 18, 2020
1 parent 511a307 commit fcb2ec0
Show file tree
Hide file tree
Showing 8 changed files with 34 additions and 52 deletions.
28 changes: 5 additions & 23 deletions Documentation/ConsumeNightlyBuild.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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 -->
Expand All @@ -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 modified Documentation/images/nightly.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed Documentation/images/nightly_1.PNG
Binary file not shown.
Binary file removed Documentation/images/nightly_2.PNG
Binary file not shown.
1 change: 0 additions & 1 deletion coverlet.sln
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
32 changes: 26 additions & 6 deletions eng/azure-pipelines-nightly.yml
Original file line number Diff line number Diff line change
@@ -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
6 changes: 3 additions & 3 deletions eng/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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]*"
Expand Down
19 changes: 0 additions & 19 deletions eng/nightly.ps1

This file was deleted.

0 comments on commit fcb2ec0

Please sign in to comment.