From 769f0ea5780b0fc1c8aee72be846dede50ef8854 Mon Sep 17 00:00:00 2001 From: "naiyuantian@microsoft.com" Date: Wed, 4 Dec 2024 16:58:52 -0800 Subject: [PATCH] add build.yml --- templates/build.yml | 137 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 137 insertions(+) create mode 100644 templates/build.yml diff --git a/templates/build.yml b/templates/build.yml new file mode 100644 index 000000000..c68e0d44d --- /dev/null +++ b/templates/build.yml @@ -0,0 +1,137 @@ +jobs: + - job: Build + + templateContext: + outputs: + - output: pipelineArtifact + path: $(build.artifactStagingDirectory) + artifact: drop + sbomBuildDropPath: $(build.artifactStagingDirectory) + sbomPackageName: 'Durable Functions Extension SBOM' + + steps: + + # Configure all the .NET SDK versions we need + - task: UseDotNet@2 + displayName: 'Use the .NET Core 2.1 SDK (required for build signing)' + inputs: + packageType: 'sdk' + version: '2.1.x' + + - task: UseDotNet@2 + displayName: 'Use the .NET Core 3.1 SDK' + inputs: + packageType: 'sdk' + version: '3.1.x' + + - task: UseDotNet@2 + displayName: 'Use the .NET 6 SDK' + inputs: + packageType: 'sdk' + version: '6.0.x' + + # Start by restoring all the dependencies. + - task: DotNetCoreCLI@2 + displayName: 'dotnet restore' + inputs: + command: restore + projects: '**/**/*.csproj' + feedsToUse: config + nugetConfigPath: 'nuget.config' + + # Build durable-extension + - task: VSBuild@1 + displayName: 'Build Durable Extension' + inputs: + solution: '**/WebJobs.Extensions.DurableTask.sln' + vsVersion: "16.0" + configuration: Release + msbuildArgs: /p:FileVersionRevision=$(Build.BuildId) /p:ContinuousIntegrationBuild=true # these flags make package build deterministic + + - template: ci/sign-files.yml@eng + parameters: + displayName: Sign assemblies + folderPath: 'src/WebJobs.Extensions.DurableTask/bin/Release' + pattern: '*DurableTask.dll' + signType: dll + + - template: ci/sign-files.yml@eng + parameters: + displayName: Sign assemblies + folderPath: 'src/Worker.Extensions.DurableTask/bin/Release' + pattern: '*DurableTask.dll' + signType: dll + + # dotnet pack + # Packaging needs to be a separate step from build. + # This will automatically pick up the signed DLLs. + - task: DotNetCoreCLI@2 + displayName: 'dotnet pack WebJobs.Extensions.DurableTask.csproj' + inputs: + command: pack + packagesToPack: 'src/**/WebJobs.Extensions.DurableTask.csproj' + configuration: Release + packDirectory: $(build.artifactStagingDirectory) + nobuild: true + + + # dotnet pack + # Packaging needs to be a separate step from build. + # This will automatically pick up the signed DLLs. + - task: DotNetCoreCLI@2 + displayName: 'dotnet pack Worker.Extensions.DurableTask.csproj' + inputs: + command: pack + packagesToPack: 'src/**/Worker.Extensions.DurableTask.csproj' + configuration: Release + packDirectory: $(build.artifactStagingDirectory) + nobuild: true + + # Remove redundant symbol package(s) + - script: | + echo *** Searching for .symbols.nupkg files to delete... + dir /s /b *.symbols.nupkg + + echo *** Deleting .symbols.nupkg files... + del /S /Q *.symbols.nupkg + + echo *** Listing remaining packages + dir /s /b *.nupkg + displayName: 'Remove Redundant Symbols Package(s)' + continueOnError: true + + - template: ci/sign-files.yml@eng + parameters: + displayName: Sign NugetPackages + folderPath: $(build.artifactStagingDirectory) + pattern: '*.nupkg' + signType: nuget + + # zip .NET in-proc perf tests + - task: DotNetCoreCLI@2 + displayName: 'Zip .NET in-proc perf tests' + inputs: + command: 'publish' + publishWebProjects: false + projects: '$(System.DefaultWorkingDirectory)/test/PerfTests/DFPerfTests/**/*.csproj' + arguments: '-o $(System.DefaultWorkingDirectory)/test/PerfTests/DFPerfTests/Output' + zipAfterPublish: true + modifyOutputPath: true + + # Move zip'ed .NET in-proc perf tests to the ADO publishing directory + - task: CopyFiles@2 + inputs: + SourceFolder: '$(System.DefaultWorkingDirectory)/test/PerfTests/DFPerfTests/Output/' + Contents: '**' + TargetFolder: '$(System.DefaultWorkingDirectory)/azure-functions-durable-extension/' + + # We also need to build the Java smoke test, for CodeQL compliance + # We don't need to build the other smoke tests, because they can be analyzed without being compiled, + # as they're interpreted languages. + # This could be a separate pipeline, but the task is so small that it's paired with the .NET code build + # for convenience. + - pwsh: | + cd ./test/SmokeTests/OOProcSmokeTests/durableJava/ + gradle build + ls + displayName: 'Build Java OOProc test (for CodeQL compliance)' \ No newline at end of file