Skip to content

Commit ceadb47

Browse files
authored
Merge pull request #1761 from AArnott/validate/githubActions
Use Azure Pipelines exclusively (i.e. drop Travis, AppVeyor)
2 parents 95009f0 + 369a98b commit ceadb47

30 files changed

+430
-299
lines changed

.travis.yml

+2-41
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,7 @@
1-
# Travis-CI Build for libgit2sharp
2-
# see travis-ci.org for details
3-
41
language: csharp
52
mono: none
63

7-
matrix:
8-
include:
9-
- os: linux
10-
dist: xenial
11-
before_install:
12-
- |
13-
wget -q https://packages.microsoft.com/config/ubuntu/16.04/packages-microsoft-prod.deb
14-
sudo dpkg -i packages-microsoft-prod.deb
15-
sudo apt-get update
16-
sudo apt-get install -y powershell
17-
- os: osx
18-
osx_image: xcode8.3
19-
before_install:
20-
- brew update # This is necessary to get pwsh 6.2 instead of some 6.0-preview that isn't named `pwsh`
21-
- brew cask install powershell
22-
fast_finish: true
23-
24-
before_install:
25-
- date -u
26-
- uname -a
27-
- env | sort
28-
29-
install:
30-
- git fetch --unshallow
31-
- pwsh ./tools/Install-DotNetSdk.ps1 ; export PATH=~/.dotnet:$PATH
32-
33-
# Build libgit2, LibGit2Sharp and run the tests
34-
script:
35-
- ./buildandtest.sh 'LEAKS_IDENTIFYING'
36-
37-
# Only watch the development branch
4+
# Disable Travis-CI
385
branches:
396
only:
40-
- master
41-
- /^maint.*/
42-
43-
# Notify of build changes
44-
notifications:
45-
email:
46-
7+
- NOTTHISONE

Directory.Build.props

+4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@
44
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
55
<OutputPath>$(MSBuildThisFileDirectory)bin\$(MSBuildProjectName)\$(Configuration)\</OutputPath>
66
<BaseIntermediateOutputPath>$(MSBuildThisFileDirectory)obj\$(MSBuildProjectName)\</BaseIntermediateOutputPath>
7+
<PackageOutputPath>$(MSBuildThisFileDirectory)bin\Packages\$(Configuration)\</PackageOutputPath>
78
<DefineConstants Condition=" '$(ExtraDefine)' != '' ">$(DefineConstants);$(ExtraDefine)</DefineConstants>
89
</PropertyGroup>
910

11+
<ItemGroup>
12+
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.0" PrivateAssets="All" />
13+
</ItemGroup>
1014
</Project>

Directory.Build.targets

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<Project>
2+
<PropertyGroup Condition=" '$(IsTestProject)' == 'true' ">
3+
<CoverletOutputFormat>cobertura</CoverletOutputFormat>
4+
<Exclude>[xunit.*]*</Exclude>
5+
<!-- Ensure we preserve each coverlet output file per target framework: https://github.com/tonerdo/coverlet/issues/177 -->
6+
<CoverletOutput>$(OutputPath)/</CoverletOutput>
7+
</PropertyGroup>
8+
</Project>

LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
</ItemGroup>
1212

1313
<ItemGroup>
14-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.0.1" />
14+
<PackageReference Include="coverlet.msbuild" Version="2.7.0" />
15+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" />
1516
<PackageReference Include="Moq" Version="4.10.1" />
1617
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
1718
<PackageReference Include="xunit" Version="2.4.1" />

LibGit2Sharp.Tests/StatusFixture.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@ public void CanIncludeStatusOfUnalteredFiles()
640640
RepositoryStatus status = repo.RetrieveStatus(new StatusOptions() { IncludeUnaltered = true });
641641

642642
Assert.Equal(unalteredPaths.Length, status.Unaltered.Count());
643-
Assert.Equal(unalteredPaths, status.Unaltered.OrderBy(s => s.FilePath).Select(s => s.FilePath).ToArray());
643+
Assert.Equal(unalteredPaths, status.Unaltered.OrderBy(s => s.FilePath, StringComparer.OrdinalIgnoreCase).Select(s => s.FilePath).ToArray());
644644
}
645645
}
646646

