Skip to content
Closed
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
42 changes: 38 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ on:
- '[0-9]+.[0-9]+.[0-9]+-*'
pull_request:
workflow_dispatch:
schedule:
- cron: '0 15 * * *' # Run at 3 PM UTC (1 AM Melbourne AEST / 2 AM AEDT)
env:
DOTNET_NOLOGO: true
jobs:
Expand All @@ -23,7 +25,21 @@ jobs:
with:
dotnet-version: 9.0.x
- name: Build
run: dotnet build LibGit2Sharp.sln --configuration Release
run: |
# if it is a pull request build set the build identity to branchname.runnumber
if ("${{ github.event_name }}" -eq "pull_request" -and "${{ github.head_ref }}" -ne "") {
$branchName = "${{ github.head_ref }}" -replace '[/\\]', '-' -replace '[^a-zA-Z0-9\-]', ''

$env:BUILD_IDENTITY = "$branchName.${{ github.run_number }}"
}

# if it is a scheduled build set the build identity to nightly
if ("${{ github.event_name }}" -eq "schedule") {
$env:BUILD_IDENTITY = "nightly.${{ github.run_number }}"
}

dotnet build LibGit2Sharp.sln --configuration Release
shell: pwsh
- name: Upload packages
uses: actions/upload-artifact@v4.3.1
with:
Expand All @@ -32,16 +48,17 @@ 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 ]
os: [ windows-2022, macos-14 ]
tfm: [ net472, net8.0, net9.0 ]
exclude:
- os: macos-13
- os: macos-14
tfm: net472
include:
- arch: arm64
Expand Down Expand Up @@ -99,4 +116,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]'
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
7 changes: 6 additions & 1 deletion LibGit2Sharp/LibGit2Sharp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,20 @@
<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="'$(BUILD_IDENTITY)' != ''">
<MinVerDefaultPreReleaseIdentifiers>octopus-$(BUILD_IDENTITY)</MinVerDefaultPreReleaseIdentifiers>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="LibGit2Sharp.NativeBinaries" Version="[2.0.323]" PrivateAssets="none" />
<PackageReference Include="MinVer" Version="6.0.0" PrivateAssets="all" />
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