Skip to content
Draft
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
16 changes: 8 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ jobs:
uses: actions/checkout@v6
with:
fetch-depth: 0 # Get all the history so MinGit can compute the version
- name: Set up latest .NET 8.0
- name: Set up latest .NET 10.0
uses: actions/setup-dotnet@v5
with:
dotnet-version: "8.0.x"
dotnet-version: '10.0.x'
- run: dotnet pack NGitLab.sln --configuration Release --output ${{env.NuGetDirectory}} /bl
- uses: actions/upload-artifact@v6
with:
Expand All @@ -55,8 +55,8 @@ jobs:
strategy:
matrix:
gitlab:
# Keep in sync with the version in GitLabDockerContainer.cs
# Available tags: https://hub.docker.com/r/gitlab/gitlab-ee/tags?name=-ee.0
# Keep in sync with the version in GitLabDockerContainer.cs
# Available tags: https://hub.docker.com/r/gitlab/gitlab-ee/tags
- "gitlab/gitlab-ee:16.11.10-ee.0"
- "gitlab/gitlab-ee:17.1.8-ee.0"
configuration: [Release]
Expand All @@ -72,10 +72,10 @@ jobs:
steps:
- name: Check out code
uses: actions/checkout@v6
- name: Set up latest .NET 8.0
- name: Set up latest .NET 10.0
uses: actions/setup-dotnet@v5
with:
dotnet-version: "8.0.x"
dotnet-version: '10.0.x'
- name: Set artifact name
id: set-artifact-name
run: |
Expand Down Expand Up @@ -111,10 +111,10 @@ jobs:
with:
name: nuget
path: ${{env.NuGetDirectory}}
- name: Set up latest .NET 8.0
- name: Set up latest .NET 10.0
uses: actions/setup-dotnet@v5
with:
dotnet-version: "8.0.x"
dotnet-version: '10.0.x'
- name: Publish NuGet packages
run: |
Write-Host "Current ref: $env:GITHUB_REF"
Expand Down
2 changes: 1 addition & 1 deletion NGitLab.Mock.Tests/NGitLab.Mock.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net8.0;net472</TargetFrameworks>
<TargetFrameworks>net10.0;net472</TargetFrameworks>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion NGitLab.Mock/NGitLab.Mock.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net472;net6.0</TargetFrameworks>
<TargetFrameworks>net472;net10.0</TargetFrameworks>
<Description>GitLab REST API .NET Client Mock Library</Description>
</PropertyGroup>
<ItemGroup>
Expand Down
8 changes: 4 additions & 4 deletions NGitLab.Tests/MembersClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -184,14 +184,14 @@ public async Task AsyncMethodsBehaveAsExpected()
// Does NOT search inherited permission by default...
AssertThrowsGitLabException(() => client.Members.GetMemberOfProjectAsync(projectId, user1.Id), System.Net.HttpStatusCode.NotFound);
AssertThrowsGitLabException(() => client.Members.GetMemberOfGroupAsync(groupId, user1.Id), System.Net.HttpStatusCode.NotFound);
Assert.That(client.Members.OfProjectAsync(projectId).Select(m => m.UserName), Is.Empty);
Assert.That(client.Members.OfGroupAsync(groupId).Select(m => m.UserName), Is.EquivalentTo(new[] { ownerName }));
Assert.That(client.Members.OfProjectAsync(projectId).ToList().Select(m => m.UserName), Is.Empty);
Assert.That(client.Members.OfGroupAsync(groupId).ToList().Select(m => m.UserName), Is.EquivalentTo(new[] { ownerName }));

// Does search inherited permission when asked...
await client.Members.GetMemberOfProjectAsync(projectId, user1.Id, includeInheritedMembers: true);
await client.Members.GetMemberOfGroupAsync(groupId, user1.Id, includeInheritedMembers: true);
Assert.That(client.Members.OfProjectAsync(projectId, includeInheritedMembers: true).Select(m => m.UserName), Is.EquivalentTo(new[] { ownerName, user1Name }));
Assert.That(client.Members.OfGroupAsync(groupId, includeInheritedMembers: true).Select(m => m.UserName), Is.EquivalentTo(new[] { ownerName, user1Name }));
Assert.That(client.Members.OfProjectAsync(projectId, includeInheritedMembers: true).ToList().Select(m => m.UserName), Is.EquivalentTo(new[] { ownerName, user1Name }));
Assert.That(client.Members.OfGroupAsync(groupId, includeInheritedMembers: true).ToList().Select(m => m.UserName), Is.EquivalentTo(new[] { ownerName, user1Name }));

// Cannot update non-existent membership...
AssertThrowsGitLabException(() => client.Members.UpdateMemberOfProjectAsync(projectId, new() { UserId = user1Id, AccessLevel = AccessLevel.Owner }), System.Net.HttpStatusCode.NotFound);
Expand Down
3 changes: 1 addition & 2 deletions NGitLab.Tests/NGitLab.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
Expand All @@ -22,7 +22,6 @@
<PackageReference Include="NUnit3TestAdapter" Version="5.2.0" />
<PackageReference Include="NSubstitute" Version="5.3.0" />
<PackageReference Include="Polly" Version="8.6.5" />
<PackageReference Include="System.Text.Json" Version="8.0.5" />
<PackageReference Include="coverlet.collector" Version="6.0.4">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
Expand Down
47 changes: 47 additions & 0 deletions NGitLab/Extensions/CompilerFeatureRequiredAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#if NETFRAMEWORK || NETSTANDARD2_0
#nullable enable
#pragma warning disable

