Initial commit for the 2019.3 Yamato MockHMD scripts

This commit is contained in:
Antone Franich 2020-04-16 12:33:17 -07:00
Родитель e0ccbfb4fc
Коммит 70f1633b24
11 изменённых файлов: 8 добавлений и 310 удалений

Просмотреть файл

@ -1,9 +0,0 @@
import os
import utility.Build
#Install Unity with the requested version and components
utility.Build.install_unity(os.getenv('unityVERSION'), os.getenv('includeAndroid'),
os.getenv('includeUWP'), os.getenv('includeIL2CPP'), os.getenv('includeIOS'))
#Build the player with the previously installed Unity version.
utility.Build.build_player(os.getenv('cmd'))

Просмотреть файл

@ -1,67 +0,0 @@
trunk_Functional_MockHMDTests:
name: trunk_Functional_MockHMDTests
variables:
unityVERSION: trunk
dependencies:
- path: .yamato/trunk-Functional-MockHMDTests.yml#trunk_XrPlaymode_MockHMD_MultiPass
rerun: always
- path: .yamato/trunk-Functional-MockHMDTests.yml#trunk_XrPlaymode_MockHMD_Instancing
rerun: always
trunk_XrPlaymode_MockHMD_MultiPass:
name: trunk_XrPlaymode_MockHMD_MultiPass
agent:
type: Unity::VM
image: sdet/gamecode_win10:latest
flavor: b1.large
variables:
unityVERSION: "trunk"
includeAndroid: "False"
includeUWP: "False"
includeIL2CPP: "False"
includeIOS: "False"
cmd: "--suite=playmode --testproject=../FunctionalTests/VR/CrossPlatform_MockHmdXRSDK --platform=StandaloneWindows64
--editor-location=.Editor --player-save-path=build/players --artifacts_path=build/logs --build-only
--extra-editor-arg=\"-enabledxrtarget=MockHMDXRSDK\" --extra-editor-arg=\"-playergraphicsAPI=Direct3D11\"
--extra-editor-arg=\"-stereorenderingpath=MultiPass\" --extra-editor-arg=\"-executeMethod Assets.Editor.Build.CommandLineSetup\""
commands:
- pip install unity-downloader-cli --extra-index-url https://artifactory.internal.unity3d.com/api/pypi/common-python/simple
- dir
- |
cd .yamato
python buildPlayer.py
- curl -s https://artifactory.internal.unity3d.com/core-automation/tools/utr-standalone/utr.bat --output utr.bat
- ./utr --suite=playmode --platform=StandaloneWindows64 --player-load-path=.yamato/build/players --artifacts_path=.yamato/build/test-results --player-connection-ip=auto
artifacts:
logs:
paths:
- ".yamato/build/test-results/**"
trunk_XrPlaymode_MockHMD_Instancing:
name: trunk_XrPlaymode_MockHMD_Instancing
agent:
type: Unity::VM
image: sdet/gamecode_win10:latest
flavor: b1.large
variables:
unityVERSION: "trunk"
includeAndroid: "False"
includeUWP: "False"
includeIL2CPP: "False"
includeIOS: "False"
cmd: "--suite=playmode --testproject=../FunctionalTests/VR/CrossPlatform_MockHmdXRSDK --platform=StandaloneWindows64
--editor-location=.Editor --player-save-path=build/players --artifacts_path=build/logs --build-only
--extra-editor-arg=\"-enabledxrtarget=MockHMDXRSDK\" --extra-editor-arg=\"-playergraphicsAPI=Direct3D11\"
--extra-editor-arg=\"-stereorenderingpath=Instancing\" --extra-editor-arg=\"-executeMethod Assets.Editor.Build.CommandLineSetup\""
commands:
- pip install unity-downloader-cli --extra-index-url https://artifactory.internal.unity3d.com/api/pypi/common-python/simple
- dir
- |
cd .yamato
python buildPlayer.py
- curl -s https://artifactory.internal.unity3d.com/core-automation/tools/utr-standalone/utr.bat --output utr.bat
- ./utr --suite=playmode --platform=StandaloneWindows64 --player-load-path=.yamato/build/players --artifacts_path=.yamato/build/test-results --player-connection-ip=auto
artifacts:
logs:
paths:
- ".yamato/build/test-results/**"

Просмотреть файл

