-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJenkinsfile
More file actions
129 lines (119 loc) · 5.32 KB
/
Jenkinsfile
File metadata and controls
129 lines (119 loc) · 5.32 KB
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
pipeline {
agent any
parameters {
// Steam beta branch name. Leave empty for the default/stable release.
// Example: 'beta' for a public beta, or 'some_private_branch accesscode' for password-protected branches.
string(name: 'SE_BETA_BRANCH', defaultValue: '', description: 'Steam beta branch for SE Dedicated Server (leave empty for stable)')
}
environment {
APP_NAME = 'Ignite App'
BUILD_VERSION = '1.0.0'
// Space Engineers Dedicated Server Steam App ID
SE_DS_APP_ID = '298740'
// Derive a cache key from the branch so each game version gets its own cache
GAME_BRANCH_KEY = "${params.SE_BETA_BRANCH ? params.SE_BETA_BRANCH.split(' ')[0] : 'public'}"
// Persistent cache directory (survives workspace cleans)
CACHE_DIR = "${JENKINS_HOME}\\caches\\ignite-se"
// SteamCMD is shared across all branches
STEAMCMD_DIR = "${JENKINS_HOME}\\caches\\ignite-se\\SteamCMD"
// Game server cache is per-branch so stable and beta don't collide
GAME_CACHE_DIR = "${JENKINS_HOME}\\caches\\ignite-se\\GameServer-${GAME_BRANCH_KEY}"
// Path where the build expects game references
SE_DS_PATH = "${WORKSPACE}\\IgniteSE1\\DedicatedServer64"
STEAMCMD_ZIP_URL = 'https://steamcdn-a.akamaihd.net/client/installer/steamcmd.zip'
}
stages {
stage('Checkout') {
steps {
echo 'Checking out code from repository...'
checkout scm
}
}
stage('Install SteamCMD') {
steps {
echo 'Checking SteamCMD cache...'
bat """
if not exist "%STEAMCMD_DIR%\\steamcmd.exe" (
echo SteamCMD not found in cache, downloading...
mkdir "%STEAMCMD_DIR%" 2>nul
powershell -Command "Invoke-WebRequest -Uri '%STEAMCMD_ZIP_URL%' -OutFile '%CACHE_DIR%\\steamcmd.zip'"
powershell -Command "Expand-Archive -Path '%CACHE_DIR%\\steamcmd.zip' -DestinationPath '%STEAMCMD_DIR%' -Force"
del "%CACHE_DIR%\\steamcmd.zip"
) else (
echo SteamCMD already cached, skipping download.
)
"""
}
}
stage('Update SE Dedicated Server') {
steps {
echo "Updating SE Dedicated Server cache (branch: ${env.GAME_BRANCH_KEY})..."
script {
// Build the -beta argument only if a branch was specified
def betaArg = params.SE_BETA_BRANCH?.trim() ? "-beta ${params.SE_BETA_BRANCH}" : ''
bat """
cmd /c ""%STEAMCMD_DIR%\\steamcmd.exe" +@ShutdownOnFailedCommand 1 +@NoPromptForPassword 1 +force_install_dir "%GAME_CACHE_DIR%" +login anonymous +app_update %SE_DS_APP_ID% ${betaArg} +quit"
"""
}
}
}
stage('Link Game References') {
steps {
echo 'Creating junction to cached game files...'
bat """
if exist "%SE_DS_PATH%" rmdir "%SE_DS_PATH%"
mklink /J "%SE_DS_PATH%" "%GAME_CACHE_DIR%\\DedicatedServer64"
"""
}
}
stage('Restore NuGet Packages') {
steps {
echo 'Restoring NuGet packages...'
// nuget restore for packages.config projects (IgniteSE1)
bat 'nuget restore IgniteSE1.slnx'
// dotnet restore for SDK-style projects (IgniteAPI, IgniteWebUI) to resolve project references and NuGet packages
bat 'dotnet restore IgniteSE1.slnx'
}
}
stage('Build') {
steps {
echo "Building ${env.APP_NAME}..."
// Build the entire solution, excluding the docker-compose project from Release builds
bat 'msbuild IgniteSE1.slnx /p:Configuration=Release /p:Platform="Any CPU" /t:Rebuild /m /p:BuildDockerCompose=false /v:minimal'
}
}
stage('Project Tests') {
parallel {
stage('Test Ignite API') {
steps {
echo 'Running IgniteAPI tests...'
bat 'dotnet test Tests\\IgniteAPI.Tests\\IgniteAPI.Tests.csproj --configuration Release --verbosity minimal'
}
}
stage('Test Ignite WebUI') {
steps {
echo 'Running IgniteWebUI tests...'
bat 'dotnet test Tests\\IgniteWebUI.Tests\\IgniteWebUI.Tests.csproj --configuration Release --verbosity minimal'
}
}
stage('Test IgniteSE1 Console') {
steps {
echo 'Running IgniteSE1 tests...'
bat 'dotnet test Tests\\IgniteSE1.Tests\\IgniteSE1.Tests.csproj --configuration Release --verbosity minimal'
}
}
}
}
}
post {
always {
echo 'Pipeline execution finished.'
}
success {
echo 'Build was successful!'
}
failure {
echo 'Build failed. Sending alerts...'
}
}
}