using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;

namespace System.Runtime.CompilerServices
{


/// <summary>
/// Indicates that compiler support for a particular feature is required for the location where this attribute is applied.
/// </summary>
[AttributeUsage(AttributeTargets.All, AllowMultiple = true, Inherited = false)]
public sealed class CompilerFeatureRequiredAttribute : Attribute
{
public CompilerFeatureRequiredAttribute(string featureName)
{
FeatureName = featureName;
}

/// <summary>
/// The name of the compiler feature.
/// </summary>
public string FeatureName { get; }

/// <summary>
/// If true, the compiler can choose to allow access to the location where this attribute is applied if it does not understand <see cref="FeatureName"/>.
/// </summary>
public bool IsOptional { get; init; }

/// <summary>
/// The <see cref="FeatureName"/> used for the ref structs C# feature.
/// </summary>
public const string RefStructs = nameof(RefStructs);

/// <summary>
/// The <see cref="FeatureName"/> used for the required members C# feature.
/// </summary>
public const string RequiredMembers = nameof(RequiredMembers);
}
}

#pragma warning restore
#nullable restore
#endif //NETFRAMEWORK
28 changes: 28 additions & 0 deletions NGitLab/Extensions/IsExternalInit.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#if NETFRAMEWORK || NETSTANDARD2_0
#nullable enable
#pragma warning disable

namespace System.Runtime.CompilerServices
{
using global::System.Diagnostics;
using global::System.Diagnostics.CodeAnalysis;

/// <summary>
/// Reserved to be used by the compiler for tracking metadata.
/// This class should not be used by developers in source code.
/// </summary>
/// <remarks>
/// This definition is provided by the <i>IsExternalInit</i> NuGet package (https://www.nuget.org/packages/IsExternalInit).
/// Please see https://github.com/manuelroemer/IsExternalInit for more information.
/// </remarks>
#if !ISEXTERNALINIT_INCLUDE_IN_CODE_COVERAGE
[ExcludeFromCodeCoverage, DebuggerNonUserCode]
#endif
internal static class IsExternalInit
{
}
}

#pragma warning restore
#nullable restore
#endif //NETFRAMEWORK
18 changes: 18 additions & 0 deletions NGitLab/Extensions/RequiredMemberAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#if NETFRAMEWORK || NETSTANDARD2_0
#nullable enable
#pragma warning disable

using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;

namespace System.Runtime.CompilerServices
{

[DebuggerNonUserCode]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Field | AttributeTargets.Property, AllowMultiple = false, Inherited = false)]
internal sealed class RequiredMemberAttribute : Attribute { }
}

#pragma warning restore
#nullable restore
#endif //NETFRAMEWORK
2 changes: 2 additions & 0 deletions NGitLab/Impl/HttpRequestor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@ public partial class HttpRequestor : IHttpRequestor

static HttpRequestor()
{
#if NET472
// By default only Sssl and Tls 1.0 is enabled with .NET 4.5
// We add Tls 1.2 and Tls 1.2 without affecting the other values in case new protocols are added in the future
// (see https://stackoverflow.com/questions/28286086/default-securityprotocol-in-net-4-5)
ServicePointManager.SecurityProtocol |= SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
#endif
}

public HttpRequestor(string hostUrl, string apiToken, MethodType methodType)
Expand Down
20 changes: 11 additions & 9 deletions NGitLab/NGitLab.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net472;netstandard2.0;net8.0</TargetFrameworks>
<TargetFrameworks>net472;netstandard2.0;net8.0;net10.0</TargetFrameworks>
<PublishAot Condition="$(TargetFramework) == 'net10.0'">true</PublishAot>
<PublishAot Condition="$(TargetFramework) == 'net8.0'">true</PublishAot>
<!-- Keep "WebRequest is obsolete" as a warning -->
<WarningsNotAsErrors>$(WarningsNotAsErrors);SYSLIB0014</WarningsNotAsErrors>
</PropertyGroup>
Expand All @@ -12,15 +14,15 @@
</PackageReference>
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' != 'net8.0'">
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="8.0.0" />
<PackageReference Include="PolySharp" Version="1.15.0">
<ItemGroup Condition="$(TargetFramework) == 'net472' Or $(TargetFramework) == 'netstandard2.0' ">
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
<PackageReference Include="IndexRange" Version="1.1.0" />
<PackageReference Include="System.Text.Json" Version="10.0.0" />
<PackageReference Include="System.Net.Http" Version="4.3.4" />
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="System.ComponentModel.Annotations" Version="5.0.0" />
<PackageReference Include="System.Text.Json" Version="8.0.5" />
<Reference Include="System.Net.Http" Condition="'$(TargetFramework)' == 'net472'" />
</ItemGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions NGitLab/PublicAPI/net10.0/PublicAPI.Shipped.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Loading
Loading