Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Copy necessary target and property files to support pre scenario all …
…in one building.
  • Loading branch information
LoopedBard3 committed Jan 23, 2023
commit 7dd69c76d8d4b2aa7f3a53ddae3fb313996493ed
86 changes: 43 additions & 43 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -559,51 +559,51 @@ jobs:

- ${{ if and(ne(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'Manual')) }}:

# Windows x64 SDK scenario benchmarks
- template: /eng/performance/scenarios.yml
parameters:
osName: windows
osVersion: RS5
architecture: x64
pool:
vmImage: windows-2019
kind: sdk_scenarios
machinePool: Tiger
queue: Windows.10.Amd64.19H1.Tiger.Perf
projectFile: sdk_scenarios.proj
channels:
- $(channel) # for manual runs we can specify channel variable
# # Windows x64 SDK scenario benchmarks
# - template: /eng/performance/scenarios.yml
# parameters:
# osName: windows
# osVersion: RS5
# architecture: x64
# pool:
# vmImage: windows-2019
# kind: sdk_scenarios
# machinePool: Tiger
# queue: Windows.10.Amd64.19H1.Tiger.Perf
# projectFile: sdk_scenarios.proj
# channels:
# - $(channel) # for manual runs we can specify channel variable

# Windows x86 SDK scenario benchmarks
- template: /eng/performance/scenarios.yml
parameters:
osName: windows
osVersion: RS5
architecture: x86
pool:
vmImage: windows-2019
kind: sdk_scenarios
machinePool: Tiger
queue: Windows.10.Amd64.19H1.Tiger.Perf
projectFile: sdk_scenarios.proj
channels:
- $(channel) # for manual runs we can specify channel variable
# # Windows x86 SDK scenario benchmarks
# - template: /eng/performance/scenarios.yml
# parameters:
# osName: windows
# osVersion: RS5
# architecture: x86
# pool:
# vmImage: windows-2019
# kind: sdk_scenarios
# machinePool: Tiger
# queue: Windows.10.Amd64.19H1.Tiger.Perf
# projectFile: sdk_scenarios.proj
# channels:
# - $(channel) # for manual runs we can specify channel variable

# Ubuntu 1804 x64 SDK scenario benchmarks
- template: /eng/performance/scenarios.yml
parameters:
osName: ubuntu
osVersion: 1804
architecture: x64
pool:
vmImage: ubuntu-latest
kind: sdk_scenarios
machinePool: Tiger
queue: Ubuntu.1804.Amd64.Tiger.Perf
container: ubuntu_x64_build_container
projectFile: sdk_scenarios.proj
channels:
- $(channel)
# # Ubuntu 1804 x64 SDK scenario benchmarks
# - template: /eng/performance/scenarios.yml
# parameters:
# osName: ubuntu
# osVersion: 1804
# architecture: x64
# pool:
# vmImage: ubuntu-latest
# kind: sdk_scenarios
# machinePool: Tiger
# queue: Ubuntu.1804.Amd64.Tiger.Perf
# container: ubuntu_x64_build_container
# projectFile: sdk_scenarios.proj
# channels:
# - $(channel)

# Maui Android scenario benchmarks
- template: /eng/performance/scenarios.yml
Expand Down
7 changes: 7 additions & 0 deletions eng/performance/PreparePayloadWorkItems.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<Project>
<Target Name="PreparePayloadWorkItems" Inputs="@(PreparePayloadWorkItem)" Outputs="%(PreparePayloadWorkItem.Identity)">
<Message Text="Command: %(PreparePayloadWorkItem.Command)" />
<Exec Command="%(PreparePayloadWorkItem.Command)" WorkingDirectory="%(PreparePayloadWorkItem.WorkingDirectory)" />
<Exec Command="$(AfterPreparePayloadWorkItemCommand)" WorkingDirectory="%(PreparePayloadWorkItem.WorkingDirectory)" Condition="'$(AfterPreparePayloadWorkItemCommand)' != ''" />
</Target>
</Project>
30 changes: 30 additions & 0 deletions eng/performance/Scenarios.Common.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<Project>
<ItemGroup>
<HelixCorrelationPayload Include="$(CorrelationPayloadDirectory)">
<PayloadDirectory>%(Identity)</PayloadDirectory>
</HelixCorrelationPayload>
</ItemGroup>

