Skip to content

Commit

Permalink
ci: updated steps.dotnet-build-test.yml
Browse files Browse the repository at this point in the history
Skip SonarCloud Scan if the pull request is from a forked repository

Signed-off-by: SebastienDegodez <[email protected]>
  • Loading branch information
SebastienDegodez committed Dec 21, 2024
1 parent 4ef9f55 commit 88c1bba
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 112 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/steps.dotnet-build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ jobs:
run: dotnet restore

- name: 🔍 Start SonarQube Analysis
if: ${{ inputs.use-sonarcloud == true && github.repository == 'microcks/microcks-testcontainers-dotnet' }}
# Skip SonarCloud Scan if the pull request is from a forked repository
if: ${{ inputs.use-sonarcloud == true && ((github.repository == 'microcks/microcks-testcontainers-dotnet' && github.event_name != 'pull_request') ||(github.event.pull_request.head.repo.full_name == github.repository && github.event_name == 'pull_request')) }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
Expand Down Expand Up @@ -99,7 +100,8 @@ jobs:
shell: pwsh

- name: Stop SonarQube Analysis
if: ${{ inputs.use-sonarcloud == true && (success() || steps.test-with-coverage.conclusion == 'failure') && github.repository == 'microcks/microcks-testcontainers-dotnet' }}
# Skip SonarCloud Scan if the pull request is from a forked repository
if: ${{ inputs.use-sonarcloud == true && (success() || steps.test-with-coverage.conclusion == 'failure') && ((github.repository == 'microcks/microcks-testcontainers-dotnet' && github.event_name != 'pull_request') || (github.event.pull_request.head.repo.full_name == github.repository && github.event_name == 'pull_request')) }}
id: sonar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
1 change: 0 additions & 1 deletion src/Microcks.Testcontainers/Microcks.Testcontainers.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
<PropertyGroup>
<TargetFrameworks>net6.0;net8.0;netstandard2.0;netstandard2.1</TargetFrameworks>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Testcontainers" Version="4.0.0" />
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,14 @@ public void ShouldReceivedKafkaMessageWhenMessageIsEmitted()
public async Task ShouldReturnsCorrectStatusContractWhenMessageIsEmitted(
string message,
bool result,
string? expectedMessage)
string expectedMessage)
{
var testRequest = new TestRequest
{
ServiceId = "Pastry orders API:0.1.0",
RunnerType = TestRunnerType.ASYNC_API_SCHEMA,
TestEndpoint = "kafka://kafka:19092/pastry-orders",
Timeout = TimeSpan.FromMilliseconds(10001)
Timeout = TimeSpan.FromMilliseconds(15000)
};

// Init Kafka producer to send a message
Expand Down Expand Up @@ -152,6 +152,7 @@ public async Task ShouldReturnsCorrectStatusContractWhenMessageIsEmitted(
Key = Guid.NewGuid().ToString(),
Value = message
});
producer.Flush();
await Task.Delay(200);
}

Expand All @@ -167,7 +168,7 @@ public async Task ShouldReturnsCorrectStatusContractWhenMessageIsEmitted(

testStepResults.Should().NotBeEmpty();

if (expectedMessage == null)
if (string.IsNullOrEmpty(expectedMessage) )
{
testStepResults.First().Message.Should().BeNull();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public sealed class MicrocksAsyncFeatureTest : IAsyncLifetime
/// <summary>
/// Image name for the Microcks container.
/// </summary>
private const string MicrocksImage = "quay.io/microcks/microcks-uber:nightly-native";
private const string MicrocksImage = "quay.io/microcks/microcks-uber:1.10.1-native";

private MicrocksContainerEnsemble _microcksContainerEnsemble;

Expand All @@ -46,7 +46,7 @@ public void ShouldDetermineCorrectImageMessage()
{
this._microcksContainerEnsemble.AsyncMinionContainer.Image.FullName
.Should()
.Be("quay.io/microcks/microcks-uber-async-minion:nightly");
.Be("quay.io/microcks/microcks-uber-async-minion:1.10.1");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
<IsPackable>false</IsPackable>
<IsPublishable>false</IsPublishable>
<NoWarn>$(NoWarn);CS1591</NoWarn>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="FluentAssertions" Version="7.0.0" />
Expand Down

0 comments on commit 88c1bba

Please sign in to comment.