@ -1,39 +0,0 @@
trunk_Functional_QuestTests:
name: trunk_Functional_QuestTests
variables:
unityVERSION: trunk
dependencies:
- path: .yamato/trunk-Functional-QuestTests.yml#trunk_XrPlaymode_Quest_MultiPass
rerun: always
2019.3_URPGraphicsTests_OculusQuest_OpenGLES3_Linear_Multipass:
name: 2019.3_URPGraphicsTests_OculusQuest_OpenGLES3_Linear_Multipass
agent:
type: Unity::VM
image: mobile/android-execution-r19:stable
flavor: b1.xlarge
variables:
unityVERSION: "2019.3/staging"
includeAndroid: "True"
includeUWP: "False"
includeIL2CPP: "False"
includeIOS: "False"
cmd: "--suite=playmode --testproject=../GraphicsTests/URPGraphicsTests --platform=Android
--editor-location=.Editor --player-save-path=build/players --artifacts_path=build/logs --build-only
--extra-editor-arg=\"-enabledxrtarget=Oculus\" --extra-editor-arg=\"-playergraphicsAPI=OpenGLES3\"
--extra-editor-arg=\"-stereorenderingpath=MultiPass\" --extra-editor-arg=\"-colorspace=Linear\"
--extra-editor-arg=\"-executeMethod Setup.SetupAll\""
commands:
- pip install unity-downloader-cli --extra-index-url https://artifactory.internal.unity3d.com/api/pypi/common-python/simple
- dir
- |
cd .yamato
python buildPlayer.py
#I need to trigger the job after this. Or maybe do this as a seperate subtest? Something like build the player then run the test? Let me experiment a little.
artifacts:
players:
paths:
- ".yamato/build/players/**"
logs:
paths:
- ".yamato/build/logs/**"

Просмотреть файл

@ -1,7 +0,0 @@
trunk_FunctionalTests:
name: trunk_FunctionalTests
variables:
unityVERSION: trunk
dependencies:
- path: .yamato/trunk-Functional-MockHMDTests.yml#trunk_Functional_MockHMDTests
rerun: always

Просмотреть файл

@ -1,31 +0,0 @@
#rename to trigger jobs.
trunk-NightlyTrigger:
name: trunk-NightlyTrigger
agent:
type: Unity::VM
image: cds-ops/ubuntu-18.04-base:stable
flavor: b1.small
triggers:
recurring:
- branch: trunk
frequency: 8 * * ?
commands:
- |
#switch to our scripts folder.
cd .yamato
#Manually install required python packages.
pip install unity-downloader-cli --extra-index-url https://artifactory.internal.unity3d.com/api/pypi/common-python/simple --user
pip install requests
python -c '
import os
import utility.versionCheck
import utility.YamatoJobs
unity_version = utility.versionCheck.check_for_new_version("trunk")
print("New unity version:" + unity_version)
if unity_version != "no_new_version":
project_id = utility.YamatoJobs.get_project_id("xr.xrautomatedtests")
utility.YamatoJobs.start_job(project_id,"trunk-RunAllTests.yml","trunk","trunk_RunAllTests")'

Просмотреть файл

@ -1,45 +0,0 @@
#split this out into trunk_RunAllYamatoTests and trunk_RunAllJenlinsTests
trunk_RunAllTests:
name: trunk_RunAllTests
agent:
type: Unity::VM
image: cds-ops/ubuntu-18.04-base:stable
flavor: b1.small
variables:
unityVERSION: trunk
dependencies:
- path: .yamato/trunk-FunctionalTests.yml#trunk_FunctionalTests
rerun: always
commands:
- |
#switch to our scripts folder.
cd .yamato
#Install the python library requests, so that we can make web requests.
pip install requests
python -c '
import utility.JenkinsJob
import os
import sys
project_name = "Trunk-Run_All_Tests_new"
#Retrieve the UnityVERSION, and then determine what type of version it is. (IE: BranchName, UnityVersion, or UnityRevision)
version = os.getenv("unityVERSION")
versionType = utility.JenkinsJob.parse_version(version)
#Set the versionType and Version for passing to the Jenkins job.
params = { versionType : version }
#Invoke the Jenkins Job, and wait for it to complete before returning.
result = utility.JenkinsJob.start_job(project_name,params,True,True)
print("result:" + result)
#check to see if we were successful, otherwise exit out with an error.
if result != "SUCCESS":
sys.exit("Jenkins Job: " + project_name +" has failed!") '
artifacts:
logs:
paths:
- ".yamato/build/test-results/**"

Просмотреть файл

@ -1,65 +0,0 @@
import requests
import hashlib
import sys
import os
#get the artifactory default login credentials from our secret group
artifactory_default_user = os.getenv("ARTIFACTORY-USERNAME")
artifactory_default_key = os.getenv("ARTIFACTORY-APIKEY")
#set the default location.
artifactory_default_url = 'https://artifactory.internal.unity3d.com/'
#Set the content-type
content_type = 'application/java-archive'
#set the name of the repo we're storing our files in.
artifactory_repo = 'mobile-performance-tests'
#upload a file to artifactory.
def upload_file(filename, artifactory_url=artifactory_default_url, artifactory_user=artifactory_default_user,
artifactory_key=artifactory_default_key):
# filename requires the file to be in the current operating folder.
# Unfortunately this an area in which python seems to be bit wonky.
#This part is where we want the file to be stored in artifactory.
url = artifactory_url + '/' + artifactory_repo + '/' + filename
# checksums are useful for validating that the upload was successful
headers = {'content-type': content_type,
'X-Checksum-Md5': hashlib.md5(open(filename).read()).hexdigest(),
'X-Checksum-Sha1': hashlib.sha1(open(filename).read()).hexdigest()}
#Open a file stream and upload the file to artifactory.
with open(filename, 'rb') as f:
r = requests.put(url, auth=(artifactory_user, artifactory_key), data=f, headers=headers)
# check for a successful upload and return True/False
if r.status_code != 201:
print("Something went wrong")
print("status code: " + str(r.status_code))
print("text: " + r.text)
return False
else:
print ("Upload Successful! File url: " + r.json()['downloadUri'])
return True
#Download the latest hash(version number) file from Artifactory
def download_hash_file(filename, artifactory_url=artifactory_default_url):
# No login credentials required to download as far as I can tell.
# this seems odd, but it may be because we're in network.
url = artifactory_url + '/' + artifactory_repo + '/' + filename
print("Download URL: " + url)
r = requests.get(url)
#If we were able to download the file return the version hash from within it.
#otherwise let the user know we didn't find the file.
if r.status_code == 404:
error = "No File Found at: " + url
return "404"
else:
previousVersionChecked = r.text
print("File downloaded successfully! Hash contained within: "+previousVersionChecked)
return previousVersionChecked

