This repository has been archived by the owner on Mar 26, 2024. It is now read-only.
forked from TorchAPI/Essentials
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJenkinsfile
72 lines (60 loc) · 2.55 KB
/
Jenkinsfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
def test_with_torch(branch)
{
try {
stage('Acquire Torch ' + branch) {
bat 'IF EXIST TorchBinaries RMDIR /S /Q TorchBinaries'
bat 'mkdir TorchBinaries'
step([$class: 'CopyArtifact', projectName: "Torch/${branch}", filter: "**/Torch*.dll", flatten: true, fingerprintArtifacts: true, target: "TorchBinaries"])
step([$class: 'CopyArtifact', projectName: "Torch/${branch}", filter: "**/Torch*.exe", flatten: true, fingerprintArtifacts: true, target: "TorchBinaries"])
}
stage('Build + Torch ' + branch) {
currentBuild.description = bat(returnStdout: true, script: '@powershell -File Versioning/version.ps1').trim()
bat "IF EXIST \"bin\" rmdir /Q /S \"bin\""
bat "IF EXIST \"bin-test\" rmdir /Q /S \"bin-test\""
bat "\"${tool 'MSBuild'}msbuild\" Essentials.sln /p:Configuration=${buildMode} /p:Platform=x64 /t:Clean"
bat "\"${tool 'MSBuild'}msbuild\" Essentials.sln /p:Configuration=${buildMode} /p:Platform=x64"
}
stage('Test + Torch ' + branch) {
}
return true
} catch (e) {
return false
}
}
node('windows') {
stage('Checkout') {
checkout scm
bat 'git pull https://github.com/TorchAPI/Essentials/ master --tags'
}
stage('Acquire SE') {
bat 'powershell -File Jenkins/jenkins-grab-se.ps1'
bat 'IF EXIST GameBinaries RMDIR GameBinaries'
bat 'mklink /J GameBinaries "C:/Steam/Data/DedicatedServer64/"'
}
stage('Acquire NuGet Packages') {
bat 'cd C:\\Program Files\\Jenkins'
bat '"C:\\Program Files\\Jenkins\\nuget.exe" restore Essentials.sln'
}
if (env.BRANCH_NAME == "master") {
buildMode = "Release"
} else {
buildMode = "Debug"
}
result = test_with_torch("master")
if (result) {
currentBuild.result = "SUCCESS"
stage('Archive') {
archiveArtifacts artifacts: "bin/x64/${buildMode}/Essentials.*", caseSensitive: false, fingerprint: true, onlyIfSuccessful: true
zipFile = "bin\\essentials.zip"
packageDir = "bin\\essentials\\"
bat "IF EXIST ${zipFile} DEL ${zipFile}"
bat "IF EXIST ${packageDir} RMDIR /S /Q ${packageDir}"
bat "xcopy bin\\x64\\${buildMode}\\Essentials.* ${packageDir}"
powershell "(Get-Content manifest.xml).Replace('\${VERSION}', [System.Diagnostics.FileVersionInfo]::GetVersionInfo(\"\$PWD\\${packageDir}Essentials.dll\").ProductVersion) | Set-Content \"${packageDir}/manifest.xml\""
powershell "Add-Type -Assembly System.IO.Compression.FileSystem; [System.IO.Compression.ZipFile]::CreateFromDirectory(\"\$PWD\\${packageDir}\", \"\$PWD\\${zipFile}\")"
archiveArtifacts artifacts: zipFile, caseSensitive: false, onlyIfSuccessful: true
}
}
else
currentBuild.result = "FAIL"
}