Skip to content

Commit 8ae9922

Browse files
authored
Merge pull request #2026 from libgit2/ci-updates
Workflow and TFM updates
2 parents d064794 + 48460d0 commit 8ae9922

File tree

7 files changed

+43
-52
lines changed

7 files changed

+43
-52
lines changed

.github/workflows/ci.yml

Lines changed: 23 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,20 @@ env:
1212
jobs:
1313
build:
1414
name: Build
15-
runs-on: ubuntu-20.04
15+
runs-on: ubuntu-22.04
1616
steps:
1717
- name: Checkout
18-
uses: actions/checkout@v2.3.4
18+
uses: actions/checkout@v3.5.0
1919
with:
2020
fetch-depth: 0
2121
- name: Install .NET SDK
22-
uses: actions/setup-dotnet@v1.8.1
22+
uses: actions/setup-dotnet@v3.0.3
2323
with:
24-
dotnet-version: 6.0.x
24+
dotnet-version: 7.0.x
2525
- name: Build
2626
run: dotnet build LibGit2Sharp.sln --configuration Release
2727
- name: Upload packages
28-
uses: actions/upload-artifact@v2.2.4
28+
uses: actions/upload-artifact@v3.1.2
2929
with:
3030
name: NuGet packages
3131
path: bin/Packages/
@@ -36,57 +36,48 @@ jobs:
3636
strategy:
3737
matrix:
3838
arch: [ amd64 ]
39-
os: [windows-2019, macos-10.15]
40-
tfm: [ net472, netcoreapp3.1, net6.0 ]
39+
os: [ windows-2019, macos-11 ]
40+
tfm: [ net472, net6.0, net7.0 ]
4141
exclude:
42-
- os: macos-10.15
42+
- os: macos-11
4343
tfm: net472
4444
fail-fast: false
4545
steps:
4646
- name: Checkout
47-
uses: actions/checkout@v2.3.4
47+
uses: actions/checkout@v3.5.0
4848
with:
4949
fetch-depth: 0
5050
- name: Install .NET SDK
51-
uses: actions/setup-dotnet@v1.8.1
51+
uses: actions/setup-dotnet@v3.0.3
5252
with:
53-
dotnet-version: 6.0.x
54-
- name: Install .NET Core 3.1 runtime
55-
if: matrix.tfm == 'netcoreapp3.1'
56-
uses: actions/[email protected]
57-
with:
58-
dotnet-version: 3.1.x
53+
dotnet-version: |
54+
7.0.x
55+
6.0.x
5956
- name: Run ${{ matrix.tfm }} tests
6057
run: dotnet test LibGit2Sharp.sln --configuration Release --framework ${{ matrix.tfm }} --logger "GitHubActions" /p:ExtraDefine=LEAKS_IDENTIFYING
6158
test-linux:
6259
name: Test / ${{ matrix.distro }} / ${{ matrix.arch }} / ${{ matrix.tfm }}
63-
runs-on: ubuntu-20.04
60+
runs-on: ubuntu-22.04
6461
strategy:
6562
matrix:
6663
arch: [ amd64 ]
6764
# arch: [ amd64, arm64 ]
68-
distro: [ alpine.3.12, alpine.3.13, alpine.3.14, centos.7, centos.8, debian.9, debian.10, debian.11, fedora.33, ubuntu.18.04, ubuntu.20.04 ]
69-
sdk: [ '6.0', '3.1' ]
65+
distro: [ alpine.3.13, alpine.3.14, alpine.3.15, alpine.3.16, alpine.3.17, centos.7, centos.stream.8, debian.10, debian.11, fedora.36, ubuntu.18.04, ubuntu.20.04, ubuntu.22.04 ]
66+
sdk: [ '6.0', '7.0' ]
7067
exclude:
71-
- arch: arm64
72-
distro: alpine.3.12
73-
- arch: arm64
74-
distro: alpine.3.13
75-
sdk: '3.1'
76-
- arch: arm64
77-
distro: alpine.3.14
78-
sdk: '3.1'
79-
- arch: arm64
80-
distro: centos.7
68+
- distro: alpine.3.13
69+
sdk: '7.0'
70+
- distro: alpine.3.14
71+
sdk: '7.0'
8172
include:
8273
- sdk: '6.0'
8374
tfm: net6.0
84-
- sdk: '3.1'
85-
tfm: netcoreapp3.1
75+
- sdk: '7.0'
76+
tfm: net7.0
8677
fail-fast: false
8778
steps:
8879
- name: Checkout
89-
uses: actions/checkout@v2.3.4
80+
uses: actions/checkout@v3.5.0
9081
with:
9182
fetch-depth: 0
9283
- name: Setup QEMU

LibGit2Sharp.Tests/BlobFixture.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public void CanGetBlobAsFilteredText(string autocrlf, string expectedText)
4545
}
4646
}
4747

48-
#if NETFRAMEWORK || NETCOREAPP3_1 //UTF-7 is disabled in .NET 5+
48+
#if NETFRAMEWORK //UTF-7 is disabled in .NET 5+
4949
[Theory]
5050
[InlineData("ascii", 4, "31 32 33 34")]
5151
[InlineData("utf-7", 4, "31 32 33 34")]
@@ -239,11 +239,11 @@ public void CanTellIfABlobIsMissing()
239239
// Manually delete the objects directory to simulate a partial clone
240240
Directory.Delete(Path.Combine(repoPath, "objects", "a8"), true);
241241

