diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1a7253ea..ab043b4b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -39,55 +39,6 @@ jobs: echo "Release :" >> $GITHUB_STEP_SUMMARY echo "$RELEASE" >> $GITHUB_STEP_SUMMARY - format: - runs-on: ubuntu-latest - timeout-minutes: 15 - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - ref: ${{ github.ref }} - fetch-depth: 0 - submodules: true - - - name: Install ReSharper - run: | - dotnet tool install -g JetBrains.ReSharper.GlobalTools --version 2023.2.0 - - - name: Restore - run: | - dotnet restore ArmoniK.Extensions.Csharp.sln - - - name: Reformat - run: | - jb cleanupcode --exclude="**.props" ArmoniK.Extensions.Csharp.sln - - - name: Check Diff - id: check-diff - run: | - DIFF="$(git diff --name-only)" - - if [ -z "$DIFF" ]; then - echo "OK: Format is clean" - else - echo "Error: Format was not clean" - echo "List of files:" - echo "$DIFF" - git diff - exit 1 - fi - - - name: Generate patch - if: ${{ failure() && steps.check-diff.conclusion == 'failure' }} - run: | - git diff > patch-csharp.diff - - - uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3 - if: ${{ failure() && steps.check-diff.conclusion == 'failure' }} - with: - name: patch-csharp - path: ./patch-csharp.diff - buildProjects: runs-on: ubuntu-latest needs: @@ -364,7 +315,6 @@ jobs: canMerge: needs: - testEndToEnd - - format runs-on: ubuntu-latest steps: - name: Echo OK diff --git a/.github/workflows/code-formatting.yml b/.github/workflows/code-formatting.yml new file mode 100644 index 00000000..6318f071 --- /dev/null +++ b/.github/workflows/code-formatting.yml @@ -0,0 +1,57 @@ +name: Code Formatting + +on: + pull_request: + +jobs: + format-csharp: + runs-on: ubuntu-latest + timeout-minutes: 15 + steps: + - name: Checkout + uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4 + with: + ref: ${{ github.ref }} + + - name: Install .NET Core + uses: actions/setup-dotnet@3447fd6a9f9e57506b15f895c5b76d3b197dc7c2 # v3 + with: + dotnet-version: 6.x + + - name: Install ReSharper + run: | + dotnet tool install -g JetBrains.ReSharper.GlobalTools --version 2022.2.2 + + - name: Restore + run: | + dotnet restore ArmoniK.Extensions.Csharp.sln + + - name: Reformat + run: | + jb cleanupcode --exclude="**.props" ArmoniK.Extensions.Csharp.sln + + - name: Check Diff + id: check-diff + run: | + DIFF="$(git diff --name-only)" + + if [ -z "$DIFF" ]; then + echo "OK: Format is clean" + else + echo "Error: Format was not clean" + echo "List of files:" + echo "$DIFF" + git diff + exit 1 + fi + + - name: Generate patch + if: ${{ failure() && steps.check-diff.conclusion == 'failure' }} + run: | + git diff > patch-csharp.diff + + - uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3 + if: ${{ failure() && steps.check-diff.conclusion == 'failure' }} + with: + name: patch-csharp + path: ./patch-csharp.diff diff --git a/.github/workflows/sonar.yml b/.github/workflows/sonar.yml index a52d80f5..d92084ca 100644 --- a/.github/workflows/sonar.yml +++ b/.github/workflows/sonar.yml @@ -11,25 +11,25 @@ jobs: SonarCloud: runs-on: windows-latest steps: - - name: Set up JDK 11 - uses: actions/setup-java@v3 + - name: Set up JDK + uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v3 with: distribution: 'zulu' - java-version: 11 - - uses: actions/checkout@v3 + java-version: 17 + - uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4 with: fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis submodules: true - name: Cache SonarCloud packages - uses: actions/cache@v3 + uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3 with: - path: ~\sonar\cache + path: .\.sonar\cache key: ${{ runner.os }}-sonar restore-keys: ${{ runner.os }}-sonar - name: Cache SonarCloud scanner id: cache-sonar-scanner - uses: actions/cache@v3 + uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3 with: path: .\.sonar\scanner key: ${{ runner.os }}-sonar-scanner diff --git a/Client/src/Common/Submitter/BaseClientSubmitter.cs b/Client/src/Common/Submitter/BaseClientSubmitter.cs index 4b50b01e..3ba8c20d 100644 --- a/Client/src/Common/Submitter/BaseClientSubmitter.cs +++ b/Client/src/Common/Submitter/BaseClientSubmitter.cs @@ -22,8 +22,8 @@ using System.Threading; using System.Threading.Tasks; -using ArmoniK.Api.Client.Submitter; using ArmoniK.Api.Client; +using ArmoniK.Api.Client.Submitter; using ArmoniK.Api.Common.Utils; using ArmoniK.Api.gRPC.V1; using ArmoniK.Api.gRPC.V1.Results; @@ -405,8 +405,8 @@ public void WaitForTasksCompletion(IEnumerable taskIds, delayMs, retry => { - using var channel = ChannelPool.GetChannel(); - var submitterService = new Api.gRPC.V1.Submitter.Submitter.SubmitterClient(channel); + using var channel = ChannelPool.GetChannel(); + var submitterService = new Api.gRPC.V1.Submitter.Submitter.SubmitterClient(channel); if (retry > 1) { @@ -416,20 +416,20 @@ public void WaitForTasksCompletion(IEnumerable taskIds, } var __ = submitterService.WaitForCompletion(new WaitRequest - { - Filter = new TaskFilter - { - Task = new TaskFilter.Types.IdsRequest - { - Ids = + { + Filter = new TaskFilter + { + Task = new TaskFilter.Types.IdsRequest + { + Ids = { taskIds, }, - }, - }, - StopOnFirstTaskCancellation = true, - StopOnFirstTaskError = true, - }); + }, + }, + StopOnFirstTaskCancellation = true, + StopOnFirstTaskError = true, + }); }, true, Logger, @@ -576,17 +576,17 @@ public byte[] GetResult(string taskId, var resultRequest = new ResultRequest - { - ResultId = resultId, - Session = SessionId.Id, - }; + { + ResultId = resultId, + Session = SessionId.Id, + }; Retry.WhileException(5, 2000, retry => { - using var channel = ChannelPool.GetChannel(); - var submitterService = new Api.gRPC.V1.Submitter.Submitter.SubmitterClient(channel); + using var channel = ChannelPool.GetChannel(); + var submitterService = new Api.gRPC.V1.Submitter.Submitter.SubmitterClient(channel); Logger.LogDebug("Try {try} for {funcName}", retry, @@ -833,7 +833,8 @@ public IList> TryGetResults(IList resultIds) var taskIdInError = resultStatus.IdsError.Any() ? resultStatus.IdsError[0] - : resultStatus.IdsResultError[0].TaskId; + : resultStatus.IdsResultError[0] + .TaskId; const string message = "The missing result is in error or canceled. " + "Please check log for more information on Armonik grid server list of taskIds in Error: [{taskList}]\n" + diff --git a/Client/src/Unified/Services/Admin/AdminMonitoringService.cs b/Client/src/Unified/Services/Admin/AdminMonitoringService.cs index d37d1948..539c9c2e 100644 --- a/Client/src/Unified/Services/Admin/AdminMonitoringService.cs +++ b/Client/src/Unified/Services/Admin/AdminMonitoringService.cs @@ -21,14 +21,15 @@ using ArmoniK.Api.gRPC.V1; using ArmoniK.Api.gRPC.V1.Results; using ArmoniK.Api.gRPC.V1.Sessions; +using ArmoniK.Api.gRPC.V1.SortDirection; using ArmoniK.Api.gRPC.V1.Submitter; using ArmoniK.Api.gRPC.V1.Tasks; -using ArmoniK.Api.gRPC.V1.SortDirection; using ArmoniK.DevelopmentKit.Client.Common.Submitter; using Microsoft.Extensions.Logging; using Filters = ArmoniK.Api.gRPC.V1.Tasks.Filters; + namespace ArmoniK.DevelopmentKit.Client.Unified.Services.Admin; ///