Skip to content

Commit

Permalink
ci: correction for c# formatting and to use java 17 (#241)
Browse files Browse the repository at this point in the history
  • Loading branch information
ngruelaneo authored Dec 14, 2023
2 parents f5e4ed3 + 123b7ea commit d4b77d9
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 79 deletions.
50 changes: 0 additions & 50 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -364,7 +315,6 @@ jobs:
canMerge:
needs:
- testEndToEnd
- format
runs-on: ubuntu-latest
steps:
- name: Echo OK
Expand Down
57 changes: 57 additions & 0 deletions .github/workflows/code-formatting.yml
Original file line number Diff line number Diff line change
@@ -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
14 changes: 7 additions & 7 deletions .github/workflows/sonar.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
43 changes: 22 additions & 21 deletions Client/src/Common/Submitter/BaseClientSubmitter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -405,8 +405,8 @@ public void WaitForTasksCompletion(IEnumerable<string> 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)
{
Expand All @@ -416,20 +416,20 @@ public void WaitForTasksCompletion(IEnumerable<string> 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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -833,7 +833,8 @@ public IList<Tuple<string, byte[]>> TryGetResults(IList<string> 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" +
Expand Down
3 changes: 2 additions & 1 deletion Client/src/Unified/Services/Admin/AdminMonitoringService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

/// <summary>
Expand Down

0 comments on commit d4b77d9

Please sign in to comment.