-
Notifications
You must be signed in to change notification settings - Fork 0
279 lines (248 loc) · 10.5 KB
/
Copy pathunity-server-build.yml
File metadata and controls
279 lines (248 loc) · 10.5 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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
name: Unity Server Build
# ============================================
# Dedicated Server ビルド専用ワークフロー(手動実行)
# Windows / Linux サーバービルドを実行
#
# 使用例:
# gh workflow run "Unity Server Build" --field build_target=DedicatedServerLinux
# ============================================
on:
workflow_dispatch:
inputs:
build_target:
description: 'Server build target'
required: true
default: 'DedicatedServerLinux'
type: choice
options:
- DedicatedServerWindows
- DedicatedServerLinux
- All
skip_tests:
description: 'Skip tests before build'
required: false
default: false
type: boolean
game_environment:
description: 'Game environment (affects scripting define symbols)'
required: true
default: 'Develop'
type: choice
options:
- Local
- Develop
- Staging
- Review
- Release
concurrency:
group: ${{ github.workflow }}-${{ github.run_id }}
cancel-in-progress: false
jobs:
# ============================================
# 設定読み込み
# ============================================
load-config:
name: Load Configuration
runs-on: [self-hosted, linux, unity, docker]
outputs:
unity_project_path: ${{ steps.config.outputs.UNITY_PROJECT_PATH }}
cache_key_prefix: ${{ steps.config.outputs.CACHE_KEY_PREFIX }}
build_retention_days: ${{ steps.config.outputs.BUILD_RETENTION_DAYS }}
build_timestamp: ${{ steps.timestamp.outputs.value }}
build_profile_type: ${{ steps.profile.outputs.type }}
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
sparse-checkout: .github
- name: Generate build timestamp
id: timestamp
run: echo "value=$(date +'%Y%m%d_%H%M%S')" >> $GITHUB_OUTPUT
- name: Determine Build Profile type
id: profile
run: |
case "${{ inputs.game_environment }}" in
Local|Develop|Staging)
echo "type=Development" >> $GITHUB_OUTPUT
;;
Review|Release)
echo "type=Release" >> $GITHUB_OUTPUT
;;
*)
echo "type=Development" >> $GITHUB_OUTPUT
;;
esac
- name: Load configuration
id: config
run: |
chmod +x .github/scripts/load-config.sh
.github/scripts/load-config.sh
# ============================================
# テスト(スキップ可能)
# ============================================
test:
name: Run Tests
runs-on: [self-hosted, linux, unity, docker, linux-il2cpp]
needs: load-config
if: ${{ !inputs.skip_tests }}
timeout-minutes: 180
env:
UNITY_PROJECT_PATH: ${{ needs.load-config.outputs.unity_project_path }}
CACHE_KEY_PREFIX: ${{ needs.load-config.outputs.cache_key_prefix }}
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
lfs: false
clean: false
- name: Setup Library cache (persistent volume)
run: |
chmod +x .github/scripts/setup-library-cache.sh
.github/scripts/setup-library-cache.sh "${{ env.UNITY_PROJECT_PATH }}" "Linux64"
- name: Setup directories
run: |
mkdir -p "${{ github.workspace }}/Logs"
mkdir -p "${{ github.workspace }}/TestResults"
- name: Run EditMode tests
run: |
source .github/scripts/setup-accelerator.sh
xvfb-run --auto-servernum --server-args='-screen 0 1920x1080x24' \
unity-editor \
-runTests \
-batchmode \
-nographics \
-projectPath "${{ env.UNITY_PROJECT_PATH }}" \
$ACCELERATOR_ARGS \
-testResults "${{ github.workspace }}/TestResults/editmode-results.xml" \
-testPlatform EditMode \
-logFile "${{ github.workspace }}/Logs/editmode-test.log"
- name: Upload test results
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
if: always()
with:
name: Server-Test-Results-${{ needs.load-config.outputs.build_timestamp }}
path: TestResults/
- name: Upload test log
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
if: always()
with:
name: Server-Test-Log-${{ needs.load-config.outputs.build_timestamp }}
path: Logs/editmode-test.log
# ============================================
# Windows Dedicated Server ビルド
# ============================================
build-windows-server:
name: Build Windows Dedicated Server
# windows-mono image は win64_server_*_mono バリアントを内包するため windows-mono runner で対応可
runs-on: [self-hosted, linux, unity, docker, windows-mono]
needs: [load-config, test]
if: |
always() &&
(needs.test.result == 'success' || needs.test.result == 'skipped') &&
(inputs.build_target == 'DedicatedServerWindows' || inputs.build_target == 'All')
timeout-minutes: 180
env:
UNITY_PROJECT_PATH: ${{ needs.load-config.outputs.unity_project_path }}
CACHE_KEY_PREFIX: ${{ needs.load-config.outputs.cache_key_prefix }}
BUILD_RETENTION_DAYS: ${{ needs.load-config.outputs.build_retention_days }}
BUILD_TIMESTAMP: ${{ needs.load-config.outputs.build_timestamp }}
BUILD_PROFILE_TYPE: ${{ needs.load-config.outputs.build_profile_type }}
GAME_ENVIRONMENT: ${{ inputs.game_environment }}
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
lfs: false
clean: false
- name: Setup Library cache (persistent volume)
run: |
chmod +x .github/scripts/setup-library-cache.sh
.github/scripts/setup-library-cache.sh "${{ env.UNITY_PROJECT_PATH }}" "Win64"
- name: Setup directories
run: |
mkdir -p "${{ github.workspace }}/Logs"
- name: Build Windows Dedicated Server
run: |
source .github/scripts/setup-accelerator.sh
xvfb-run --auto-servernum --server-args='-screen 0 1920x1080x24' \
unity-editor \
-batchmode \
-nographics \
-quit \
-projectPath "${{ env.UNITY_PROJECT_PATH }}" \
$ACCELERATOR_ARGS \
-activeBuildProfile "Assets/Settings/Build Profiles/Windows Server - ${{ env.BUILD_PROFILE_TYPE }}.asset" \
-executeMethod Game.Editor.Build.BuildScript.BuildDedicatedServerWindows \
-buildTimestamp "${{ env.BUILD_TIMESTAMP }}" \
-logFile "${{ github.workspace }}/Logs/build-windows-server.log"
- name: Upload Windows Server build
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: DedicatedServer-Windows-Build-${{ env.BUILD_TIMESTAMP }}
path: ${{ env.UNITY_PROJECT_PATH }}/Builds/CiBuilds/Server-Windows/${{ env.BUILD_TIMESTAMP }}
retention-days: ${{ fromJSON(env.BUILD_RETENTION_DAYS) }}
- name: Upload build log
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
if: always()
with:
name: DedicatedServer-Windows-Build-Log-${{ env.BUILD_TIMESTAMP }}
path: Logs/build-windows-server.log
# ============================================
# Linux Dedicated Server ビルド
# ============================================
build-linux-server:
name: Build Linux Dedicated Server
# linux-il2cpp image は linux64_server_*_il2cpp / mono バリアントを内包するため linux-il2cpp runner で対応可
runs-on: [self-hosted, linux, unity, docker, linux-il2cpp]
needs: [load-config, test]
if: |
always() &&
(needs.test.result == 'success' || needs.test.result == 'skipped') &&
(inputs.build_target == 'DedicatedServerLinux' || inputs.build_target == 'All')
timeout-minutes: 180
env:
UNITY_PROJECT_PATH: ${{ needs.load-config.outputs.unity_project_path }}
CACHE_KEY_PREFIX: ${{ needs.load-config.outputs.cache_key_prefix }}
BUILD_RETENTION_DAYS: ${{ needs.load-config.outputs.build_retention_days }}
BUILD_TIMESTAMP: ${{ needs.load-config.outputs.build_timestamp }}
BUILD_PROFILE_TYPE: ${{ needs.load-config.outputs.build_profile_type }}
GAME_ENVIRONMENT: ${{ inputs.game_environment }}
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
lfs: false
clean: false
- name: Setup Library cache (persistent volume)
run: |
chmod +x .github/scripts/setup-library-cache.sh
.github/scripts/setup-library-cache.sh "${{ env.UNITY_PROJECT_PATH }}" "Linux64"
- name: Setup directories
run: |
mkdir -p "${{ github.workspace }}/Logs"
- name: Build Linux Dedicated Server
run: |
source .github/scripts/setup-accelerator.sh
xvfb-run --auto-servernum --server-args='-screen 0 1920x1080x24' \
unity-editor \
-batchmode \
-nographics \
-quit \
-projectPath "${{ env.UNITY_PROJECT_PATH }}" \
$ACCELERATOR_ARGS \
-activeBuildProfile "Assets/Settings/Build Profiles/Linux Server - ${{ env.BUILD_PROFILE_TYPE }}.asset" \
-executeMethod Game.Editor.Build.BuildScript.BuildDedicatedServerLinux \
-buildTimestamp "${{ env.BUILD_TIMESTAMP }}" \
-logFile "${{ github.workspace }}/Logs/build-linux-server.log"
- name: Upload Linux Server build
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: DedicatedServer-Linux-Build-${{ env.BUILD_TIMESTAMP }}
path: ${{ env.UNITY_PROJECT_PATH }}/Builds/CiBuilds/Server/Linux/${{ env.BUILD_TIMESTAMP }}
retention-days: ${{ fromJSON(env.BUILD_RETENTION_DAYS) }}
- name: Upload build log
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
if: always()
with:
name: DedicatedServer-Linux-Build-Log-${{ env.BUILD_TIMESTAMP }}
path: Logs/build-linux-server.log