<ItemDefinitionGroup>
<HelixWorkItem>
<Timeout>4:00</Timeout>
</HelixWorkItem>
</ItemDefinitionGroup>

<PropertyGroup>
<FrameworkVersion>$(_Framework.Substring($([MSBuild]::Subtract($(_Framework.Length), 3))))</FrameworkVersion>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetsWindows)' == 'true'">
<ScenariosDir>$(WorkItemDirectory)\src\scenarios\</ScenariosDir>
<HelixPreCommands>$(HelixPreCommands);set PYTHONPATH=%HELIX_CORRELATION_PAYLOAD%\scripts%3B%HELIX_CORRELATION_PAYLOAD%</HelixPreCommands>
<RID>win-$(Architecture)</RID>
</PropertyGroup>

<PropertyGroup Condition="'$(TargetsWindows)' != 'true'">
<ScenariosDir>$(WorkItemDirectory)/src/scenarios/</ScenariosDir>
<HelixPreCommands>$(HelixPreCommands);sudo apt-get update;chmod +x $HELIX_CORRELATION_PAYLOAD/startup/perfcollect</HelixPreCommands>
<HelixPreCommands>$(HelixPreCommands);export PYTHONPATH=$HELIX_CORRELATION_PAYLOAD/scripts:$HELIX_CORRELATION_PAYLOAD</HelixPreCommands>
<RID>linux-$(Architecture)</RID>
</PropertyGroup>
</Project>
2 changes: 2 additions & 0 deletions eng/performance/blazor_scenarios.proj
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,6 @@
</HelixWorkItem>
</ItemGroup>

<Import Project="PreparePayloadWorkItems.targets" />

</Project>
2 changes: 1 addition & 1 deletion eng/performance/maui_scenarios_android.proj
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@

<ItemGroup>
<PreparePayloadWorkItem Include="@(MAUIAndroidScenario)">
<Command>$(Python) pre.py publish -f $(PERFLAB_Framework)-android -o $(PreparePayloadWorkItemBaseDirectory)%(PreparePayloadWorkItem.ScenarioDirectoryName) -r android-arm64 --self-contained</Command>
<Command>$(Python) pre.py publish -f $(_Framework)-android -o $(PreparePayloadWorkItemBaseDirectory)%(PreparePayloadWorkItem.ScenarioDirectoryName) -r android-arm64 --self-contained</Command>
<WorkingDirectory>%(PreparePayloadWorkItem.PayloadDirectory)</WorkingDirectory>
</PreparePayloadWorkItem>
</ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions eng/performance/scenarios.proj
Original file line number Diff line number Diff line change
Expand Up @@ -121,5 +121,6 @@
post: %(HelixWorkItem.PostCommands)
timeout: %(HelixWorkItem.Timeout) '"/>
</Target> -->
<Import Project="PreparePayloadWorkItems.targets" />

