Skip to content

Commit

Permalink
CI-Unity: login with AHK
Browse files Browse the repository at this point in the history
  • Loading branch information
llafuente committed Dec 5, 2016
1 parent 7833076 commit 307bd63
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 13 deletions.
43 changes: 43 additions & 0 deletions Scripts/unity.ahk
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
; This script was created using Pulover's Macro Creator
; www.macrocreator.com

#NoEnv
SetWorkingDir %A_ScriptDir%
CoordMode, Mouse, Window
SendMode Input
#SingleInstance Force
SetTitleMatchMode 2
#WinActivateForce
SetControlDelay 1
SetWinDelay 0
SetKeyDelay -1
SetMouseDelay -1
SetBatchLines -1


Macro1:
Run, C:\Program Files\Unity\Editor\Unity.exe, , , PID
WinWaitActive, ahk_pid %PID%
Sleep, 333
WinActivate, ahk_pid %PID%
Sleep, 333
Sleep, 7500
; username
Sleep, 100
; move to next input, password
Send, {Tab}
; password
Sleep, 100
; tab to submit
Send, {Tab}
Sleep, 100
Send, {Tab}
Sleep, 100
; submit!
Send, {Enter}
; wait and close
Sleep, 7500
WinClose, ahk_pid %PID%
Sleep, 333
Return

40 changes: 27 additions & 13 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,40 +1,49 @@
version: '{build}'
os: Visual Studio 2015
platform: x64

# Invoke-WebRequest "http://beta.unity3d.com/download/d44b7ab76b45/Windows64EditorInstaller/UnitySetup64-5.5.0f1.exe" -OutFile .\UnitySetup64.exe
# Invoke-WebRequest "https://bitbucket.org/Unity-Technologies/unitytesttools/get/5.5.zip" -OutFile .\UnityTestTools.zip
install:
- ps: >
Invoke-WebRequest "http://beta.unity3d.com/download/d44b7ab76b45/Windows64EditorInstaller/UnitySetup64-5.5.0f1.exe" -OutFile .\UnitySetup64.exe
(Get-Item .\UnitySetup64.exe).length
date
Invoke-WebRequest "http://netstorage.unity3d.com/unity/01f4c123905a/Windows64EditorInstaller/UnitySetup64-5.4.3f1.exe" -OutFile .\UnitySetup64.exe
Start-Process -FilePath ".\UnitySetup64.exe" -Wait -ArgumentList ('/S', '/Q')
date
Invoke-WebRequest "http://ahkscript.org/download/ahk-install.exe" -OutFile .\ahk-installer.exe
Start-Process -FilePath ".\ahk-installer.exe" -Wait -ArgumentList ('/S')
Invoke-WebRequest "https://bitbucket.org/Unity-Technologies/unitytesttools/get/5.5.zip" -OutFile .\UnityTestTools.zip
Invoke-WebRequest "https://bitbucket.org/Unity-Technologies/unitytesttools/get/5.3.zip" -OutFile .\UnityTestTools.zip
(Get-Item .\UnityTestTools.zip).length
Expand-Archive .\UnityTestTools.zip .
Move-Item Unity-Technologies-unitytesttools-*\Assets\UnityTestTools C:\projects\unity-platformer\Assets\UnityTestTools
$pass = $env:UNITY_PASSWORD -split ''
$pass_commands = "Send, {" + ($pass[1..($pass.Length-2)] -join "}`nSleep, 100`nSend, {") + "}`n"
$user = $env:UNITY_USERNAME -split ''
$user_commands = "Send, {" + ($user[1..($user.Length-2)] -join "}`nSleep, 100`nSend, {") + "}`n"
(Get-Content C:\projects\unity-platformer\Scripts\unity.ahk).replace('; username', $user_commands).replace('; password', $pass_commands) | Set-Content C:\projects\unity-platformer\unity.ahk
$env:Path += ";C:\Program Files\AutoHotkey"
Start-Process -FilePath "AutoHotkey.exe" -Wait -ArgumentList ('C:\projects\unity-platformer\unity.ahk')
build: off

test_script:
- ps: >
$env:Path += ";C:\Program Files\Unity\Editor"
date
Start-Process -FilePath "Unity.exe" -Wait -ArgumentList ('-batchmode', '-nographics', '-projectPath', 'C:\projects\unity-platformer', '-runEditorTests', '-editorTestsResultFile', 'C:\projects\unity-platformer\unit-test-results.xml', '-editorTestsFilter', 'UnityPlatformer', '-logFile', 'C:\projects\unity-platformer\log-unit-test.txt', '-quit', '-force-free')
date
Start-Sleep -s 1
Start-Process -FilePath "Unity.exe" -Wait -ArgumentList ('-batchmode', '-nographics', '-projectPath', 'C:\projects\unity-platformer', '-runEditorTests', '-editorTestsResultFile', 'C:\projects\unity-platformer\unit-test-results.xml', '-editorTestsFilter', 'UnityPlatformer', '-logFile', 'C:\projects\unity-platformer\log-unit-test.txt', '-quit', '-force-free')
Get-Content C:\projects\unity-platformer\log-unit-test.txt
Expand All @@ -46,5 +55,10 @@ test_script:
deploy: off

environment:
UNITY_USERNAME:
secure: ZhLFHmOtbEY+OR2B1RZTT/O4hoyCPZcyYbINwRg9WQY=
UNITY_PASSWORD:
secure: C+GziLnSW/7+WeChq9DTDw==
#cache:
# - C:\Program Files\Unity\ -> appveyor.yml

0 comments on commit 307bd63

Please sign in to comment.