def add_artifacts_packages(self, package_id=None): if package_id is not None: self.yml['artifacts']['packages']['paths'].append( dss(f'{PATH_PACKAGES_temp}/{package_id}/{PATH_PACKAGES}')) else: self.yml['artifacts']['packages']['paths'].append( dss(PATH_PACKAGES))
def get_job_definition(self, agent, packages, target_branch, auto_version): bump_packages_args = " ".join([ f'--{package["type"]}-path {package["path"]}' for package in packages ]) # construct job job = YMLJob() job.set_name(f'Auto version') job.set_agent(agent) job.add_var_custom( 'PATH', '/home/bokken/bin:/home/bokken/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/sbin:/home/bokken/.npm-global/bin' ) job.add_var_custom('DISPLAY', dss(":0")) job.add_commands([ f'npm install upm-ci-utils@stable -g --registry {NPM_UPMCI_INSTALL_URL}', f'upm-ci utils auto-version bump {bump_packages_args}', f'upm-ci utils auto-version commit --push' ]) job.add_trigger_integration_branch(target_branch) job.add_artifacts_packages() # if auto_version is True: # job.add_trigger_integration_branch(target_branch) return job
def get_job_definition(self, platform, editor, agent): components = platform["components"] if platform["os"].lower() == 'android': platform_os = 'windows' elif platform["os"].lower() == 'ios': platform_os = 'macos' else: platform_os = platform["os"] # construct job job = YMLJob() job.set_name(f'[{editor["version"]},{platform["os"]}] Editor priming') job.set_agent(agent) job.set_skip_checkout(True) job.add_var_custom( 'PATH', '/home/bokken/bin:/home/bokken/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/sbin:/home/bokken/.npm-global/bin' ) job.add_var_custom('DISPLAY', dss(":0")) job.add_var_upm_registry() job.add_var_custom_revision(editor["version"]) job.add_commands([ f'pip install unity-downloader-cli --user --upgrade --extra-index-url https://artifactory.internal.unity3d.com/api/pypi/common-python/simple --upgrade', f'unity-downloader-cli {editor["cmd"]} -o {platform_os} --wait --skip-download {"".join([f"-c {c} " for c in components])} > {PATH_UNITY_REVISION}' ]) job.add_artifacts_unity_revision() return job
def get_job_definition(self, platform, agent): components = platform["components"] if platform["os"].lower() == 'android': platform_os = 'windows' elif platform["os"].lower() == 'ios': platform_os = 'macos' else: platform_os = platform["os"] tmp_revision_file = "tmp_" + PATH_UNITY_REVISION # construct job job = YMLJob() job.set_name(f'[Min_Editor,{platform["os"]}] Editor priming') job.set_agent(agent) job.add_var_custom( 'PATH', '/home/bokken/bin:/home/bokken/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/sbin:/home/bokken/.npm-global/bin' ) job.add_var_custom('DISPLAY', dss(":0")) job.add_var_upm_registry() job.add_commands([ f'pip install unity-downloader-cli --user --upgrade --index-url {UNITY_DOWNLOADER_CLI_URL} --upgrade', f'python3 .yamato/ruamel/jobs/editor/util/get_minimum_editor_version.py {tmp_revision_file}', f'unity-downloader-cli --source-file {tmp_revision_file} -c {platform_os} --wait --skip-download {"".join([f"-c {c} " for c in components])} > {PATH_UNITY_REVISION}', f'rm {tmp_revision_file}' ]) job.add_artifacts_unity_revision() return job
def get_job_definition(self, project, editor, expression_trigger, dependencies_in_all): # define dependencies dependencies = [] for dep in dependencies_in_all: project_dep = dep.get('project', project) if dep.get("pr"): dependencies.append({ 'path': f'{project_filepath_all(project_dep)}#{project_job_id_pr(project_dep, editor["name"])}', 'rerun': editor["rerun_strategy"]}) else: for test_platform in dep["test_platforms"]: file = project_filepath_specific(project_dep, dep["platform"], dep["api"]) job_id = project_job_id_test(project_dep,dep["platform"],dep["api"],test_platform,editor["name"],dep["build_config"],dep["color_space"]) dependencies.append({ 'path' : f'{file}#{job_id}', 'rerun' : editor["rerun_strategy"]}) # construct job job = YMLJob() job.set_name(f'{project} PR Job - {editor["name"]}') job.add_dependencies(dependencies) if expression_trigger != "" and editor["name"].lower() != "custom-revision": job.set_trigger_on_expression(expression_trigger) job.add_var_custom_revision(editor["track"]) job.add_var_custom('UTR_VERSION', dss("current")) job.add_var_custom('TEST_FILTER', '.*') if project == "URP_Performance_BoatAttack": job.add_var_custom('BOAT_ATTACK_BRANCH', 'master') job.add_var_custom('BOAT_ATTACK_REVISION', '88679d7ebeeae4be30f43ebe88cba830f363803b') return job
def get_job_definition(self, platform, editor, agent): components = platform["components"] if platform["os"].lower() == 'android': platform_os = 'windows' elif platform["os"].lower() == 'ios': platform_os = 'macos' else: platform_os = platform["os"] editor_cli_rev = VAR_CUSTOM_REVISION if str( editor['track']).lower() == 'custom-revision' else editor["track"] # construct job job = YMLJob() job.set_name(f'[{editor["track"]},{platform["os"]}] Editor priming') job.set_agent(agent) job.set_skip_checkout(True) job.add_var_custom( 'PATH', '/home/bokken/bin:/home/bokken/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/sbin:/home/bokken/.npm-global/bin' ) job.add_var_custom('DISPLAY', dss(":0")) job.add_var_upm_registry() job.add_var_custom_revision(editor["track"]) job.add_commands([ f'pip install unity-downloader-cli --user --upgrade --index-url {UNITY_DOWNLOADER_CLI_URL} --upgrade', f'unity-downloader-cli -u {editor_cli_rev} -o {platform_os} --wait --skip-download {"".join([f"-c {c} " for c in components])} > {PATH_UNITY_REVISION}' ]) job.add_artifacts_unity_revision() return job
def _job(project, test_platform_name, editor, platform, api, cmd, build_config, color_space): # define name if test_platform_name.lower().endswith('_build'): job_name = f'Build {project["name"]} on {platform["name"]}_{api["name"]}_{build_config["name"]}_{color_space}_{test_platform_name}_Player on version {editor["name"]}' else: job_name = f'{project["name"]} on {platform["name"]}_{api["name"]}_{test_platform_name}_{build_config["name"]}_{color_space} on version {editor["name"]}' # define agent platform_agents_project = platform.get(f'agents_project_{api["name"]}', platform.get('agents_project')) if test_platform_name.lower().endswith('_build'): agent = platform_agents_project.get( 'standalone_build', platform_agents_project['default'] ) # replace(" ","_") called for playmode_XR else: agent = platform_agents_project.get( f'{test_platform_name.lower()}', platform_agents_project['default'] ) # replace(" ","_") called for playmode_XR # construct job job = YMLJob() job.set_name(job_name) job.set_agent(agent) job.add_var_upm_registry() job.add_var_custom_revision(editor["track"]) job.add_commands(cmd) job.add_artifacts_test_results() if test_platform_name.lower() == 'standalone': job.add_artifacts_project_logs( project.get("folder_standalone", project["folder"])) else: job.add_artifacts_project_logs(project["folder"]) if not editor['editor_pinning']: job.add_dependencies([{ 'path': f'{editor_priming_filepath()}#{editor_job_id(editor["name"], platform["os"])}', 'rerun': editor["rerun_strategy"] }]) if project["name"] == "URP_Performance_BoatAttack": job.add_var_custom('BOAT_ATTACK_BRANCH', 'master') job.add_var_custom('BOAT_ATTACK_REVISION', '88679d7ebeeae4be30f43ebe88cba830f363803b') job.add_var_custom('UTR_VERSION', dss("current")) job.add_var_custom('TEST_FILTER', '.*') return job
def get_job_definition(self, project, editor, dependencies_in_nightly): # define dependencies dependencies = [] for dep in dependencies_in_nightly: project_dep = dep.get('project', project["name"]) if dep.get("pr"): dependencies.append({ 'path': f'{project_filepath_all(project_dep)}#{project_job_id_pr(project_dep, editor["name"])}', 'rerun': editor["rerun_strategy"] }) elif dep.get("nightly"): dependencies.append({ 'path': f'{project_filepath_all(project_dep)}#{project_job_id_nightly(project_dep, editor["name"])}', 'rerun': editor["rerun_strategy"] }) else: for test_platform in dep["test_platforms"]: file = project_filepath_specific(project_dep, dep["platform"], dep["api"]) job_id = project_job_id_test(project_dep, dep["platform"], dep["api"], test_platform, editor["name"], dep["build_config"], dep["color_space"]) dependencies.append({ 'path': f'{file}#{job_id}', 'rerun': editor["rerun_strategy"] }) # construct job job = YMLJob() job.set_name(f'Nightly {project["name"]} - {editor["name"]}') job.add_dependencies(dependencies) # if expression_trigger != "": # job.set_trigger_on_expression(expression_trigger) job.add_var_custom_revision(editor["track"]) job.add_var_custom('UTR_VERSION', dss("current")) job.add_var_custom('TEST_FILTER', '.*') if project.get('variables'): for key, value in project.get('variables').items(): job.add_var_custom(key, value) return job
def get_job_definition(self, agent, packages, target_branch, auto_version): bump_packages_args = " ".join([ f'--{package["type"]}-path {package["path"]}' for package in packages ]) # construct job job = YMLJob() job.set_name(f'Auto version') job.set_agent(agent) job.add_var_custom( 'PATH', '/home/bokken/bin:/home/bokken/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/sbin:/home/bokken/.npm-global/bin' ) job.add_var_custom('DISPLAY', dss(":0")) job.add_commands([ f'npm install upm-ci-utils@stable -g --registry {NPM_UPMCI_INSTALL_URL}', f'upm-ci utils auto-version bump {bump_packages_args}', f'upm-ci utils auto-version commit --push', f'python3 ./Tools/standalone/templates_auto_bumper.py --template-name ./com.unity.template-hd --target-dependency com.unity.render-pipelines.high-definition', f'python3 ./Tools/standalone/templates_auto_bumper.py --template-name ./com.unity.template-universal --target-dependency com.unity.render-pipelines.universal', pss(f''' git diff --quiet if [[ $? != 0 ]]; then git config --global user.name "*****@*****.**" git config --global user.email "*****@*****.**" git add ./com.unity.template-* git checkout {target_branch} git commit -m "[Automation] Auto-bump template dependencies" git push origin {target_branch} else echo "Did not find any dependency to bump. Will not commit and push anything." fi''') ]) job.set_trigger_on_expression( f'push.branch eq "{target_branch}" AND NOT push.changes.all match ["com.unity.template-*/**/*.json"] AND NOT push.changes.all match ["com.unity.*/package.json"]' ) job.add_artifacts_packages() # if auto_version is True: # job.add_trigger_integration_branch(target_branch) return job
def get_job_definition(self, project, editor, dependencies_in_nightly): # define dependencies dependencies = [] for dep in dependencies_in_nightly: project_dep = dep.get('project', project) if dep.get("pr"): dependencies.append({ 'path': f'{project_filepath_all(project_dep)}#{project_job_id_pr(project_dep, editor["name"])}', 'rerun': editor["rerun_strategy"]}) elif dep.get("nightly"): dependencies.append({ 'path': f'{project_filepath_all(project_dep)}#{project_job_id_nightly(project_dep, editor["name"])}', 'rerun': editor["rerun_strategy"]}) else: for test_platform in dep["test_platforms"]: file = project_filepath_specific(project_dep, dep["platform"], dep["api"]) job_id = project_job_id_test(project_dep,dep["platform"],dep["api"],test_platform,editor["name"],dep["build_config"],dep["color_space"]) dependencies.append({ 'path' : f'{file}#{job_id}', 'rerun' : editor["rerun_strategy"]}) # construct job job = YMLJob() job.set_name(f'Nightly {project} - {editor["name"]}') job.add_dependencies(dependencies) # if expression_trigger != "": # job.set_trigger_on_expression(expression_trigger) job.add_var_custom_revision(editor["track"]) job.add_var_custom('UTR_VERSION', dss("current")) job.add_var_custom('TEST_FILTER', '.*') # if project == "URP_Performance_BoatAttack": # job.add_var_custom('BOAT_ATTACK_BRANCH', 'master') # job.add_var_custom('BOAT_ATTACK_REVISION', '60b6bc595f20b29f4869d3236ce1aa91a490ef6b') return job
def add_artifacts_unity_revision(self): # used by editor self.yml['artifacts']['unity_revision.zip']['paths'].append( dss(PATH_UNITY_REVISION))
def add_artifacts_templates(self): self.yml['artifacts']['packages']['paths'].append(dss(PATH_TEMPLATES))
def add_artifacts_players(self): self.yml['artifacts']['players']['paths'].append( dss(PATH_PLAYERS_padded))
def add_artifacts_project_logs(self, project_folder): self.yml['artifacts']['logs']['paths'].append( dss(f'TestProjects/{project_folder}/Logs/*.log'))
def add_artifacts_test_results(self): self.yml['artifacts']['logs']['paths'].append( dss(PATH_TEST_RESULTS_padded))
def add_artifacts_hdrp_perf_test(self): self.yml['artifacts']['logs']['paths'].append(dss(f'PrebuildLog/**'))