242-
using (var repo = new Repository(repoPath))
242+
using (var repo = new Repository(repoPath))
243243
{
244244
// Look up for the tree that reference the blob which is now missing
245245
var tree = repo.Lookup<Tree>("fd093bff70906175335656e6ce6ae05783708765");
246-
var blob = (Blob) tree["README"].Target;
246+
var blob = (Blob)tree["README"].Target;
247247

248248
Assert.Equal("a8233120f6ad708f843d861ce2b7228ec4e3dec6", blob.Sha);
249249
Assert.NotNull(blob);

LibGit2Sharp.Tests/LibGit2Sharp.Tests.csproj

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks Condition="'$(TargetFrameworks)'==''">net472;netcoreapp3.1;net6.0</TargetFrameworks>
4+
<TargetFrameworks Condition="'$(TargetFrameworks)'==''">net472;net6.0;net7.0</TargetFrameworks>
55
</PropertyGroup>
66

77
<ItemGroup>
@@ -11,12 +11,12 @@
1111
</ItemGroup>
1212

1313
<ItemGroup>
14-
<PackageReference Include="GitHubActionsTestLogger" Version="1.2.0" />
15-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.11.0" />
16-
<PackageReference Include="Moq" Version="4.16.1" />
17-
<PackageReference Include="xunit" Version="2.4.1" />
18-
<PackageReference Include="xunit.runner.console" Version="2.4.1" />
19-
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3" />
14+
<PackageReference Include="GitHubActionsTestLogger" Version="2.0.1" />
15+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
16+
<PackageReference Include="Moq" Version="4.18.4" />
17+
<PackageReference Include="xunit" Version="2.4.2" />
18+
<PackageReference Include="xunit.runner.console" Version="2.4.2" />
19+
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5" />
2020
<PackageReference Include="xunit.skippablefact" Version="1.4.13" />
2121
</ItemGroup>
2222

LibGit2Sharp/Core/NativeMethods.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ private static string GetGlobalSettingsNativeLibraryPath()
6666
return Path.Combine(nativeLibraryDir, libgit2 + Platform.GetNativeLibraryExtension());
6767
}
6868

69-
#if NETSTANDARD
69+
#if NETFRAMEWORK
7070
private static bool TryUseNativeLibrary() => false;
7171
#else
7272
private static bool TryUseNativeLibrary()

LibGit2Sharp/GlobalSettings.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public static class GlobalSettings
2020

2121
private static string nativeLibraryPath;
2222
private static bool nativeLibraryPathLocked;
23-
private static string nativeLibraryDefaultPath;
23+
private static readonly string nativeLibraryDefaultPath = null;
2424

2525
static GlobalSettings()
2626
{
@@ -29,19 +29,18 @@ static GlobalSettings()
2929

3030
nativeLibraryPathAllowed = netFX || netCore;
3131

32+
#if NETFRAMEWORK
3233
if (netFX)
3334
{
3435
// For .NET Framework apps the dependencies are deployed to lib/win32/{architecture} directory
3536
nativeLibraryDefaultPath = Path.Combine(GetExecutingAssemblyDirectory(), "lib", "win32", Platform.ProcessorArchitecture);
3637
}
37-
else
38-
{
39-
nativeLibraryDefaultPath = null;
40-
}
38+
#endif
4139

4240
registeredFilters = new Dictionary<Filter, FilterRegistration>();
4341
}
4442

43+
#if NETFRAMEWORK
4544
private static string GetExecutingAssemblyDirectory()
4645
{
4746
// Assembly.CodeBase is not actually a correctly formatted
@@ -66,6 +65,7 @@ private static string GetExecutingAssemblyDirectory()
6665
managedPath = Path.GetDirectoryName(managedPath);
6766
return managedPath;
6867
}
68+
#endif
6969

7070
/// <summary>
7171
/// Returns information related to the current LibGit2Sharp

LibGit2Sharp/LibGit2Sharp.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>netstandard2.0;netcoreapp3.1</TargetFrameworks>
4+
<TargetFrameworks>net472;net6.0</TargetFrameworks>
55
<GenerateDocumentationFile>true</GenerateDocumentationFile>
66
<Description>LibGit2Sharp brings all the might and speed of libgit2, a native Git implementation, to the managed world of .NET</Description>
77
<Company>LibGit2Sharp contributors</Company>
@@ -31,7 +31,7 @@
3131

3232
<ItemGroup>
3333
<PackageReference Include="LibGit2Sharp.NativeBinaries" Version="[2.0.319]" PrivateAssets="none" />
34-
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="all" />
34+
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1" PrivateAssets="all" />
3535
<PackageReference Include="Nerdbank.GitVersioning" Version="3.4.220" PrivateAssets="all" />
3636
</ItemGroup>
3737

LibGit2Sharp/ObjectDatabase.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,10 +315,10 @@ private unsafe Blob CreateBlob(Stream stream, string hintpath, long? numberOfByt
315315
throw new EndOfStreamException("The stream ended unexpectedly");
316316
}
317317
}
318-
catch(Exception e)
318+
catch (Exception)
319319
{
320320
writestream.free(writestream_ptr);
321-
throw e;
321+
throw;
322322
}
323323

324324
ObjectId id = Proxy.git_blob_create_fromstream_commit(writestream_ptr);

0 commit comments

Comments
 (0)