diff --git a/.editorconfig b/.editorconfig index 7453d922..6f876720 100644 --- a/.editorconfig +++ b/.editorconfig @@ -145,7 +145,7 @@ csharp_style_conditional_delegate_call = true:error csharp_style_expression_bodied_accessors = true:warning # http://kent-boogaart.com/blog/editorconfig-reference-for-c-developers#csharp_style_expression_bodied_constructors -csharp_style_expression_bodied_constructors = true:warning +csharp_style_expression_bodied_constructors = true:suggestion # http://kent-boogaart.com/blog/editorconfig-reference-for-c-developers#csharp_style_expression_bodied_indexers csharp_style_expression_bodied_indexers = true:error @@ -154,7 +154,7 @@ csharp_style_expression_bodied_indexers = true:error csharp_style_expression_bodied_methods = true # http://kent-boogaart.com/blog/editorconfig-reference-for-c-developers#csharp_style_expression_bodied_operators -csharp_style_expression_bodied_operators = true:error +csharp_style_expression_bodied_operators = true:suggestion # http://kent-boogaart.com/blog/editorconfig-reference-for-c-developers#csharp_style_expression_bodied_properties csharp_style_expression_bodied_properties = true:error diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d6e43f59..2d9bee01 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,26 +16,20 @@ jobs: name: Test steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 0 - - uses: actions/cache@v2 + - uses: actions/cache@v4 with: path: ~/.nuget/packages key: ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }} restore-keys: | ${{ runner.os }}-nuget- - - name: Setup dotnet 3.1 - uses: actions/setup-dotnet@v1 + - name: Setup dotnet + uses: actions/setup-dotnet@v4 with: - dotnet-version: '3.1' - - name: Setup dotnet 5 - uses: actions/setup-dotnet@v1 - with: - dotnet-version: '5.0' - - - run: dotnet tool install -g Codecov.Tool + dotnet-version: '8.0' - run: dotnet tool install -g GitVersion.Tool diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 4c8ed850..f7854bbe 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -7,14 +7,8 @@ jobs: runs-on: ubuntu-latest name: Format steps: - - uses: actions/checkout@v2 - - - run: dotnet tool install -g dotnet-format - - - name: Add dotnet-format problem matcher - uses: xt0rted/dotnet-format-problem-matcher@v1 + - uses: actions/checkout@v4 - name: Run dotnet format - uses: xt0rted/dotnet-format@v1 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} + run: | + dotnet format --verify-no-changes diff --git a/GitVersion.yml b/GitVersion.yml index b7c11728..711e5a97 100644 --- a/GitVersion.yml +++ b/GitVersion.yml @@ -1,4 +1,5 @@ mode: ContinuousDeployment branches: master: - tag: beta + regex: ^master$ + label: beta diff --git a/test.ps1 b/test.ps1 index a39ded4c..19c881c3 100644 --- a/test.ps1 +++ b/test.ps1 @@ -5,15 +5,6 @@ if ($dockerOSType -ieq 'linux') { & dotnet test --filter Category!=LinuxIntegration --verbosity normal --settings coverletArgs.runsettings --no-build --no-restore } -$exitWithError = $LastExitCode -ne 0 - -$openCoverFile = Get-ChildItem -Path "test/*/coverage.opencover.xml" -Recurse | Sort-Object LastWriteTime | Select-Object -last 1 -if (Test-Path "$openCoverFile") { - Write-Host "Uploading coverage file" - & codecov -f "$openCoverFile" -t bda1c835-c4a2-4a1a-8d38-999b9a8ea80b - $exitWithError = $exitWithError -or $LastExitCode -ne 0 -} - -if ($exitWithError) { +if ($LastExitCode -ne 0) { exit 1 } diff --git a/test/GitLabApiClient.Test/GroupsClientTest.cs b/test/GitLabApiClient.Test/GroupsClientTest.cs index 47a0ffdb..3331a5b1 100644 --- a/test/GitLabApiClient.Test/GroupsClientTest.cs +++ b/test/GitLabApiClient.Test/GroupsClientTest.cs @@ -21,7 +21,7 @@ namespace GitLabApiClient.Test public class GroupsClientTest { private readonly List _groupIdsToClean = new List(); - private List MilestoneIdsToClean { get; } = new List(); + private List MilestoneIdsToClean { get; } = new List(); private List VariableIdsToClean { get; } = new List(); private readonly GroupsClient _sut = new GroupsClient( @@ -86,7 +86,7 @@ public async Task GroupMilestonesCanBeRetrieved() //act var milestones = await _sut.GetMilestonesAsync(TestGroupId); - var milestone = await _sut.GetMilestoneAsync(TestGroupId, createdMilestone.Id); + var milestone = await _sut.GetMilestoneAsync(TestGroupId, (int)createdMilestone.Id); //assert milestones.Should().NotBeEmpty(); @@ -207,7 +207,7 @@ public async Task CreatedGroupMilestoneCanBeUpdated() MilestoneIdsToClean.Add(createdMilestone.Id); //act - var updatedMilestone = await _sut.UpdateMilestoneAsync(TestGroupTextId, createdMilestone.Id, new UpdateGroupMilestoneRequest() + var updatedMilestone = await _sut.UpdateMilestoneAsync(TestGroupTextId, (int)createdMilestone.Id, new UpdateGroupMilestoneRequest() { Title = "milestone22", StartDate = "2018-11-05", @@ -237,7 +237,7 @@ public async Task CreatedGroupMilestoneCanBeClosed() MilestoneIdsToClean.Add(createdMilestone.Id); //act - var updatedMilestone = await _sut.UpdateMilestoneAsync(TestGroupTextId, createdMilestone.Id, new UpdateGroupMilestoneRequest() + var updatedMilestone = await _sut.UpdateMilestoneAsync(TestGroupTextId, (int)createdMilestone.Id, new UpdateGroupMilestoneRequest() { State = UpdatedMilestoneState.Close }); @@ -353,8 +353,8 @@ public Task DisposeAsync() private async Task CleanupGroups() { - foreach (int milestoneId in MilestoneIdsToClean) - await _sut.DeleteMilestoneAsync(TestGroupId, milestoneId); + foreach (long milestoneId in MilestoneIdsToClean) + await _sut.DeleteMilestoneAsync(TestGroupId, (int)milestoneId); foreach (int groupId in _groupIdsToClean) await _sut.DeleteAsync(groupId.ToString()); diff --git a/test/GitLabApiClient.Test/IssuesClientTest.cs b/test/GitLabApiClient.Test/IssuesClientTest.cs index f333e13d..872469fb 100644 --- a/test/GitLabApiClient.Test/IssuesClientTest.cs +++ b/test/GitLabApiClient.Test/IssuesClientTest.cs @@ -37,7 +37,7 @@ public async Task CreatedIssueCanBeUpdated() }); //act - var updatedIssue = await _sut.UpdateAsync(TestProjectTextId, createdIssue.Iid, new UpdateIssueRequest() + var updatedIssue = await _sut.UpdateAsync(TestProjectTextId, (int)createdIssue.Iid, new UpdateIssueRequest() { Assignees = new List { 11 }, Confidential = false, @@ -63,7 +63,7 @@ public async Task CreatedIssueCanBeClosed() var createdIssue = await _sut.CreateAsync(TestProjectTextId, new CreateIssueRequest("Title1")); //act - var updatedIssue = await _sut.UpdateAsync(TestProjectTextId, createdIssue.Iid, new UpdateIssueRequest() + var updatedIssue = await _sut.UpdateAsync(TestProjectTextId, (int)createdIssue.Iid, new UpdateIssueRequest() { State = UpdatedIssueState.Close }); @@ -104,8 +104,8 @@ public async Task CreatedIssueCanBeRetrieved() }); //act - var issueById = await _sut.GetAsync(TestProjectId, issue.Iid); - var issueByProjectId = (await _sut.GetAllAsync(options: o => o.IssueIds = new[] { issue.Iid })).FirstOrDefault(i => i.Title == title); + var issueById = await _sut.GetAsync(TestProjectId, (int)issue.Iid); + var issueByProjectId = (await _sut.GetAllAsync(options: o => o.IssueIds = new[] { (int)issue.Iid })).FirstOrDefault(i => i.Title == title); var ownedIssue = (await _sut.GetAllAsync(options: o => o.Scope = Scope.CreatedByMe)).FirstOrDefault(i => i.Title == title); //assert @@ -136,7 +136,7 @@ public async Task CreatedIssueNoteCanBeRetrieved() CreatedAt = DateTime.Now }); var issueNotes = (await _sut.GetNotesAsync(TestProjectId, issue.Iid)).FirstOrDefault(i => i.Body == body); - var issueNote = await _sut.GetNoteAsync(TestProjectId, issue.Iid, note.Id); + var issueNote = await _sut.GetNoteAsync(TestProjectId, (int)issue.Iid, (int)note.Id); //assert note.Should().Match(n => @@ -157,7 +157,7 @@ public async Task CreatedIssueNoteCanBeUpdated() var createdIssueNote = await _sut.CreateNoteAsync(TestProjectTextId, createdIssue.Iid, new CreateIssueNoteRequest("comment2")); //act - var updatedIssueNote = await _sut.UpdateNoteAsync(TestProjectTextId, createdIssue.Iid, createdIssueNote.Id, new UpdateIssueNoteRequest("comment22")); + var updatedIssueNote = await _sut.UpdateNoteAsync(TestProjectTextId, (int)createdIssue.Iid, (int)createdIssueNote.Id, new UpdateIssueNoteRequest("comment22")); //assert updatedIssueNote.Should().Match(n => diff --git a/test/GitLabApiClient.Test/MergeRequestClientTest.cs b/test/GitLabApiClient.Test/MergeRequestClientTest.cs index a031eb3b..d6eedd2f 100644 --- a/test/GitLabApiClient.Test/MergeRequestClientTest.cs +++ b/test/GitLabApiClient.Test/MergeRequestClientTest.cs @@ -96,7 +96,7 @@ public async Task MergeRequestWithoutCommitsCannotBeAccepted() }); Func> acceptAction = () => - _sut.AcceptAsync(GitLabApiHelper.TestProjectTextId, createdMergeRequest.Iid, new AcceptMergeRequest()); + _sut.AcceptAsync(GitLabApiHelper.TestProjectTextId, (int)createdMergeRequest.Iid, new AcceptMergeRequest()); acceptAction.Should().Throw(). WithMessage("{\"message\":\"405 Method Not Allowed\"}"). @@ -124,7 +124,7 @@ private async Task DeleteAllMergeRequests() { var mergeRequests = await _sut.GetAsync(GitLabApiHelper.TestProjectId); await Task.WhenAll(mergeRequests.Select( - m => _sut.DeleteAsync(GitLabApiHelper.TestProjectId, m.Iid))); + m => _sut.DeleteAsync(GitLabApiHelper.TestProjectId, (int)m.Iid))); } } } diff --git a/test/GitLabApiClient.Test/ProjectsClientTest.cs b/test/GitLabApiClient.Test/ProjectsClientTest.cs index fbb9a6a6..6b881edf 100644 --- a/test/GitLabApiClient.Test/ProjectsClientTest.cs +++ b/test/GitLabApiClient.Test/ProjectsClientTest.cs @@ -22,7 +22,7 @@ namespace GitLabApiClient.Test public class ProjectsClientTest : IAsyncLifetime { private List ProjectIdsToClean { get; } = new List(); - private List MilestoneIdsToClean { get; } = new List(); + private List MilestoneIdsToClean { get; } = new List(); private List VariableIdsToClean { get; } = new List(); private readonly ProjectsClient _sut = new ProjectsClient( @@ -76,7 +76,7 @@ public async Task ProjectMilestonesRetrieved() //act var milestones = await _sut.GetMilestonesAsync(GitLabApiHelper.TestProjectId); - var milestone = await _sut.GetMilestoneAsync(GitLabApiHelper.TestProjectId, createdMilestone.Id); + var milestone = await _sut.GetMilestoneAsync(GitLabApiHelper.TestProjectId, (int)createdMilestone.Id); //assert milestones.Should().NotBeEmpty(); @@ -286,7 +286,7 @@ public async Task CreatedProjectMilestoneCanBeUpdated() MilestoneIdsToClean.Add(createdMilestone.Id); //act - var updatedMilestone = await _sut.UpdateMilestoneAsync(GitLabApiHelper.TestProjectTextId, createdMilestone.Id, new UpdateProjectMilestoneRequest() + var updatedMilestone = await _sut.UpdateMilestoneAsync(GitLabApiHelper.TestProjectTextId, (int)createdMilestone.Id, new UpdateProjectMilestoneRequest() { Title = "milestone23", StartDate = "2018-11-05", @@ -353,7 +353,7 @@ public async Task CreatedProjectMilestoneCanBeClosed() MilestoneIdsToClean.Add(createdMilestone.Id); //act - var updatedMilestone = await _sut.UpdateMilestoneAsync(GitLabApiHelper.TestProjectTextId, createdMilestone.Id, new UpdateProjectMilestoneRequest() + var updatedMilestone = await _sut.UpdateMilestoneAsync(GitLabApiHelper.TestProjectTextId, (int)createdMilestone.Id, new UpdateProjectMilestoneRequest() { State = UpdatedMilestoneState.Close }); @@ -411,8 +411,8 @@ public async Task ExportImportProject() private async Task CleanupProjects() { - foreach (int milestoneId in MilestoneIdsToClean) - await _sut.DeleteMilestoneAsync(GitLabApiHelper.TestProjectId, milestoneId); + foreach (long milestoneId in MilestoneIdsToClean) + await _sut.DeleteMilestoneAsync(GitLabApiHelper.TestProjectId, (int)milestoneId); foreach (int projectId in ProjectIdsToClean) await _sut.DeleteAsync(projectId); diff --git a/test/GitLabApiClient.Test/ToDoListClientTest.cs b/test/GitLabApiClient.Test/ToDoListClientTest.cs index 1a69e2ef..5d936d2c 100644 --- a/test/GitLabApiClient.Test/ToDoListClientTest.cs +++ b/test/GitLabApiClient.Test/ToDoListClientTest.cs @@ -140,7 +140,7 @@ private async Task DeleteAllMergeRequests() { var mergeRequests = await mergeRequestsClient.GetAsync(GitLabApiHelper.TestProjectId); await Task.WhenAll(mergeRequests.Select( - m => mergeRequestsClient.DeleteAsync(GitLabApiHelper.TestProjectId, m.Iid))); + m => mergeRequestsClient.DeleteAsync(GitLabApiHelper.TestProjectId, (int)m.Iid))); } } }