Просмотреть файл

@ -1,39 +0,0 @@
import requests
import sys
import os
import subprocess
#Download and install the requested Unity version with the requested components.
#This requires a pre-install of unity-downloader-cli.
#A future improvement would be to install unity-downloader-cli if it hasn't been.
def install_unity(version, includeAndroid="False", includeUWP="False", includeIL2CPP="False", includeIOS="False"):
# -unity-downloader-cli -u trunk -c editor --wait --published --fast
components = "-c editor"
if includeAndroid.lower() == "true":
components = components + " -c Android"
if includeUWP.lower() == "true":
components = components + " -c UWP"
if includeIL2CPP.lower() == "true":
components = components + " -c StandaloneSupport-IL2CPP"
if includeIOS.lower() == "true":
components = components + " -c iOS"
subprocess.check_output("unity-downloader-cli -u "+version+" " + components + " --wait --published --fast", shell=True)
#Download the latest version of UTR.bat from the internal artifactory.
def download_utr():
url = 'https://artifactory.internal.unity3d.com/core-automation/tools/utr-standalone/utr.bat'
print("Downloading UTR from: " + url)
utr_bat = requests.get(url)
output = os.getcwd() + '/utr.bat'
open(output, 'wb').write(utr_bat.content)
print("Done downloading UTR it can be found at: " + output)
#Build a player with the setting specified by the cmd variable.
def build_player(cmd):
download_utr()
command = "utr.bat "+cmd
print("cmd: " + command)
print(subprocess.check_output(command, shell=True))

Просмотреть файл

@ -12,7 +12,7 @@ branches = ["trunk","2020.1/staging","2019.3/staging","2018.4/staging"]
#Determine what type of version this is.
#This is only used when passing the value along to our pre-existing Jenkins Jobs.
def parse_version(unityVERSION):
def parse_version_for_jenkins(unityVERSION):
#Is it a known branch?
if unityVERSION in branches:
return "unityBranchName"
@ -24,7 +24,7 @@ def parse_version(unityVERSION):
return "unityRevision"
#Start a Jenkins job by using the Rest API to trigger it remotely.
def start_job(jobName, params={}, waitForQueue=False, waitForJobComplete=False, userName=temp_username,
def start_jenkins_job(jobName, params={}, waitForQueue=False, waitForJobComplete=False, userName=temp_username,
APIkey=temp_APIKEY, jobToken=temp_JobToken):
#Set the base URL with out shared username and APIKey.
url = "http://" + userName + ":" + APIkey + "@xrtest.hq.unity3d.com:8080/job/" + jobName + "/buildWithParameters?"

Просмотреть файл

@ -10,7 +10,7 @@ known_projects = {
}
#Start a Yamato job by sending web requests to the Yamato endpoint.
def start_job(project_number, yaml_file_name, branch_name, job_name, revision=os.getenv("GIT_REVISION"), environmentVariables="[]",
def start_yamato_job(project_number, yaml_file_name, branch_name, job_name, revision=os.getenv("GIT_REVISION"), environmentVariables="[]",
apikey=global_apikey, isbearerkey=False):
job_definition = "/projects/" + project_number + "/revisions/" + revision \
+ "/job-definitions/.yamato%2F" + yaml_file_name + "%23" + job_name

Просмотреть файл

@ -1,13 +1,13 @@
import sys
import subprocess
import utility.JenkinsJob
import utility.Artifactory
import utility.ArtifactoryFileTransferManager
default_branch = "trunk"
def check_for_new_version(branch=default_branch):
filename = "last_unity_" + branch
last_checked_version = utility.Artifactory.download_hash_file(filename)
last_checked_version = utility.ArtifactoryFileTransferManager.download_hash_file(filename)
latest_unity_version = subprocess.check_output(
"/home/bokken/.local/bin/unity-downloader-cli -u trunk -c editor --skip-download --fast", shell=True)
if last_checked_version == latest_unity_version:
@ -19,7 +19,7 @@ def check_for_new_version(branch=default_branch):
new_version_file = open(filename, "w+")
new_version_file.write(latest_unity_version)
new_version_file.close()
utility.Artifactory.upload_file(filename)
utility.ArtifactoryFileTransferManager.upload_file(filename)
return latest_unity_version