Skip to content

Commit

Permalink
Replace ADO tests with GitHub actions (#2855)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidmrdavid authored and bachuv committed Jul 9, 2024
1 parent 9c9ca52 commit d56a2ec
Show file tree
Hide file tree
Showing 12 changed files with 194 additions and 16 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/validate-build-analyzer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Validate Build (analyzer)

on:
push:
branches:
- main
paths-ignore: [ '**.md' ]
pull_request:
branches:
- main
paths-ignore: [ '**.md' ]

env:
solution: WebJobs.Extensions.DurableTask.sln
config: Release
AzureWebJobsStorage: UseDevelopmentStorage=true

jobs:
build:
runs-on: windows-latest

steps:
- uses: actions/checkout@v3
with:
submodules: true

- name: Setup .NET
uses: actions/setup-dotnet@v3

- name: Set up .NET Core 3.1
uses: actions/setup-dotnet@v3
with:
dotnet-version: '3.1.x'

- name: Set up .NET Core 2.1
uses: actions/setup-dotnet@v3
with:
dotnet-version: '2.1.x'

- name: Restore dependencies
run: dotnet restore $solution

- name: Build
run: dotnet build $solution

# Install Azurite
- name: Set up Node.js (needed for Azurite)
uses: actions/setup-node@v3
with:
node-version: '18.x' # Azurite requires at least Node 18

- name: Install Azurite
run: npm install -g azurite

# Run tests
- name: Run Analyzer tests
run: azurite --silent --blobPort 10000 --queuePort 10001 --tablePort 10002 & dotnet test ./test/WebJobs.Extensions.DurableTask.Analyzers.Test/WebJobs.Extensions.DurableTask.Analyzers.Test.csproj

60 changes: 60 additions & 0 deletions .github/workflows/validate-build-e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Validate Build (E2E tests)

on:
push:
branches:
- main
paths-ignore: [ '**.md' ]
pull_request:
branches:
- main
paths-ignore: [ '**.md' ]

env:
solution: WebJobs.Extensions.DurableTask.sln
config: Release
AzureWebJobsStorage: UseDevelopmentStorage=true

jobs:
build:
runs-on: windows-latest

steps:
- uses: actions/checkout@v3
with:
submodules: true

- name: Setup .NET
uses: actions/setup-dotnet@v3

- name: Set up .NET Core 3.1
uses: actions/setup-dotnet@v3
with:
dotnet-version: '3.1.x'

- name: Set up .NET Core 2.1
uses: actions/setup-dotnet@v3
with:
dotnet-version: '2.1.x'

- name: Restore dependencies
run: dotnet restore $solution

- name: Build
run: dotnet build $solution

# Install Azurite
- name: Set up Node.js (needed for Azurite)
uses: actions/setup-node@v3
with:
node-version: '18.x' # Azurite requires at least Node 18

- name: Install Azurite
run: npm install -g azurite

# Run tests
- name: Run FunctionsV2 tests (only DurableEntity_CleanEntityStorage test, which is flaky)
run: azurite --silent --blobPort 10000 --queuePort 10001 --tablePort 10002 & dotnet test ./test/FunctionsV2/WebJobs.Extensions.DurableTask.Tests.V2.csproj --filter "FullyQualifiedName~Microsoft.Azure.WebJobs.Extensions.DurableTask.Tests.DurableTaskEndToEndTests.DurableEntity_CleanEntityStorage"

- name: Run FunctionsV2 tests (all other E2E tests)
run: azurite --silent --blobPort 10000 --queuePort 10001 --tablePort 10002 & dotnet test ./test/FunctionsV2/WebJobs.Extensions.DurableTask.Tests.V2.csproj --filter "FullyQualifiedName~Microsoft.Azure.WebJobs.Extensions.DurableTask.Tests.DurableTaskEndToEndTests&FullyQualifiedName!~Microsoft.Azure.WebJobs.Extensions.DurableTask.Tests.DurableTaskEndToEndTests.DurableEntity_CleanEntityStorage"
61 changes: 61 additions & 0 deletions .github/workflows/validate-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Validate Build (except E2E tests)

on:
push:
branches:
- main
paths-ignore: [ '**.md' ]
pull_request:
branches:
- main
paths-ignore: [ '**.md' ]

env:
solution: WebJobs.Extensions.DurableTask.sln
config: Release
AzureWebJobsStorage: UseDevelopmentStorage=true

jobs:
build:
runs-on: windows-latest

steps:
- uses: actions/checkout@v3
with:
submodules: true

- name: Setup .NET
uses: actions/setup-dotnet@v3

- name: Set up .NET Core 3.1
uses: actions/setup-dotnet@v3
with:
dotnet-version: '3.1.x'

- name: Set up .NET Core 2.1
uses: actions/setup-dotnet@v3
with:
dotnet-version: '2.1.x'

- name: Restore dependencies
run: dotnet restore $solution

- name: Build
run: dotnet build $solution

# Install Azurite
- name: Set up Node.js (needed for Azurite)
uses: actions/setup-node@v3
with:
node-version: '18.x' # Azurite requires at least Node 18

- name: Install Azurite
run: npm install -g azurite

# Run tests
- name: Run FunctionsV2 tests (except E2E tests)
run: azurite --silent --blobPort 10000 --queuePort 10001 --tablePort 10002 & dotnet test ./test/FunctionsV2/WebJobs.Extensions.DurableTask.Tests.V2.csproj --filter "FullyQualifiedName!~Microsoft.Azure.WebJobs.Extensions.DurableTask.Tests.DurableTaskEndToEndTests"

- name: Run Worker Extension tests
run: azurite --silent --blobPort 10000 --queuePort 10001 --tablePort 10002 & dotnet test ./test/Worker.Extensions.DurableTask.Tests/Worker.Extensions.DurableTask.Tests.csproj

Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<TargetFramework>netstandard2.0</TargetFramework>
<IncludeBuildOutput>false</IncludeBuildOutput>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<NoWarn>RS1026</NoWarn> <!-- Disable 'Enable concurrent execution' warning until we investigate if it's safe to enable-->
</PropertyGroup>

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@
<Compile Include="**/*.cs" Exclude="Storage/*ClientProvider.cs;Correlation/*.cs;**/obj/**/*.cs" />
<!-- Don't increase below versions without significantly testing on Functions V1!
Increasing these versions increments some dependencies that have binding redirects in Functions V1. -->
<PackageReference Include="Azure.Identity" Version="1.1.1" />
<PackageReference Include="Microsoft.AspNetCore.Hosting.Abstractions" Version="1.0.3" />
<PackageReference Include="Microsoft.AspNetCore.Http.Abstractions" Version="1.0.3" />
<PackageReference Include="Microsoft.AspNetCore.Http.Features" Version="1.0.3" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Abstractions" Version="1.0.4" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.Core" Version="1.0.4" />
<PackageReference Include="Azure.Identity" Version="1.1.1" NoWarn="NU1902,NU1903"/> <!-- Added NoWarn as this dependency cannot be dropped due to Functions V1-->
<PackageReference Include="Microsoft.AspNetCore.Mvc.WebApiCompatShim" Version="1.0.4" />
<PackageReference Include="Microsoft.AspNetCore.Routing" Version="1.0.4" />
<PackageReference Include="Microsoft.AspNetCore.Routing.Abstractions" Version="1.0.4" />
Expand Down
3 changes: 3 additions & 0 deletions test/Common/DurableTaskEndToEndTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,9 @@ await TestHelpers.WaitUntilTrue(
conditionDescription: "Log file exists",
timeout: TimeSpan.FromSeconds(30));

// add a minute wait to ensure logs are fully written
await Task.Delay(TimeSpan.FromMinutes(1));

await TestHelpers.WaitUntilTrue(
predicate: () =>
{
Expand Down
2 changes: 1 addition & 1 deletion test/Common/TestDurableClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public async Task<DurableOrchestrationStatus> WaitForCompletionAsync(
{
if (timeout == null)
{
timeout = Debugger.IsAttached ? TimeSpan.FromMinutes(5) : TimeSpan.FromSeconds(30);
timeout = Debugger.IsAttached ? TimeSpan.FromMinutes(5) : TimeSpan.FromMinutes(1);
}

Stopwatch sw = Stopwatch.StartNew();
Expand Down
2 changes: 1 addition & 1 deletion test/Common/TestHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
using DurableTask.AzureStorage;
using Microsoft.ApplicationInsights.Channel;
#if !FUNCTIONS_V1
using Microsoft.Extensions.Hosting;
using Microsoft.Azure.WebJobs.Host.Scale;
using Microsoft.Extensions.Hosting;
#endif
using Microsoft.Azure.WebJobs.Extensions.DurableTask.Storage;
using Microsoft.Azure.WebJobs.Host.TestCommon;
Expand Down
14 changes: 3 additions & 11 deletions test/FunctionsV2/CorrelationEndToEndTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ internal async Task<Tuple<List<OperationTelemetry>, List<ExceptionTelemetry>>>
[InlineData(false, true, true)]
[InlineData(true, true, false)]
[InlineData(true, true, true)]
public async void TelemetryClientSetup_AppInsights_Warnings(bool instrumentationKeyIsSet, bool connStringIsSet, bool extendedSessions)
public void TelemetryClientSetup_AppInsights_Warnings(bool instrumentationKeyIsSet, bool connStringIsSet, bool extendedSessions)
{
TraceOptions traceOptions = new TraceOptions()
{
Expand All @@ -258,11 +258,11 @@ public async void TelemetryClientSetup_AppInsights_Warnings(bool instrumentation
}
else if (instrumentationKeyIsSet)
{
mockNameResolver = GetNameResolverMock(new[] { (instKeyEnvVarName, environmentVariableValue), (connStringEnvVarName, String.Empty) });
mockNameResolver = GetNameResolverMock(new[] { (instKeyEnvVarName, environmentVariableValue), (connStringEnvVarName, string.Empty) });
}
else if (connStringIsSet)
{
mockNameResolver = GetNameResolverMock(new[] { (instKeyEnvVarName, String.Empty), (connStringEnvVarName, connStringValue) });
mockNameResolver = GetNameResolverMock(new[] { (instKeyEnvVarName, string.Empty), (connStringEnvVarName, connStringValue) });
}

using (var host = TestHelpers.GetJobHost(
Expand Down Expand Up @@ -405,14 +405,6 @@ private static List<OperationTelemetry> GetCorrelationSortedList(OperationTeleme
var result = new List<OperationTelemetry>();
if (current.Count != 0)
{
foreach (var some in current)
{
if (parent.Id == some.Context.Operation.ParentId)
{
Console.WriteLine("match");
}
}

IOrderedEnumerable<OperationTelemetry> nexts = current.Where(p => p.Context.Operation.ParentId == parent.Id).OrderBy(p => p.Timestamp.Ticks);
foreach (OperationTelemetry next in nexts)
{
Expand Down
3 changes: 3 additions & 0 deletions test/FunctionsV2/OutOfProcTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@ public async Task TestLocalRcpEndpointRuntimeVersion(string runtimeVersion, bool
// Validate if we opened local RPC endpoint by looking at log statements.
var logger = this.loggerProvider.CreatedLoggers.Single(l => l.Category == TestHelpers.LogCategory);
var logMessages = logger.LogMessages.ToList();

bool enabledRpcEndpoint = logMessages.Any(msg => msg.Level == Microsoft.Extensions.Logging.LogLevel.Information && msg.FormattedMessage.StartsWith($"Opened local {expectedProtocol} endpoint:"));

Assert.Equal(enabledExpected, enabledRpcEndpoint);
Expand All @@ -363,13 +364,15 @@ public async Task InvokeLocalRpcEndpoint()
{
await host.StartAsync();

#pragma warning disable SYSLIB0014 // Type or member is obsolete
using (var client = new WebClient())
{
string jsonString = client.DownloadString("http://localhost:17071/durabletask/instances");

// The result is expected to be an empty array
JArray array = JArray.Parse(jsonString);
}
#pragma warning restore SYSLIB0014 // Type or member is obsolete

await host.StopAsync();
}
Expand Down
3 changes: 2 additions & 1 deletion test/FunctionsV2/PlatformSpecificHelpers.FunctionsV2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,6 @@ private static IWebJobsBuilder AddEmulatorDurableTask(this IWebJobsBuilder build

internal class FunctionsV2HostWrapper : ITestHost
{
internal readonly IHost InnerHost;
private readonly JobHost innerWebJobsHost;
private readonly DurableTaskOptions options;
private readonly INameResolver nameResolver;
Expand All @@ -257,6 +256,8 @@ internal FunctionsV2HostWrapper(
this.options = options.Value;
}

internal IHost InnerHost { get; private set; }

public Task CallAsync(string methodName, IDictionary<string, object> args)
=> this.innerWebJobsHost.CallAsync(methodName, args);

Expand Down
1 change: 0 additions & 1 deletion test/SmokeTests/SmokeTestsV1/VSSampleV1.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
<ItemGroup>
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.30" />
<PackageReference Include="Microsoft.Azure.WebJobs" Version="2.3.0" />
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
</ItemGroup>
<ItemGroup>
<None Update="host.json">
Expand Down

0 comments on commit d56a2ec

Please sign in to comment.