LibGit2Sharp.Tests/desktop/ShadowCopyFixture.cs

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ namespace LibGit2Sharp.Tests
1111
public class ShadowCopyFixture : BaseFixture
1212
{
1313
[Fact]
14+
[Trait("TestCategory", "FailsWhileInstrumented")]
1415
public void CanProbeForNativeBinariesFromAShadowCopiedAssembly()
1516
{
1617
Type type = typeof(Wrapper);

LibGit2Sharp/LibGit2Sharp.csproj

+8-7
Original file line numberDiff line numberDiff line change
@@ -16,32 +16,33 @@
1616
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
1717
<SignAssembly>true</SignAssembly>
1818
<AssemblyOriginatorKeyFile>..\libgit2sharp.snk</AssemblyOriginatorKeyFile>
19+
<PackageIcon>square-logo.png</PackageIcon>
20+
<PackageLicenseFile>App_Readme/LICENSE.md</PackageLicenseFile>
1921
</PropertyGroup>
2022

2123
<ItemGroup>
2224
<CodeAnalysisDictionary Include="CustomDictionary.xml" />
23-
<None Include="..\README.md" Pack="true" PackagePath="App_Readme\" />
24-
<None Include="..\LICENSE.md" Pack="true" PackagePath="App_Readme\" />
25-
<None Include="..\CHANGES.md" Pack="true" PackagePath="App_Readme\" />
25+
<None Include="..\square-logo.png" Pack="true" PackagePath="" />
26+
<None Include="..\README.md" Pack="true" PackagePath="App_Readme/" />
27+
<None Include="..\LICENSE.md" Pack="true" PackagePath="App_Readme/" />
28+
<None Include="..\CHANGES.md" Pack="true" PackagePath="App_Readme/" />
2629
<None Update="Core\Handles\Objects.tt" Generator="TextTemplatingFileGenerator" LastGenOutput="Objects.cs" />
2730
<Compile Update="Core\Handles\Objects.cs" DependentUpon="Objects.tt" DesignTime="True" AutoGen="True" />
2831
<Service Include="{508349b6-6b84-4df5-91f0-309beebad82d}" /> <!-- Needed for T4 generation -->
2932
</ItemGroup>
3033

3134
<ItemGroup>
3235
<PackageReference Include="LibGit2Sharp.NativeBinaries" Version="[2.0.305]" PrivateAssets="none" />
33-
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta-63127-02" PrivateAssets="all" />
34-
<PackageReference Include="Nerdbank.GitVersioning" Version="2.3.138" PrivateAssets="all" />
36+
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="all" />
37+
<PackageReference Include="Nerdbank.GitVersioning" Version="3.0.50" PrivateAssets="all" />
3538
</ItemGroup>
3639

3740
<Import Project="..\Targets\CodeGenerator.targets" />
3841
<Import Project="..\Targets\GenerateNativeDllName.targets" />
3942

4043
<Target Name="SetNuSpecProperties" BeforeTargets="GenerateNuspec" DependsOnTargets="GetBuildVersion">
4144
<PropertyGroup>
42-
<PackageIconUrl>https://github.com/libgit2/libgit2sharp/raw/$(GitCommitIdShort)/square-logo.png</PackageIconUrl>
4345
<PackageReleaseNotes>https://github.com/libgit2/libgit2sharp/blob/$(GitCommitIdShort)/CHANGES.md#libgit2sharp-changes</PackageReleaseNotes>
44-
<PackageLicenseUrl>https://github.com/libgit2/libgit2sharp/raw/$(GitCommitIdShort)/LICENSE.md</PackageLicenseUrl>
4546
</PropertyGroup>
4647
</Target>
4748

appveyor.yml

+3-157
Original file line numberDiff line numberDiff line change
@@ -1,158 +1,4 @@
1-
version: '{build}'
2-
3-
os: Visual Studio 2019
4-
1+
# Disable AppVeyor
52
branches:
6-
only:
7-
- master
8-
- /^maint.*/
9-
10-
configuration: release
11-
12-
skip_tags: true
13-
14-
nuget:
15-
disable_publish_on_pr: true
16-
17-
environment:
18-
coveralls_token:
19-
secure: ixIsBslo9NheDb5lJknF58EYdgvZ0r3/L0ecRiXjfXmjHBLvoSU6/ZRwaMM+BAlG
20-
coverity_token:
21-
secure: nuzUT+HecXGIi3KaPd/1hgFEZJan/j6+oNbPV75JKjk=
22-
coverity_email:
23-
secure: eGVilNg1Yuq+Xj+SW8r3WCtjnzhoDV0sNJkma4NRq7A=
24-
matrix:
25-
- publish_on_success: False
26-
ExtraDefine: LEAKS_IDENTIFYING
27-
- publish_on_success: True
28-
29-
matrix:
30-
fast_finish: true
31-
32-
install:
33-
- ps: |
34-
Write-Host "Commit being built = " -NoNewLine
35-
Write-Host $Env:APPVEYOR_REPO_COMMIT -ForegroundColor "Green"
36-
Write-Host "Target branch = " -NoNewLine
37-
Write-Host $Env:APPVEYOR_REPO_BRANCH -ForegroundColor "Green"
38-
Write-Host "Is a Pull Request = " -NoNewLine
39-
Write-Host $($Env:APPVEYOR_PULL_REQUEST_NUMBER -ne $null) -ForegroundColor "Green"
40-
41-
$CommitDate = [DateTime]::Parse($Env:APPVEYOR_REPO_COMMIT_TIMESTAMP)
42-
$BuildDate = $CommitDate.ToUniversalTime().ToString("yyyyMMddHHmmss")
43-
Write-Host "Merge commit UTC timestamp = " -NoNewLine
44-
Write-Host $BuildDate -ForegroundColor "Green"
45-
46-
$Env:SHOULD_RUN_COVERITY_ANALYSIS = $($Env:APPVEYOR_SCHEDULED_BUILD -eq $True)
47-
Write-Host "Should run Coverity analysis = " -NoNewLine
48-
Write-Host $Env:SHOULD_RUN_COVERITY_ANALYSIS -ForegroundColor "Green"
49-
50-
$Env:SHOULD_RUN_COVERALLS = $($Env:APPVEYOR_SCHEDULED_BUILD -eq $True)
51-
Write-Host "Should run Coveralls = " -NoNewLine
52-
Write-Host $Env:SHOULD_RUN_COVERALLS -ForegroundColor "Green"
53-
54-
Write-Host "Identifying leaks = " -NoNewLine
55-
Write-Host ($Env:ExtraDefine -eq "LEAKS_IDENTIFYING") -ForegroundColor "Green"
56-
57-
Write-Host "Should publish on success = " -NoNewLine
58-
Write-Host $Env:publish_on_success -ForegroundColor "Green"
59-
60-
If ($Env:SHOULD_RUN_COVERALLS -eq $True)
61-
{
62-
nuget install OpenCover -Version 4.6.166 -ExcludeVersion -OutputDirectory .\packages
63-
nuget install coveralls.net -Version 0.6.0 -ExcludeVersion -OutputDirectory .\packages
64-
}
65-
66-
If ($Env:SHOULD_RUN_COVERITY_ANALYSIS -eq $True)
67-
{
68-
cinst curl -y
69-
}
70-
71-
./tools/Install-DotNetSdk.ps1
72-
73-
before_build:
74-
- ps: |
75-
msbuild "$Env:APPVEYOR_BUILD_FOLDER\LibGit2Sharp.sln" `
76-
/nologo /verbosity:quiet `
77-
/logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" `
78-
/t:restore
79-
80-
build_script:
81-
- ps: |
82-
& cov-build.exe --dir cov-int msbuild "$Env:APPVEYOR_BUILD_FOLDER\LibGit2Sharp.sln" `
83-
/nologo /verbosity:minimal /fl /flp:verbosity=normal `
84-
/logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" `
85-
/t:build,pack
86-
87-
test_script:
88-
- ps: |
89-
Foreach ($runner in 'xunit.console.exe','xunit.console.x86.exe')
90-
{
91-
If ($Env:SHOULD_RUN_COVERALLS -eq $True -and $Env:publish_on_success -eq $True)
92-
{
93-
.\packages\OpenCover\tools\OpenCover.Console.exe `
94-
-register:user `
95-
"-target:""$Env:userprofile\.nuget\packages\xunit.runner.console\2.4.1\tools\net46\$runner""" `
96-
"-targetargs:""$Env:APPVEYOR_BUILD_FOLDER\bin\LibGit2Sharp.Tests\Release\net46\LibGit2Sharp.Tests.dll"" -noshadow" `
97-
"-filter:+[LibGit2Sharp]* -[LibGit2Sharp.Tests]*" `
98-
-hideskipped:All `
99-
-output:opencoverCoverage.xml
100-
}
101-
ElseIf ($Env:SHOULD_RUN_COVERITY_ANALYSIS -eq $False)
102-
{
103-
& "$Env:userprofile\.nuget\packages\xunit.runner.console\2.4.1\tools\net46\$runner" `
104-
"$Env:APPVEYOR_BUILD_FOLDER\bin\LibGit2Sharp.Tests\Release\net46\LibGit2Sharp.Tests.dll" -noshadow
105-
}
106-
}
107-
108-
- dotnet test LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj -f netcoreapp2.1 --no-restore --no-build
109-
110-
after_test:
111-
- ps: |
112-
If ($Env:SHOULD_RUN_COVERALLS -eq $True -and $Env:publish_on_success -eq $True)
113-
{
114-
Write-Host "Uploading code coverage result..." -ForegroundColor "Green"
115-
116-
.\packages\coveralls.net\tools\csmacnz.Coveralls.exe `
117-
--opencover -i opencoverCoverage.xml `
118-
--repoToken $Env:coveralls_token `
119-
--useRelativePaths `
120-
--basePath "$Env:APPVEYOR_BUILD_FOLDER\"`
121-
}
122-
123-
If ($Env:SHOULD_RUN_COVERITY_ANALYSIS -eq $True -and $Env:publish_on_success -eq $True)
124-
{
125-
7z a "$Env:APPVEYOR_BUILD_FOLDER\$Env:APPVEYOR_PROJECT_NAME.zip" "$Env:APPVEYOR_BUILD_FOLDER\cov-int\"
126-
127-
# cf. http://stackoverflow.com/a/25045154/335418
128-
Remove-item alias:curl
129-
130-
Write-Host "Uploading Coverity analysis result..." -ForegroundColor "Green"
131-
132-
curl --silent --show-error `
133-
--output curl-out.txt `
134-
--form token="$Env:coverity_token" `
135-
--form email="$Env:coverity_email" `
136-
--form "file=@$Env:APPVEYOR_BUILD_FOLDER\$Env:APPVEYOR_PROJECT_NAME.zip" `
137-
--form version="$Env:APPVEYOR_REPO_COMMIT" `
138-
--form description="CI server scheduled build." `
139-
https://scan.coverity.com/builds?project=libgit2%2Flibgit2sharp
140-
141-
cat .\curl-out.txt
142-
}
143-
144-
on_finish:
145-
- ps: Push-AppveyorArtifact "msbuild.log"
146-
147-
on_success:
148-
- ps: |
149-
if ($Env:publish_on_success -eq $True)
150-
{
151-
Get-ChildItem "bin\LibGit2Sharp\$env:configuration\*.nupkg" |% { Push-AppveyorArtifact $_.FullName -FileName $_.Name }
152-
}
153-
154-
notifications:
155-
- provider: Email
156-
to:
157-
158-
on_build_status_changed: true
3+
only:
4+
- NOTTHISONE

azure-pipelines.yml

+5-27
Original file line numberDiff line numberDiff line change
@@ -3,32 +3,10 @@ trigger:
33
- maint/*
44

55
variables:
6-
solution: '**/*.sln'
7-
buildPlatform: 'Any CPU'
8-
buildConfiguration: 'Release'
6+
TreatWarningsAsErrors: true
7+
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
8+
BuildConfiguration: Release
9+
NUGET_PACKAGES: $(Agent.TempDirectory)/.nuget/packages
910

1011
jobs:
11-
- job: Windows
12-
pool:
13-
vmImage: 'windows-2019'
14-
steps:
15-
- pwsh: ./tools/Install-DotNetSdk.ps1
16-
displayName: Installing .NET Core SDK and runtimes
17-
- script: buildandtest.cmd
18-
displayName: Build and test
19-
- job: Linux
20-
pool:
21-
vmImage: 'Ubuntu 16.04'
22-
steps:
23-
- pwsh: ./tools/Install-DotNetSdk.ps1
24-
displayName: Installing .NET Core SDK and runtimes
25-
- script: ./buildandtest.sh
26-
displayName: Build and test
27-
- job: macOS
28-
pool:
29-
vmImage: 'macOS 10.13'
30-
steps:
31-
- pwsh: ./tools/Install-DotNetSdk.ps1
32-
displayName: Installing .NET Core SDK and runtimes
33-
- script: ./buildandtest.sh
34-
displayName: Build and test
12+
- template: azure-pipelines/build.yml
File renamed without changes.

azure-pipelines/artifacts/_all.ps1

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# This script returns all the artifacts that should be collected after a build.
2+
#
3+
# Each powershell artifact is expressed as an object with these properties:
4+
# Source - the full path to the source file
5+
# ArtifactName - the name of the artifact to upload to
6+
# ContainerFolder - the relative path within the artifact in which the file should appear
7+
#
8+
# Each artifact aggregating .ps1 script should return a hashtable:
9+
# Key = path to the directory from which relative paths within the artifact should be calculated
10+
# Value = an array of paths (absolute or relative to the BaseDirectory) to files to include in the artifact.
11+
# FileInfo objects are also allowed.
12+
13+
$RepoRoot = [System.IO.Path]::GetFullPath("$PSScriptRoot\..\..")
14+
15+
Function EnsureTrailingSlash($path) {
16+
if ($path.length -gt 0 -and !$path.EndsWith('\') -and !$path.EndsWith('/')) {
17+
$path = $path + [IO.Path]::DirectorySeparatorChar
18+
}
19+
20+
$path.Replace('\', [IO.Path]::DirectorySeparatorChar)
21+
}
22+
23+
Get-ChildItem "$PSScriptRoot\*.ps1" -Exclude "_*" -Recurse |% {
24+
$ArtifactName = $_.BaseName
25+
26+
$fileGroups = & $_
27+
if (!$fileGroups -or $fileGroups.Count -eq 0) {
28+
Write-Warning "No files found for the `"$ArtifactName`" artifact."
29+
} else {
30+
$fileGroups.GetEnumerator() | % {
31+
$BaseDirectory = New-Object Uri ((EnsureTrailingSlash $_.Key), [UriKind]::Absolute)
32+
$_.Value | % {
33+
if ($_.GetType() -eq [IO.FileInfo] -or $_.GetType() -eq [IO.DirectoryInfo]) {
34+
$_ = $_.FullName
35+
}
36+
37+
$artifact = New-Object -TypeName PSObject
38+
Add-Member -InputObject $artifact -MemberType NoteProperty -Name ArtifactName -Value $ArtifactName
39+
40+
$SourceFullPath = New-Object Uri ($BaseDirectory, $_)
41+
Add-Member -InputObject $artifact -MemberType NoteProperty -Name Source -Value $SourceFullPath.LocalPath
42+
43+
$RelativePath = [Uri]::UnescapeDataString($BaseDirectory.MakeRelative($SourceFullPath))
44+
Add-Member -InputObject $artifact -MemberType NoteProperty -Name ContainerFolder -Value (Split-Path $RelativePath)
45+
46+
Write-Output $artifact
47+
}
48+
}
49+
}
50+
}
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# This script translates all the artifacts described by _all.ps1
2+
# into commands that instruct Azure Pipelines to actually collect those artifacts.
3+
4+
param (
5+
[string]$ArtifactNameSuffix
6+
)
7+
8+
& "$PSScriptRoot/_stage_all.ps1" -ArtifactNameSuffix $ArtifactNameSuffix |% {
9+
Write-Host "##vso[artifact.upload containerfolder=$($_.Name);artifactname=$($_.Name);]$($_.Path)"
10+
}

0 commit comments

Comments
 (0)