Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
a46b5cb
Support libssh2 based callbacks
zentron Mar 4, 2026
3950c0c
Cleanup and add overload for ListRemoteReferences
eddymoulton Mar 18, 2026
a3c1582
Use pre-release nativebinaries
eddymoulton Mar 20, 2026
9bce3ac
Add missing update refs to GitRemoteCallbacks
eddymoulton Mar 23, 2026
d80ecf1
Tidy
eddymoulton Mar 26, 2026
f0941f8
Update binaries
eddymoulton Mar 26, 2026
fecdfb8
Update pre-release v
eddymoulton Mar 26, 2026
a615627
Fix struct definition
eddymoulton Mar 27, 2026
eba3dbb
Remove test that won't pass
eddymoulton Mar 27, 2026
b63cd69
Updates for new libgit2
eddymoulton Mar 27, 2026
cdd1844
Remove 20.04 (EOL)
eddymoulton Mar 27, 2026
05451e3
Update all distros and remove old
eddymoulton Mar 27, 2026
1a6757b
Copy extra dlls
eddymoulton Mar 27, 2026
2d1474b
Capture output for win debugging
eddymoulton Mar 27, 2026
3b56e41
Add library path to DLL search path to handle bundle dependencies on …
eddymoulton Mar 27, 2026
161d508
Use Octopus native binaries
eddymoulton Mar 27, 2026
3a11a0a
Update version
eddymoulton Mar 27, 2026
3bd1121
Separate version for branchess
eddymoulton Mar 27, 2026
5a0f7d8
Update GH workflow
eddymoulton Mar 27, 2026
00a9030
Remove the octopus in the branch version name since it should be ther…
eddymoulton Mar 27, 2026
97fa530
Change native binaries version
eddymoulton Apr 2, 2026
781c80b
Update dep
eddymoulton Apr 2, 2026
677e025
Use wincng build of nb
eddymoulton Apr 7, 2026
e4cfeb6
Fix native binary interface
eddymoulton Apr 15, 2026
16289eb
idea folder updates
eddymoulton Apr 15, 2026
adedb4b
Tidy code
eddymoulton Apr 15, 2026
7c7d0b9
Update to latest native binaries
eddymoulton Apr 15, 2026
a2f588e
Set workdir explicitly
eddymoulton Apr 16, 2026
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
245 changes: 129 additions & 116 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,120 +1,133 @@
name: CI
on:
push:
branches: [master, release-*]
tags:
- '[0-9]+.[0-9]+.[0-9]+'
- '[0-9]+.[0-9]+.[0-9]+-*'
pull_request:
workflow_dispatch:
push:
branches: [master, release-*]
tags:
- "[0-9]+.[0-9]+.[0-9]+"
- "[0-9]+.[0-9]+.[0-9]+-*"
pull_request:
workflow_dispatch:
env:
DOTNET_NOLOGO: true
DOTNET_NOLOGO: true
jobs:
build:
name: Build
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4.1.2
with:
fetch-depth: 0
- name: Install .NET SDK
uses: actions/setup-dotnet@v4.0.0
with:
dotnet-version: 9.0.x
- name: Build
run: dotnet build LibGit2Sharp.sln --configuration Release
- name: Upload packages
uses: actions/upload-artifact@v4.3.1
with:
name: NuGet packages
path: artifacts/package/
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-2022, macos-14 ]
tfm: [ net472, net8.0, net9.0 ]
exclude:
- os: macos-14
tfm: net472
include:
- arch: arm64
os: macos-14
tfm: net8.0
- arch: arm64
os: macos-14
tfm: net9.0
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v4.1.2
with:
fetch-depth: 0
- name: Install .NET SDK
uses: actions/setup-dotnet@v4.0.0
with:
dotnet-version: |
9.0.x
8.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:
name: Test / ${{ matrix.distro }} / ${{ matrix.arch }} / ${{ matrix.tfm }}
runs-on: ${{ matrix.runnerImage }}
strategy:
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' ]
exclude:
- distro: alpine.3.17
sdk: '9.0'
- distro: alpine.3.18
sdk: '9.0'
- distro: alpine.3.19
sdk: '9.0'
include:
- sdk: '8.0'
tfm: net8.0
- sdk: '9.0'
tfm: net9.0
- arch: amd64
runnerImage: ubuntu-22.04
- arch: arm64
runnerImage: ubuntu-22.04-arm
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v4.1.2
with:
fetch-depth: 0
- name: Run ${{ matrix.tfm }} tests
run: |
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"
build:
name: Build
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Install .NET SDK
uses: actions/setup-dotnet@v5
with:
dotnet-version: 9.0.x
- name: Compute version suffix for branch builds
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
id: version
run: |
# Sanitize branch name: lowercase, replace non-alphanumeric with hyphen, trim to 20 chars
BRANCH="${GITHUB_HEAD_REF:-${GITHUB_REF_NAME}}"
SAFE_BRANCH=$(echo "$BRANCH" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9]/-/g' | sed 's/--*/-/g' | sed 's/^-//' | sed 's/-$//' | cut -c1-20)
echo "override=${SAFE_BRANCH}.${{ github.run_number }}" >> "$GITHUB_OUTPUT"
- name: Build
run: dotnet build LibGit2Sharp.sln --configuration Release ${{ steps.version.outputs.override && format('/p:MinVerDefaultPreReleaseIdentifiers="{0}"', steps.version.outputs.override) || '' }}
- name: Upload packages
uses: actions/upload-artifact@v7
with:
name: NuGet packages
path: artifacts/package/
retention-days: 7
- name: Verify trimming compatibility
run: dotnet publish TrimmingTestApp

test:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
Comment on lines +13 to +43
name: Test / ${{ matrix.os }} / ${{ matrix.arch }} / ${{ matrix.tfm }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
arch: [x64]
os: [windows-2022, macos-14]
tfm: [net472, net8.0, net9.0]
exclude:
- os: macos-14
tfm: net472
include:
- arch: arm64
os: macos-14
tfm: net8.0
- arch: arm64
os: macos-14
tfm: net9.0
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Install .NET SDK
uses: actions/setup-dotnet@v5
with:
dotnet-version: |
9.0.x
8.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:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
Comment on lines +44 to +75
name: Test / ${{ matrix.distro }} / ${{ matrix.arch }} / ${{ matrix.tfm }}
runs-on: ${{ matrix.runnerImage }}
strategy:
matrix:
arch: [amd64, arm64]
distro:
[
alpine.3.20,
alpine.3.21,
alpine.3.22,
centos.stream.9,
debian.12,
fedora.41,
fedora.42,
ubuntu.22.04,
ubuntu.24.04,
]
sdk: ["8.0", "9.0"]
include:
- sdk: "8.0"
tfm: net8.0
- sdk: "9.0"
tfm: net9.0
- arch: amd64
runnerImage: ubuntu-22.04
- arch: arm64
runnerImage: ubuntu-22.04-arm
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Run ${{ matrix.tfm }} tests
run: |
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" -w /app -e OPENSSL_ENABLE_SHA1_SIGNATURES=1 gittools/build-images:${{ matrix.distro }}-sdk-${{ matrix.sdk }} sh -c "$git_command && $test_command"

nuget-push:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
Comment on lines +76 to +115
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@v8

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" --skip-duplicate

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {}
Comment on lines +116 to +132
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ _ReSharper*/
*.swp
*.DotSettings

.idea/
_NCrunch_LibGit2Sharp/
artifacts/
worktree.playlist
4 changes: 3 additions & 1 deletion .idea/.idea.LibGit2Sharp/.idea/indexLayout.xml

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

15 changes: 8 additions & 7 deletions LibGit2Sharp.Tests/GlobalSettingsFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ public void LoadFromSpecifiedPath(string architecture)
{
Skip.IfNot(Platform.IsRunningOnNetFramework(), ".NET Framework only test.");

var nativeDllFileName = NativeDllName.Name + ".dll";
var testDir = Path.GetDirectoryName(typeof(GlobalSettingsFixture).Assembly.Location);
var testAppExe = Path.Combine(testDir, $"NativeLibraryLoadTestApp.{architecture}.exe");
var tempDir = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
Expand All @@ -71,12 +70,14 @@ public void LoadFromSpecifiedPath(string architecture)
try
{
Directory.CreateDirectory(platformDir);
File.Copy(Path.Combine(libraryPath, nativeDllFileName), Path.Combine(platformDir, nativeDllFileName));
foreach (var file in Directory.GetFiles(libraryPath, "*.dll"))
{
File.Copy(file, Path.Combine(platformDir, Path.GetFileName(file)));
}

var (output, exitCode) = ProcessHelper.RunProcess(testAppExe, arguments: $@"{NativeDllName.Name} ""{platformDir}""", workingDirectory: tempDir);

Assert.Empty(output);
Assert.Equal(0, exitCode);
Assert.True(exitCode == 0, $"Test app exited with code {exitCode}. Output: {output}");
}
finally
{
Expand All @@ -90,17 +91,17 @@ public void SetExtensions()
var extensions = GlobalSettings.GetExtensions();

// Assert that "noop" is supported by default
Assert.Equal(new[] { "noop", "objectformat", "worktreeconfig" }, extensions);
Assert.Equal(new[] { "noop", "objectformat", "preciousobjects", "worktreeconfig" }, extensions);

// Disable "noop" extensions
GlobalSettings.SetExtensions("!noop");
extensions = GlobalSettings.GetExtensions();
Assert.Equal(new[] { "objectformat", "worktreeconfig" }, extensions);
Assert.Equal(new[] { "objectformat", "preciousobjects", "worktreeconfig" }, extensions);

// Enable two new extensions (it will reset the configuration and "noop" will be enabled)
GlobalSettings.SetExtensions("partialclone", "newext");
extensions = GlobalSettings.GetExtensions();
Assert.Equal(new[] { "newext", "noop", "objectformat", "partialclone", "worktreeconfig" }, extensions);
Assert.Equal(new[] { "newext", "noop", "objectformat", "partialclone", "preciousobjects", "worktreeconfig" }, extensions);
}

[Fact]
Expand Down
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;net6.0;net8.0;net9.0</TargetFrameworks>
<TargetFrameworks Condition="'$(TargetFrameworks)'==''">net472;net8.0;net9.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
Expand Down
1 change: 0 additions & 1 deletion LibGit2Sharp.Tests/NetworkFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ public void CanListRemoteReferences(string url)
Remote remote = repo.Network.Remotes.Add(remoteName, url);
IList<Reference> references = repo.Network.ListReferences(remote).ToList();


foreach (var reference in references)
{
// None of those references point to an existing
Expand Down
3 changes: 3 additions & 0 deletions LibGit2Sharp.Tests/TestHelpers/ProcessHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ public static (string, int) RunProcess(string fileName, string arguments, string

process.Start();

process.BeginOutputReadLine();
process.BeginErrorReadLine();

process.WaitForExit();

return (output.ToString(), process.ExitCode);
Expand Down
Loading
Loading