</Project>
26 changes: 26 additions & 0 deletions eng/performance/scenarios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,19 @@ jobs:
displayName: Build FailureReporter tool
env:
PERFLAB_TARGET_FRAMEWORKS: $(_Framework)
- powershell: |
$(Python) -m pip install --upgrade pip
$(Python) -m pip install requests
.\src\scenarios\init.ps1 -DotnetDirectory $(CorrelationStaging)dotnet
dotnet --info
dotnet msbuild .\eng\performance\${{ parameters.projectFile }} /restore /t:PreparePayloadWorkItems /bl:.\artifacts\log\$(_BuildConfig)\PrepareWorkItemPayloads.binlog
displayName: Prepare scenarios
env:
CorrelationPayloadDirectory: $(CorrelationStaging)
Architecture: ${{ parameters.architecture }}
TargetsWindows: 'true'
WorkItemDirectory: $(Build.SourcesDirectory)
HelixTargetQueues: ${{ parameters.queue }}
- ${{ if ne(parameters.osName, 'windows') }}:
- script: cp ./NuGet.config $(CorrelationStaging);cp -r ./scripts $(CorrelationStaging)scripts;cp -r ./src/scenarios/shared $(CorrelationStaging)shared;cp -r ./src/scenarios/staticdeps $(CorrelationStaging)staticdeps
displayName: Copy python libraries and NuGet.config
Expand All @@ -119,6 +132,19 @@ jobs:
displayName: Build FailureReporter tool
env:
PERFLAB_TARGET_FRAMEWORKS: $(_Framework)
- script: |
$(Python) -m pip install --upgrade pip
$(Python) -m pip install requests
. ./src/scenarios/init.sh -dotnetdir $(CorrelationStaging)dotnet
dotnet --info
dotnet msbuild ./eng/performance/${{ parameters.projectFile }} /restore /t:PreparePayloadWorkItems /bl:./artifacts/log/$(_BuildConfig)/PrepareWorkItemPayloads.binlog
displayName: Prepare scenarios
env:
CorrelationPayloadDirectory: $(CorrelationStaging)
Architecture: ${{ parameters.architecture }}
TargetsWindows: 'false'
WorkItemDirectory: $(Build.SourcesDirectory)
HelixTargetQueues: ${{ parameters.queue }}
- template: /eng/performance/send-to-helix.yml
parameters:
HelixSource: '$(HelixSourcePrefix)/dotnet/performance/$(Build.SourceBranch)' # sources must start with pr/, official/, prodcon/, or agent/
Expand Down
1 change: 1 addition & 0 deletions eng/performance/sdk_scenarios.proj
Original file line number Diff line number Diff line change
Expand Up @@ -189,5 +189,6 @@
<Timeout>4:00</Timeout>
</HelixWorkItem>
</ItemGroup>
<Import Project="PreparePayloadWorkItems.targets" />
</Project>

80 changes: 60 additions & 20 deletions src/scenarios/shared/precommands.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,16 @@
PUBLISH = 'publish'
CROSSGEN = 'crossgen'
CROSSGEN2 = 'crossgen2'
EXTRACT = 'extract'
DEBUG = 'Debug'
RELEASE = 'Release'

OPERATIONS = (DEFAULT,
BUILD,
PUBLISH,
CROSSGEN,
CROSSGEN2
CROSSGEN2,
EXTRACT
)

class PreCommands:
Expand All @@ -46,12 +48,30 @@ def __init__(self):

default_parser = subparsers.add_parser(DEFAULT, help='Default operation (placeholder command and no specific operation will be executed)' )
self.add_common_arguments(default_parser)

extract_parser = subparsers.add_parser(EXTRACT, help='Used for local runs that extract the binaries to be run from a zip file. Requires a path to the zip' )
self.add_common_arguments(extract_parser)
extract_parser.add_argument('-p', '--pathtozip',
dest='pathtozip',
metavar='pathtozip',
help='Path to the zip file to extract',
required=True)

build_parser = subparsers.add_parser(BUILD, help='Builds the project')
self.add_common_arguments(build_parser)

publish_parser = subparsers.add_parser(PUBLISH, help='Publishes the project')
self.add_common_arguments(publish_parser)
publish_parser.add_argument('--self-contained',
dest='self_contained',
default=False,
action='store_true',
help='Publish SCD')
publish_parser.add_argument('--no-self-contained',
dest='no_self_contained',
default=False,
action='store_true',
help='Publish FDD')

crossgen_parser = subparsers.add_parser(CROSSGEN, help='Runs crossgen on a particular file')
self.add_common_arguments(crossgen_parser)
Expand All @@ -77,11 +97,18 @@ def __init__(self):
self.binlog = args.binlog
self.has_workload = args.has_workload
self.readonly_dotnet = args.readonly_dotnet

