Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 25 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,15 @@ jobs:
retention-days: 7
- name: Verify trimming compatibility
run: dotnet publish TrimmingTestApp

test:
name: Test / ${{ matrix.os }} / ${{ matrix.arch }} / ${{ matrix.tfm }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
arch: [ x64 ]
os: [ windows-2019, windows-2022, macos-13 ]
tfm: [ net472, net8.0, net9.0 ]
os: [ windows-2022, macos-13 ]
tfm: [ net472, net6.0, net8.0, net9.0 ]
exclude:
- os: macos-13
tfm: net472
Expand All @@ -62,6 +63,7 @@ jobs:
dotnet-version: |
9.0.x
8.0.x
6.0.x
- name: Run ${{ matrix.tfm }} tests
run: dotnet test LibGit2Sharp.sln --configuration Release --framework ${{ matrix.tfm }} --logger "GitHubActions" /p:ExtraDefine=LEAKS_IDENTIFYING
test-linux:
Expand All @@ -71,7 +73,7 @@ jobs:
matrix:
arch: [ amd64, arm64 ]
distro: [ alpine.3.17, alpine.3.18, alpine.3.19, alpine.3.20, centos.stream.9, debian.12, fedora.40, ubuntu.20.04, ubuntu.22.04, ubuntu.24.04 ]
sdk: [ '8.0', '9.0' ]
sdk: [ '6.0', '8.0', '9.0' ]
exclude:
- distro: alpine.3.17
sdk: '9.0'
Expand All @@ -80,6 +82,8 @@ jobs:
- distro: alpine.3.19
sdk: '9.0'
include:
- sdk: '6.0'
tfm: net6.0
- sdk: '8.0'
tfm: net8.0
- sdk: '9.0'
Expand All @@ -99,4 +103,21 @@ jobs:
git_command="git config --global --add safe.directory /app"
test_command="dotnet test LibGit2Sharp.sln --configuration Release -p:TargetFrameworks=${{ matrix.tfm }} --logger "GitHubActions" -p:ExtraDefine=LEAKS_IDENTIFYING"
docker run -t --rm --platform linux/${{ matrix.arch }} -v "$PWD:/app" -e OPENSSL_ENABLE_SHA1_SIGNATURES=1 gittools/build-images:${{ matrix.distro }}-sdk-${{ matrix.sdk }} sh -c "$git_command && $test_command"


nuget-push:
name: Octopus NuGet Push
needs: [build, test, test-linux]
# && github.ref == 'refs/heads/octopus/master'
if: github.actor != 'dependabot[bot]' && github.actor != 'dependabot-preview[bot]' && github.event_name != 'schedule'
runs-on: ubuntu-22.04
steps:
- uses: actions/download-artifact@v4
with:
path: staging
- name: Push package to feed 🐙
id: push-feed
shell: bash
env:
FEED_API_KEY: ${{ secrets.FEED_API_KEY }}
FEED_SOURCE: ${{ secrets.FEED_SOURCE }}
run: dotnet nuget push staging/**/*.nupkg --api-key "$FEED_API_KEY" --source "$FEED_SOURCE"
13 changes: 13 additions & 0 deletions .idea/.idea.LibGit2Sharp/.idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions .idea/.idea.LibGit2Sharp/.idea/.name

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/.idea.LibGit2Sharp/.idea/encodings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/.idea.LibGit2Sharp/.idea/indexLayout.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/.idea.LibGit2Sharp/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks Condition="'$(TargetFrameworks)'==''">net472;net8.0;net9.0</TargetFrameworks>
<TargetFrameworks Condition="'$(TargetFrameworks)'==''">net472;net6.0;net8.0;net9.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion LibGit2Sharp/Core/Ensure.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ private static unsafe void HandleError(int result)
Func<string, GitErrorCategory, LibGit2SharpException> exceptionBuilder;
if (!GitErrorsToLibGit2SharpExceptions.TryGetValue((GitErrorCode)result, out exceptionBuilder))
{
exceptionBuilder = (m, c) => new LibGit2SharpException(m, c);
exceptionBuilder = (m, c) => new LibGit2SharpException(m);
}

throw exceptionBuilder(errorMessage, errorCategory);
Expand Down
10 changes: 7 additions & 3 deletions LibGit2Sharp/LibGit2Sharp.csproj
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net472;net8.0</TargetFrameworks>
<LangVersion>12.0</LangVersion>
<TargetFrameworks>net472;net8.0;net6.0</TargetFrameworks>
<LangVersion>10.0</LangVersion>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<Description>LibGit2Sharp brings all the might and speed of libgit2, a native Git implementation, to the managed world of .NET</Description>
<Company>LibGit2Sharp contributors</Company>
Expand All @@ -19,14 +19,18 @@
<PackageReadmeFile>App_Readme/README.md</PackageReadmeFile>
<PackageLicenseFile>App_Readme/LICENSE.md</PackageLicenseFile>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageId>Octopus.LibGit2Sharp</PackageId>
<PackageOutputPath>$(ArtifactsPath)\package</PackageOutputPath>
<MinVerDefaultPreReleaseIdentifiers>preview.0</MinVerDefaultPreReleaseIdentifiers>
<MinVerDefaultPreReleaseIdentifiers>octopus.0</MinVerDefaultPreReleaseIdentifiers>
<MinVerBuildMetadata Condition="'$(libgit2_hash)' != ''">libgit2-$(libgit2_hash.Substring(0,7))</MinVerBuildMetadata>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetFramework)' == 'net8.0'">
<IsTrimmable>true</IsTrimmable>
</PropertyGroup>
<PropertyGroup Condition="'$(TargetFramework)' == 'net6.0'">
<IsTrimmable>true</IsTrimmable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="LibGit2Sharp.NativeBinaries" Version="[2.0.323]" PrivateAssets="none" />
Expand Down
4 changes: 4 additions & 0 deletions LibGit2Sharp/SmartSubtransportStream.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ private static int SetError(SmartSubtransportStream stream, Exception caught)
{
errorCode = ((NativeException)ret).ErrorCode;
}
else
{
Proxy.git_error_set_str(GitErrorCategory.Unknown, caught);
}

return (int)errorCode;
}
Expand Down
Loading