From 234754fd491b02a903fa88f3886329f937be0836 Mon Sep 17 00:00:00 2001 From: Westin Miller Date: Sat, 19 Aug 2017 20:31:08 -0700 Subject: [PATCH 1/4] Initial continuous integration support --- Jenkinsfile | 13 +++++++++++++ jenkins-grab-se.ps1 | 22 ++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 Jenkinsfile create mode 100644 jenkins-grab-se.ps1 diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..e60c641 --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,13 @@ +node { + stage 'Checkout' + checkout scm + + stage 'Build' + bat 'powershell -File jenkins-grab-se.ps1' + bat 'mklink /J GameBinaries "C:/Steam/Data/DedicatedServer64/"' + bat 'nuget restore Torch.sln' + bat "\"${tool 'MSBuild'}\" Torch.sln /p:Configuration=Release /p:Platform=x64" + + state 'Archive' + archive 'bin/x64/Release/Torch.*' +} \ No newline at end of file diff --git a/jenkins-grab-se.ps1 b/jenkins-grab-se.ps1 new file mode 100644 index 0000000..7670e02 --- /dev/null +++ b/jenkins-grab-se.ps1 @@ -0,0 +1,22 @@ +pushd + +$steamData = "C:/Steam/Data/" +$steamCMDPath = "C:/Steam/steamcmd/" +$steamCMDZip = "C:/Steam/steamcmd.zip" + +Add-Type -AssemblyName System.IO.Compression.FileSystem + +if (!(Test-Path $steamData)) { + mkdir "$steamData" +} +if (!(Test-Path $steamCMDPath)) { + if (!(Test-Path $steamCMDZip)) { + (New-Object System.Net.WebClient).DownloadFile("https://steamcdn-a.akamaihd.net/client/installer/steamcmd.zip", "$steamCMDZip"); + } + [System.IO.Compression.ZipFile]::ExtractToDirectory($steamCMDZip, $steamCMDPath) +} + +cd "$steamData" +& "$steamCMDPath/steamcmd.exe" "+login anonymous" "+force_install_dir $steamData" "+app_update 298740" "+quit" + +popd \ No newline at end of file From 0686e95c72bda96ea1b383a29b931b010084ff75 Mon Sep 17 00:00:00 2001 From: Westin Miller Date: Sat, 19 Aug 2017 20:52:03 -0700 Subject: [PATCH 2/4] Delete existing link --- Jenkinsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Jenkinsfile b/Jenkinsfile index e60c641..6269448 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -4,6 +4,7 @@ node { stage 'Build' bat 'powershell -File jenkins-grab-se.ps1' + bat 'rmdir GameBinaries' bat 'mklink /J GameBinaries "C:/Steam/Data/DedicatedServer64/"' bat 'nuget restore Torch.sln' bat "\"${tool 'MSBuild'}\" Torch.sln /p:Configuration=Release /p:Platform=x64" From afc10911f75d110828b0870059c3bcb1e7c8e602 Mon Sep 17 00:00:00 2001 From: Westin Miller Date: Sat, 19 Aug 2017 21:17:58 -0700 Subject: [PATCH 3/4] More descriptive stages --- Jenkinsfile | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 6269448..ef2c6d0 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,14 +1,25 @@ node { - stage 'Checkout' - checkout scm + stages { + stage('Checkout') { + checkout scm + } - stage 'Build' - bat 'powershell -File jenkins-grab-se.ps1' - bat 'rmdir GameBinaries' - bat 'mklink /J GameBinaries "C:/Steam/Data/DedicatedServer64/"' - bat 'nuget restore Torch.sln' - bat "\"${tool 'MSBuild'}\" Torch.sln /p:Configuration=Release /p:Platform=x64" + stage('Acquire SE') { + bat 'powershell -File jenkins-grab-se.ps1' + bat 'rmdir GameBinaries' + bat 'mklink /J GameBinaries "C:/Steam/Data/DedicatedServer64/"' + } + + stage('Acquire NuGet Packages') { + bat 'nuget restore Torch.sln' + } - state 'Archive' - archive 'bin/x64/Release/Torch.*' + stage('Build') { + bat "\"${tool 'MSBuild'}\" Torch.sln /p:Configuration=Release /p:Platform=x64" + } + + state('Archive') { + archive 'bin/x64/Release/Torch.*' + } + } } \ No newline at end of file From a6d5da861f891d94be1905b5e659f29703a7e4b3 Mon Sep 17 00:00:00 2001 From: Westin Miller Date: Sat, 19 Aug 2017 21:22:21 -0700 Subject: [PATCH 4/4] Pipeline DSL --- Jenkinsfile | 36 +++++++++++++++++------------------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index ef2c6d0..624849f 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -1,25 +1,23 @@ node { - stages { - stage('Checkout') { - checkout scm - } + stage('Checkout') { + checkout scm + } - stage('Acquire SE') { - bat 'powershell -File jenkins-grab-se.ps1' - bat 'rmdir GameBinaries' - bat 'mklink /J GameBinaries "C:/Steam/Data/DedicatedServer64/"' - } - - stage('Acquire NuGet Packages') { - bat 'nuget restore Torch.sln' - } + stage('Acquire SE') { + bat 'powershell -File jenkins-grab-se.ps1' + bat 'rmdir GameBinaries' + bat 'mklink /J GameBinaries "C:/Steam/Data/DedicatedServer64/"' + } - stage('Build') { - bat "\"${tool 'MSBuild'}\" Torch.sln /p:Configuration=Release /p:Platform=x64" - } + stage('Acquire NuGet Packages') { + bat 'nuget restore Torch.sln' + } - state('Archive') { - archive 'bin/x64/Release/Torch.*' - } + stage('Build') { + bat "\"${tool 'MSBuild'}msbuild\" Torch.sln /p:Configuration=Release /p:Platform=x64" + } + + state('Archive') { + archive 'bin/x64/Release/Torch.*' } } \ No newline at end of file