self.windows = args.windows
self.output = args.output

if self.operation == PUBLISH:
self.self_contained = args.self_contained
self.no_self_contained = args.no_self_contained
if self.operation == CROSSGEN:
self.crossgen_arguments.parse_crossgen_args(args)
if self.operation == CROSSGEN2:
self.crossgen_arguments.parse_crossgen2_args(args)
if self.operation == EXTRACT:
self.pathtozip = args.pathtozip


def new(self,
Expand Down Expand Up @@ -145,6 +172,14 @@ def add_common_arguments(self, parser: ArgumentParser):
default=False,
action='store_true',
help='Indicates that the dotnet being used should not be modified (for example, when it is ahared with other builds)')
parser.add_argument('--windowsui',
dest='windows',
action='store_true',
help='must be set for UI tests so the proper rid is used')
parser.add_argument('-o', '--output',
dest='output',
metavar='output',
help='output directory')
parser.set_defaults(configuration=RELEASE)

def existing(self, projectdir: str, projectfile: str):
Expand All @@ -160,12 +195,14 @@ def execute(self, build_args: list = []):
pass
if self.operation == BUILD:
self._restore()
self._build(configuration=self.configuration, framework=self.framework, build_args=build_args)
self._build(configuration=self.configuration, framework=self.framework, output=self.output, build_args=build_args)
if self.operation == PUBLISH:
self._restore()
self._publish(configuration=self.configuration,
runtime_identifier=self.runtime_identifier,
framework=self.framework, build_args=build_args)
if self.self_contained:
build_args.append('--self-contained')
elif self.no_self_contained:
build_args.append('--no-self-contained')
self._publish(configuration=self.configuration, runtime_identifier=self.runtime_identifier, framework=self.framework, output=self.output, build_args=build_args)
if self.operation == CROSSGEN:
startup_args = [
os.path.join(self.crossgen_arguments.coreroot, 'crossgen%s' % extension()),
Expand Down Expand Up @@ -230,30 +267,33 @@ def _parsemsbuildproperties(self) -> list:
def _updateframework(self, projectfile: str):
'Update the <TargetFramework> property so we can re-use the template'
if self.framework:
replace_line(projectfile, r'<TargetFramework>.*?</TargetFramework>', f'<TargetFramework>{self.framework}</TargetFramework>')
if self.windows:
replace_line(projectfile, r'<TargetFramework>.*?</TargetFramework>', f'<TargetFramework>{self.framework}-windows</TargetFramework>')
else:
replace_line(projectfile, r'<TargetFramework>.*?</TargetFramework>', f'<TargetFramework>{self.framework}</TargetFramework>')

def _publish(self, configuration: str, framework: str = None, runtime_identifier: str = None, build_args: list = []):
def _publish(self, configuration: str, framework: str = None, runtime_identifier: str = None, output: str = None, build_args: list = []):
self.project.publish(configuration,
const.PUBDIR,
output or const.PUBDIR,
True,
os.path.join(get_packages_directory(), ''), # blazor publish targets require the trailing slash for joining the paths
framework,
framework if not self.windows else f'{framework}-windows',
runtime_identifier,
self._parsemsbuildproperties(),
'-bl:%s' % self.binlog if self.binlog else "",
*build_args
)
*['-bl:%s' % self.binlog] if self.binlog else [],
*build_args)

def _restore(self):
self.project.restore(packages_path=get_packages_directory(), verbose=True)

def _build(self, configuration: str, framework: str = None, build_args: list = []):
self.project.build(configuration=configuration,
verbose=True,
packages_path=get_packages_directory(),
target_framework_monikers=[framework],
output_to_bindir=True,
*build_args)
def _build(self, configuration: str, framework: str = None, output: str = None, build_args: list = []):
self.project.build(configuration,
True,
get_packages_directory(),
[framework],
output is None,
None,
(['--output', output] if output else []) + build_args)

def _backup(self, projectdir:str):
'Copy from projectdir to appdir so we do not modify the source code'
Expand Down
Loading