diff --git a/.nuget/NuGet.Config b/.nuget/NuGet.Config deleted file mode 100644 index 9e1ef7adc..000000000 --- a/.nuget/NuGet.Config +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/.nuget/packages.config b/.nuget/packages.config deleted file mode 100644 index 318bf89a9..000000000 --- a/.nuget/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index e7e18b3a7..000000000 --- a/.travis.yml +++ /dev/null @@ -1,30 +0,0 @@ -language: csharp -sudo: false -dist: trusty -dotnet: 2.0.0 -env: - global: - - DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true - - DOTNET_CLI_TELEMETRY_OPTOUT: 1 -addons: - apt: - packages: - - libunwind8 -mono: none -os: - - linux -osx_image: xcode9.1 -branches: - only: - - master - - dev - - v2.x - - travis - - /^(.*\/)?ci-.*$/ - - /^rel\/.*/ -before_install: - - if test "$TRAVIS_OS_NAME" == "osx"; then brew update; brew install openssl; ln -s /usr/local/opt/openssl/lib/libcrypto.1.0.0.dylib /usr/local/lib/; ln -s /usr/local/opt/openssl/lib/libssl.1.0.0.dylib /usr/local/lib/; fi -before_script: - - chmod a+x ./build.sh -script: - - ./build.sh \ No newline at end of file diff --git a/NuGet.Config b/NuGet.Config index 72095d70c..1fc9c0f9e 100644 --- a/NuGet.Config +++ b/NuGet.Config @@ -1,6 +1,7 @@  + diff --git a/eng/ci/integration-tests.yml b/eng/ci/integration-tests.yml new file mode 100644 index 000000000..c3d222f42 --- /dev/null +++ b/eng/ci/integration-tests.yml @@ -0,0 +1,34 @@ +trigger: none # ensure this is not ran as a CI build + +pr: + branches: + include: + - dev + +resources: + repositories: + - repository: 1es + type: git + name: 1ESPipelineTemplates/1ESPipelineTemplates + ref: refs/tags/release + - repository: eng + type: git + name: engineering + ref: refs/tags/release + +variables: + - template: /eng/ci/templates/variables/build.yml@self + - template: /ci/variables/cfs.yml@eng + +extends: + template: v1/1ES.Unofficial.PipelineTemplate.yml@1es + parameters: + pool: + name: 1es-pool-azfunc + image: 1es-windows-2022 + os: windows + + stages: + - stage: Test + jobs: + - template: /eng/ci/templates/jobs/run-integration-tests.yml@self diff --git a/eng/ci/official-build.yml b/eng/ci/official-build.yml new file mode 100644 index 000000000..fc0f71b73 --- /dev/null +++ b/eng/ci/official-build.yml @@ -0,0 +1,43 @@ +trigger: + batch: true + branches: + include: + - dev + +# CI only, does not trigger on PRs. +pr: none + +resources: + repositories: + - repository: 1es + type: git + name: 1ESPipelineTemplates/1ESPipelineTemplates + ref: refs/tags/release + - repository: eng + type: git + name: engineering + ref: refs/tags/release + +variables: + - template: /eng/ci/templates/variables/build.yml@self + - template: /ci/variables/cfs.yml@eng + +extends: + template: v1/1ES.Official.PipelineTemplate.yml@1es + parameters: + pool: + name: 1es-pool-azfunc + image: 1es-windows-2022 + os: windows + + stages: + - stage: Build + jobs: + - template: /eng/ci/templates/jobs/build.yml@self + parameters: + official: true + + - stage: Test + dependsOn: '' # Run in parallel + jobs: + - template: /eng/ci/templates/jobs/run-integration-tests.yml@self diff --git a/eng/ci/public-build.yml b/eng/ci/public-build.yml new file mode 100644 index 000000000..483c61761 --- /dev/null +++ b/eng/ci/public-build.yml @@ -0,0 +1,38 @@ +# This build is used for public PR and CI builds. + +trigger: + batch: true + branches: + include: + - dev + +pr: + branches: + include: + - v3.x + - release/3.* + +resources: + repositories: + - repository: 1es + type: git + name: 1ESPipelineTemplates/1ESPipelineTemplates + ref: refs/tags/release + +variables: + - template: /eng/ci/templates/variables/build.yml@self + +extends: + template: v1/1ES.Unofficial.PipelineTemplate.yml@1es + parameters: + pool: + name: 1es-pool-azfunc-public + image: 1es-windows-2022 + os: windows + + stages: + - stage: Build + jobs: + - template: /eng/ci/templates/jobs/build.yml@self + parameters: + official: false diff --git a/eng/ci/templates/jobs/build.yml b/eng/ci/templates/jobs/build.yml new file mode 100644 index 000000000..33dd7a188 --- /dev/null +++ b/eng/ci/templates/jobs/build.yml @@ -0,0 +1,97 @@ +parameters: +- name: official + type: boolean + default: false + displayName: Official build + +jobs: +- job: build + displayName: Build + + variables: + - name: log_dir + value: $(Build.ArtifactStagingDirectory)/log + - name: pack_dir + value: $(Build.ArtifactStagingDirectory)/pkg + - name: buildNumber + value: $[ counter('constant', 12000) ] + - ${{ if and(eq(parameters.official, true), startsWith(variables['Build.SourceBranch'], 'refs/tags')) }}: + - name: version_suffix + value: --version-suffix -$(buildNumber) + - ${{ else }}: + - name: version_suffix + value: '' + + templateContext: + outputParentDirectory: $(Build.ArtifactStagingDirectory) + outputs: + - output: pipelineArtifact + displayName: Publish logs + path: $(pack_dir) + artifact: drop + - output: pipelineArtifact + displayName: Publish logs + path: $(log_dir) + artifact: Build_Log + sbomEnabled: false + condition: always() + + steps: + - template: /eng/ci/templates/steps/install-dotnet.yml@self + + - task: DotNetCoreCLI@2 + displayName: Restore $(project) + inputs: + command: custom + custom: restore + projects: $(project) + arguments: -v m -bl:$(log_dir)/restore.binlog + + - task: DotNetCoreCLI@2 + displayName: Build $(project) + inputs: + command: build + projects: $(project) + arguments: -c $(configuration) -v m -bl:$(log_dir)/build.binlog --no-restore -p:CommitHash=$(Build.SourceVersion) + + - task: DotNetCoreCLI@2 + displayName: Unit tests + inputs: + command: test + arguments: -c $(configuration) --no-build + projects: | + test\Microsoft.Azure.WebJobs.Extensions.Rpc.UnitTests\*.csproj + test\Microsoft.Azure.WebJobs.Host.UnitTests\*.csproj + + - ${{ if eq(parameters.official, true) }}: + - template: ci/sign-files.yml@eng + parameters: + displayName: Sign assemblies + folderPath: src + pattern: Microsoft.Azure.WebJobs.*.dll + signType: dll-strong-name + + - task: DotNetCoreCLI@2 + displayName: Pack + inputs: + command: custom + custom: pack + arguments: -c $(configuration) -v m -o $(pack_dir) -bl:$(log_dir)/pack.binlog --no-build $(version_suffix) + projects: | + src\Microsoft.Azure.WebJobs\WebJobs.csproj + src\Microsoft.Azure.WebJobs.Host\WebJobs.Host.csproj + src\Microsoft.Azure.WebJobs.Host\WebJobs.Host.Sources.csproj + src\Microsoft.Azure.WebJobs.Logging\WebJobs.Logging.csproj + src\Microsoft.Azure.WebJobs.Logging.ApplicationInsights\WebJobs.Logging.ApplicationInsights.csproj + src\Microsoft.Azure.WebJobs.Host.Storage\WebJobs.Host.Storage.csproj + src\Microsoft.Azure.WebJobs.Rpc.Core\WebJobs.Rpc.Core.csproj + src\Microsoft.Azure.WebJobs.Extensions.Rpc\WebJobs.Extensions.Rpc.csproj + test\Microsoft.Azure.WebJobs.Host.TestCommon\WebJobs.Host.TestCommon.csproj + + - ${{ if eq(parameters.official, true) }}: + - template: ci/sign-files.yml@eng + parameters: + displayName: Sign nuget packages + folderPath: $(pack_dir) + pattern: Microsoft.Azure.WebJobs*.nupkg + signType: nuget diff --git a/eng/ci/templates/jobs/run-integration-tests.yml b/eng/ci/templates/jobs/run-integration-tests.yml new file mode 100644 index 000000000..27c1548a6 --- /dev/null +++ b/eng/ci/templates/jobs/run-integration-tests.yml @@ -0,0 +1,45 @@ +# Only to be used for internal builds. + +jobs: +- job: RunIntegrationTests + displayName: Run Integration Tests + + steps: + - template: /eng/ci/templates/steps/install-dotnet.yml@self + + - task: AzureKeyVault@1 + inputs: + # Note: This is actually a Service Connection in DevOps, not an Azure subscription name + azureSubscription: Azure-Functions-Host-CI-internal + keyVaultName: azure-webjobs-sdk-ci + secretsFilter: '*' + + - task: DotNetCoreCLI@2 + displayName: Build source + inputs: + command: build + arguments: -c $(configuration) + projects: $(project) + env: + CommitHash: $(Build.SourceVersion) + + - task: DotNetCoreCLI@2 + displayName: Run tests + inputs: + command: test + arguments: -c $(configuration) --no-build + projects: | + test\Microsoft.Azure.WebJobs.Host.FunctionalTests\*.csproj + test\Microsoft.Azure.WebJobs.Logging.FunctionalTests\*.csproj + test\Microsoft.Azure.WebJobs.Host.EndToEndTests\*.csproj + env: + AzureWebJobsDashboard: $(Storage) + AzureWebJobsStorage: $(Storage) + AzureWebJobsSecondaryStorage: $(Storage2) + AzureWebJobsServiceBus: $(ServiceBus) + AzureWebJobsServiceBusSecondary: $(ServiceBus2) + AzureWebJobsTestHubConnection: $(EventHub) + AzureWebJobsTestHubConnection2: $(EventHub2) + APPINSIGHTS_REPORTER_KEY: $(AppInsights) + ConnectionStrings:ServiceBus: $(ServiceBus) + ConnectionStrings:ServiceBusSecondary: $(ServiceBus2) diff --git a/eng/ci/templates/steps/install-dotnet.yml b/eng/ci/templates/steps/install-dotnet.yml new file mode 100644 index 000000000..341e50777 --- /dev/null +++ b/eng/ci/templates/steps/install-dotnet.yml @@ -0,0 +1,19 @@ +steps: + +- task: UseDotNet@2 # Needed by some of our test resources + displayName: Install .NET 3 + inputs: + packageType: sdk + version: 3.x + +- task: UseDotNet@2 # Needed by some of our test resources + displayName: Install .NET 6 + inputs: + packageType: sdk + version: 6.x + +- task: UseDotNet@2 # The pinned SDK we use to build + displayName: Install .NET SDK from global.json + inputs: + packageType: sdk + useGlobalJson: true diff --git a/eng/ci/templates/variables/build.yml b/eng/ci/templates/variables/build.yml new file mode 100644 index 000000000..827d3ef8b --- /dev/null +++ b/eng/ci/templates/variables/build.yml @@ -0,0 +1,11 @@ +variables: + - name: DOTNET_NOLOGO + value: 1 + - name: DOTNET_SKIP_FIRST_TIME_EXPERIENCE + value: 1 + - name: DOTNET_CLI_TELEMETRY_OPTOUT + value: 1 + - name: configuration + value: release + - name: project + value: Webjobs.sln diff --git a/global.json b/global.json new file mode 100644 index 000000000..3befa4a94 --- /dev/null +++ b/global.json @@ -0,0 +1,10 @@ +{ + "sdk": { + "version": "8.0.300", + "rollForward": "latestFeature" + }, + "msbuild-sdks": { + "Microsoft.Build.NoTargets": "3.7.56", + "Microsoft.Build.Traversal": "4.1.0" + } +} diff --git a/test/Microsoft.Azure.WebJobs.Host.EndToEndTests/DynamicConcurrencyEndToEndTests.cs b/test/Microsoft.Azure.WebJobs.Host.EndToEndTests/DynamicConcurrencyEndToEndTests.cs index fdd007c6d..17d37c4ee 100644 --- a/test/Microsoft.Azure.WebJobs.Host.EndToEndTests/DynamicConcurrencyEndToEndTests.cs +++ b/test/Microsoft.Azure.WebJobs.Host.EndToEndTests/DynamicConcurrencyEndToEndTests.cs @@ -36,7 +36,7 @@ public DynamicConcurrencyEndToEndTests() TestJobs.InvokeCount = 0; } - [Fact] + [Fact(Skip = "Flaky, CPU dependent")] public async Task DynamicConcurrencyEnabled_HighCpu_Throttles() { string functionName = nameof(TestJobs.ConcurrencyTest_HighCpu); diff --git a/test/Microsoft.Azure.WebJobs.Host.UnitTests/Timers/TaskSeriesTimerTests.cs b/test/Microsoft.Azure.WebJobs.Host.UnitTests/Timers/TaskSeriesTimerTests.cs index bd77bcf6e..3e19fcc14 100644 --- a/test/Microsoft.Azure.WebJobs.Host.UnitTests/Timers/TaskSeriesTimerTests.cs +++ b/test/Microsoft.Azure.WebJobs.Host.UnitTests/Timers/TaskSeriesTimerTests.cs @@ -759,6 +759,7 @@ public void Dispose_IfStopped_DoesNotThrow() public void Dispose_TriggersCommandCancellationToken() { // Arrange + int waitMS = 5000; TimeSpan interval = TimeSpan.Zero; using (EventWaitHandle executeStarted = new ManualResetEvent(initialState: false)) @@ -769,7 +770,7 @@ public void Dispose_TriggersCommandCancellationToken() ITaskSeriesCommand command = CreateCommand((cancellationToken) => { Assert.True(executeStarted.Set()); // Guard - cancellationTokenSignalled = cancellationToken.WaitHandle.WaitOne(1000); + cancellationTokenSignalled = cancellationToken.WaitHandle.WaitOne(waitMS); Assert.True(executeFinished.Set()); // Guard return new TaskSeriesCommandResult(wait: Task.Delay(0)); }); @@ -777,13 +778,13 @@ public void Dispose_TriggersCommandCancellationToken() using (ITaskSeriesTimer product = CreateProductUnderTest(command)) { product.Start(); - Assert.True(executeStarted.WaitOne(1000)); // Guard + Assert.True(executeStarted.WaitOne(waitMS)); // Guard // Act product.Dispose(); // Assert - Assert.True(executeFinished.WaitOne(1000)); // Guard + Assert.True(executeFinished.WaitOne(waitMS)); // Guard Assert.True(cancellationTokenSignalled); } }