Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update to net 9 #17

Merged
merged 3 commits into from
Nov 12, 2024
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/dotnet_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
dotnet-version: 9.0.x
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v4
id: semantic
Expand Down
4 changes: 4 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ dotnet tool install -g GitLabSync.Tool

### Usage

To run the tool with your gitlab credentials, you need to set the environment variable `GitLab_OAuthToken` with a personal access token as the value.

You can also set the environment variable `GitLab_HostUrl` to the host of your GitLab instance. This is optional and defaults to `https://gitlab.com`.

Run against the current directory will use `gitlabsync.yaml` in the current directory:

```ps
Expand Down
66 changes: 33 additions & 33 deletions src/GitSync.GitLab.Tool/GitSync.GitLab.Tool.csproj
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<ToolCommandName>gitlabsync</ToolCommandName>
<PackageId>GitLabSync.Tool</PackageId>
<PackAsTool>True</PackAsTool>
<CopyLocalLockFileAssemblies>True</CopyLocalLockFileAssemblies>
<PublishRepositoryUrl>True</PublishRepositoryUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageReadmeFile>readme.md</PackageReadmeFile>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\GitSync.GitLab\GitSync.GitLab.csproj" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="YamlDotNet" Version="16.2.0" />
</ItemGroup>
<ItemGroup>
<None Include="../../readme.md" Pack="true" PackagePath="readme.md" />
</ItemGroup>
</Project>
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<ToolCommandName>gitlabsync</ToolCommandName>
<PackageId>GitLabSync.Tool</PackageId>
<PackAsTool>True</PackAsTool>
<CopyLocalLockFileAssemblies>True</CopyLocalLockFileAssemblies>
<PublishRepositoryUrl>True</PublishRepositoryUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageReadmeFile>readme.md</PackageReadmeFile>
</PropertyGroup>

<ItemGroup>
<ProjectReference Include="..\GitSync.GitLab\GitSync.GitLab.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="YamlDotNet" Version="16.2.0" />
</ItemGroup>

<ItemGroup>
<None Include="../../readme.md" Pack="true" PackagePath="readme.md" />
</ItemGroup>

</Project>
10 changes: 9 additions & 1 deletion src/GitSync.GitLab/GitLabGateway.cs
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,11 @@ public async Task<string> CreateTree(INewTree newTree, string owner, string repo
return treeId;
}

public async Task CreateBlob(string owner, string repository, string sha)
public
#if DEBUG
async
#endif
Task CreateBlob(string owner, string repository, string sha)
{
#if DEBUG
var blobPath = Path.Combine(this.blobStoragePath.Value, sha);
Expand All @@ -241,6 +245,10 @@ public async Task CreateBlob(string owner, string repository, string sha)
#endif

this.AddToKnown<IBlob>(sha, owner, repository);

#if !DEBUG
return Task.CompletedTask;
#endif
}

public async Task FetchBlob(string owner, string repository, string sha)
Expand Down
36 changes: 18 additions & 18 deletions src/GitSync.GitLab/GitSync.GitLab.csproj
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ConfigureAwait.Fody" Version="3.3.2" PrivateAssets="all" />
<PackageReference Include="Fody" Version="6.8.2" PrivateAssets="all" />
<PackageReference Include="GitSync" Version="2.0.0-beta.1" />
<PackageReference Include="NGitLab" Version="6.57.0" />
<PackageReference Include="System.Text.Json" Version="9.0.0" />
</ItemGroup>
</Project>
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="ConfigureAwait.Fody" Version="3.3.2" PrivateAssets="all" />
<PackageReference Include="Fody" Version="6.8.2" PrivateAssets="all" />
<PackageReference Include="GitSync" Version="2.0.0-beta.1" />
<PackageReference Include="NGitLab" Version="6.57.0" />
<PackageReference Include="System.Text.Json" Version="9.0.0" />
</ItemGroup>

</Project>
60 changes: 30 additions & 30 deletions test/unit/GitSync.GitLab.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="coverlet.collector" Version="6.0.2" />
<PackageReference Include="FluentAssertions" Version="6.12.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="NGitLab.Mock" Version="6.57.0" />
<PackageReference Include="Verify.ClipboardAccept" Version="28.2.0" />
<PackageReference Include="Verify.Xunit" Version="28.2.0" />
<PackageReference Include="xunit" Version="2.9.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\GitSync.GitLab\GitSync.GitLab.csproj" />
</ItemGroup>
<Target Name="Husky" BeforeTargets="Restore;CollectPackageReferences" Condition="'$(HUSKY)' != 0">
<Exec Command="dotnet tool restore" StandardOutputImportance="Low" StandardErrorImportance="High" />
<Exec Command="dotnet husky install" StandardOutputImportance="Low" StandardErrorImportance="High" WorkingDirectory="..\.." />
</Target>
</Project>
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="coverlet.collector" Version="6.0.2" />
<PackageReference Include="FluentAssertions" Version="6.12.2" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.1" />
<PackageReference Include="NGitLab.Mock" Version="6.57.0" />
<PackageReference Include="Verify.ClipboardAccept" Version="28.2.0" />
<PackageReference Include="Verify.Xunit" Version="28.2.0" />
<PackageReference Include="xunit" Version="2.9.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\GitSync.GitLab\GitSync.GitLab.csproj" />
</ItemGroup>

<Target Name="Husky" BeforeTargets="Restore;CollectPackageReferences" Condition="'$(HUSKY)' != 0">
<Exec Command="dotnet tool restore" StandardOutputImportance="Low" StandardErrorImportance="High" />
<Exec Command="dotnet husky install" StandardOutputImportance="Low" StandardErrorImportance="High" WorkingDirectory="..\.." />
</Target>

</Project>