Skip to content

Commit c0bf441

Browse files
committed
Switch to GitHub Actions for CI/PR builds
1 parent 9d2e900 commit c0bf441

34 files changed

+743
-235
lines changed

.github/workflows/build.yml

+97
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
- maint.*
8+
- validate/*
9+
pull_request:
10+
11+
env:
12+
TreatWarningsAsErrors: true
13+
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
14+
BUILDCONFIGURATION: Release
15+
CODECOV_TOKEN: a26c421a-824d-4a30-933b-47b2a203587f
16+
NUGET_PACKAGES: ${{ github.workspace }}/.nuget/packages
17+
18+
jobs:
19+
leak_check:
20+
name: Leak check (ubuntu-18.04)
21+
runs-on: ubuntu-18.04
22+
steps:
23+
- uses: actions/checkout@v2
24+
with:
25+
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.
26+
- name: Install prerequisites
27+
run: ./init.ps1 -UpgradePrerequisites
28+
shell: pwsh
29+
- name: Test
30+
run: dotnet test LibGit2Sharp.Tests --no-restore -c ${{ env.BUILDCONFIGURATION }} --filter "TestCategory!=FailsInCloudTest" -v m /p:ExtraDefine=LEAKS_IDENTIFYING -f netcoreapp2.1
31+
32+
build:
33+
runs-on: ${{ matrix.os }}
34+
strategy:
35+
fail-fast: false
36+
matrix:
37+
os:
38+
- ubuntu-18.04
39+
- macos-latest
40+
- windows-latest
41+
42+
steps:
43+
- uses: actions/checkout@v2
44+
with:
45+
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.
46+
- name: Install prerequisites
47+
run: |
48+
./init.ps1 -UpgradePrerequisites
49+
dotnet --info
50+
shell: pwsh
51+
- name: Build
52+
run: dotnet build --no-restore -c ${{ env.BUILDCONFIGURATION }} /v:m /bl:"bin/build_logs/build.binlog"
53+
- name: Pack
54+
run: dotnet pack --no-build -c ${{ env.BUILDCONFIGURATION }} /v:m /bl:"bin/build_logs/pack.binlog"
55+
if: runner.os == 'Windows'
56+
- name: Test everything
57+
run: dotnet test --no-build -c ${{ env.BUILDCONFIGURATION }} /bl:"bin/build_logs/test.binlog" --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true
58+
if: runner.os == 'Windows'
59+
- name: Test .NET Core
60+
run: dotnet test --no-build -c ${{ env.BUILDCONFIGURATION }} /bl:"bin/build_logs/test.binlog" --filter "TestCategory!=FailsInCloudTest" -v n /p:CollectCoverage=true -f netcoreapp2.1
61+
if: runner.os != 'Windows'
62+
- name: Collect artifacts
63+
run: azure-pipelines/artifacts/_stage_all.ps1
64+
shell: pwsh
65+
if: always()
66+
- name: Upload project.assets.json files
67+
if: always()
68+
uses: actions/upload-artifact@v1
69+
with:
70+
name: projectAssetsJson-${{ runner.os }}
71+
path: obj/_artifacts/projectAssetsJson
72+
continue-on-error: true
73+
- name: Upload build_logs
74+
if: always()
75+
uses: actions/upload-artifact@v1
76+
with:
77+
name: build_logs-${{ runner.os }}
78+
path: obj/_artifacts/build_logs
79+
continue-on-error: true
80+
- name: Upload coverageResults
81+
if: always()
82+
uses: actions/upload-artifact@v1
83+
with:
84+
name: coverageResults-${{ runner.os }}
85+
path: obj/_artifacts/coverageResults
86+
continue-on-error: true
87+
- name: Upload deployables
88+
uses: actions/upload-artifact@v1
89+
with:
90+
name: deployables
91+
path: obj/_artifacts/deployables
92+
if: runner.os == 'Windows'
93+
- name: Publish code coverage results to codecov.io
94+
run: bash <(curl -s https://codecov.io/bash)
95+
shell: bash
96+
timeout-minutes: 3
97+
continue-on-error: true

.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" /> Disabled because CanProbeForNativeBinariesFromAShadowCopiedAssembly fails. -->
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/LibGit2Sharp.csproj

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828

2929
<ItemGroup>
3030
<PackageReference Include="LibGit2Sharp.NativeBinaries" Version="[2.0.305]" PrivateAssets="none" />
31-
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta-63127-02" PrivateAssets="all" />
32-
<PackageReference Include="Nerdbank.GitVersioning" Version="2.3.138" PrivateAssets="all" />
31+
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="all" />
32+
<PackageReference Include="Nerdbank.GitVersioning" Version="3.0.50" PrivateAssets="all" />
3333
</ItemGroup>
3434

3535
<Import Project="..\Targets\CodeGenerator.targets" />

appveyor.yml

+2-158
Original file line numberDiff line numberDiff line change
@@ -1,158 +1,2 @@
1-
version: '{build}'
2-
3-
os: Visual Studio 2019
4-
5-
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
1+
# Disable AppVeyor
2+
build: off

azure-pipelines.yml

+15-29
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,20 @@
11
trigger:
2-
- master
3-
- maint/*
2+
branches:
3+
include:
4+
- master
5+
- 'maint.*'
6+
paths:
7+
exclude:
8+
- doc/
9+
- '*.md'
10+
- .vscode/
411

512
variables:
6-
solution: '**/*.sln'
7-
buildPlatform: 'Any CPU'
8-
buildConfiguration: 'Release'
13+
TreatWarningsAsErrors: true
14+
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
15+
BuildConfiguration: Release
16+
codecov_token: a26c421a-824d-4a30-933b-47b2a203587f
17+
NUGET_PACKAGES: $(Agent.TempDirectory)/.nuget/packages
918

1019
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
20+
- template: azure-pipelines/build.yml

0 commit comments

Comments
 (0)