-
Notifications
You must be signed in to change notification settings - Fork 4
255 lines (213 loc) · 9.92 KB
/
build-Linux.yml
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
name: 🔨 Build - Linux
on:
workflow_call:
inputs:
versionName:
description: "Version Name"
type: string
required: true
buildType:
description: "Build Type"
type: string
required: true
default: "development"
# Inputs - Base Game repository
gameRepositoryAuthor:
description: "Base Game - Repository Author"
default: "YARC-Official"
type: string
gameRepositoryName:
description: "Base Game - Repository Name"
default: "YARG"
type: string
gameRepositoryBranch:
description: "Base Game - Repository Branch"
default: "dev"
type: string
# Inputs - YARG.Core repository
customCoreRepository:
description: "Using custom YARG.Core repository/branch"
type: boolean
default: false
coreRepositoryAuthor:
description: "YARG.Core - Repository Author"
default: "YARC-Official"
type: string
coreRepositoryName:
description: "YARG.Core - Repository Name"
default: "YARG.Core"
type: string
coreRepositoryBranch:
description: "YARG.Core - Repository Branch"
default: "master"
type: string
outputs:
artifactId:
description: "Artifact ID"
value: ${{ jobs.linuxBuilder.outputs.artifactId }}
env:
platform: "Linux"
unityVersion: "2021.3.36f1"
unityVersionHash: "7a0645017be0"
blenderMajorVersion: "3.4"
blenderVersion: "3.4.1"
versionName: ${{ inputs.versionName }}
gameRepositoryAuthor: ${{ inputs.gameRepositoryAuthor }}
gameRepositoryName: ${{ inputs.gameRepositoryName }}
gameRepositoryBranch: ${{ inputs.gameRepositoryBranch }}
coreRepositoryAuthor: ${{ inputs.coreRepositoryAuthor }}
coreRepositoryName: ${{ inputs.coreRepositoryName }}
coreRepositoryBranch: ${{ inputs.coreRepositoryBranch }}
jobs:
linuxBuilder:
name: 🔨 Build - Linux
runs-on: ubuntu-22.04
timeout-minutes: 90
steps:
#############################
# Install Unity #
#############################
- name: "[Install] Install dependencies"
run: |
sudo apt-get -q update &&
sudo apt-get -q install -y --no-install-recommends apt-utils &&
sudo apt-get -q install -y --no-install-recommends --allow-downgrades ca-certificates libasound2 libc6-dev libcap2 libgconf-2-4 libglu1 libgtk-3-0 libncurses5 libnotify4 libnss3 libxtst6 libxss1 cpio lsb-release xvfb xz-utils &&
sudo apt-get clean &&
sudo rm -rf /var/lib/apt/lists/* &&
sudo apt-get -q update &&
sudo apt-get -q install -y --no-install-recommends software-properties-common &&
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test &&
sudo apt-get -q install -y --only-upgrade libstdc++6 &&
sudo add-apt-repository -y --remove ppa:ubuntu-toolchain-r/test &&
sudo apt-get -q remove -y --auto-remove software-properties-common &&
sudo apt-get clean &&
sudo rm -rf /var/lib/apt/lists/*
- name: "[Install] Download Unity Editor + Linux IL2CPP builder"
run: |
mkdir ${{ runner.temp }}/UnityInstall &&
curl -L -o "${{ runner.temp }}/UnityInstall/UnitySetup-Editor.tar.xz" https://download.unity3d.com/download_unity/${{ env.unityVersionHash }}/LinuxEditorInstaller/Unity-${{ env.unityVersion }}.tar.xz &&
curl -L -o "${{ runner.temp }}/UnityInstall/UnitySetup-Linux-IL2CPP-Support.tar.xz" https://download.unity3d.com/download_unity/${{ env.unityVersionHash }}/LinuxEditorTargetInstaller/UnitySetup-Linux-IL2CPP-Support-for-Editor-${{ env.unityVersion }}.tar.xz
- name: "[Install] Install Unity Editor + Linux IL2CPP builder"
run: |
mkdir "${{ runner.temp }}/Unity" &&
tar -xvf "${{ runner.temp }}/UnityInstall/UnitySetup-Editor.tar.xz" -C "${{ runner.temp }}/Unity" &&
tar -xvf "${{ runner.temp }}/UnityInstall/UnitySetup-Linux-IL2CPP-Support.tar.xz" -C "${{ runner.temp }}/Unity" &&
rm -rf "${{ runner.temp }}/UnityInstall"
#############################
# Checkout #
#############################
- name: "[Pre-install] Pull project"
uses: nschloe/[email protected]
with:
repository: ${{ env.gameRepositoryAuthor }}/${{ env.gameRepositoryName }}
ref: ${{ env.gameRepositoryBranch }}
submodules: recursive
fetch-depth: 0
- name: "[Pre-install] Pull latest submodules"
run: git submodule update
- if: ${{ inputs.customCoreRepository == true }}
name: "[Pre-install] Pull YARG.Core"
uses: actions/checkout@v4
with:
repository: ${{ env.coreRepositoryAuthor }}/${{ env.coreRepositoryName }}
ref: ${{ env.coreRepositoryBranch }}
path: YARG.Core
- name: "[Pre-install] Pull bleeding-edge repository"
uses: actions/checkout@v4
with:
repository: ${{ github.repository }}
path: bleedingedge
#############################
# Cache #
#############################
- name: "[Pre-install] Restore 'library' cache"
uses: actions/cache@v4
with:
path: Library
key: ${{ env.platform }}-YARG_Library
#############################
# Add build flag definition #
#############################
- if: ${{ inputs.buildType == 'nightly' }}
name: "[Pre-build] Create a csc.rsp file (nightly)"
shell: bash
run: >
touch Assets/csc.rsp &&
echo "-define:YARG_NIGHTLY_BUILD" >> Assets/csc.rsp
- if: ${{ inputs.buildType == 'development' }}
name: "[Pre-build] Create a csc.rsp file (development)"
shell: bash
run: >
touch Assets/csc.rsp &&
echo "-define:YARG_TEST_BUILD" >> Assets/csc.rsp
#############################
# Install Blender #
#############################
- name: "[Pre-install] Get Blender (${{ env.blenderVersion }}) from cache"
id: blender
uses: actions/cache@v4
with:
path: ${{ runner.temp }}/BlenderInstall
key: Linux_Blender-${{ env.blenderVersion }}
restore-keys: Linux_Blender-
- if: ${{ steps.blender.outputs.cache-hit != 'true' }}
name: "[Pre-install] Download Blender (${{ env.blenderVersion }})"
continue-on-error: true
run: mkdir ${{ runner.temp }}/BlenderInstall && curl -L -o "${{ runner.temp }}/BlenderInstall/blender.tar.xz" https://download.blender.org/release/Blender${{ env.blenderMajorVersion }}/blender-${{ env.blenderVersion }}-linux-x64.tar.xz
- name: "[Pre-install] Install Blender (${{ env.blenderVersion }})"
run: >
sudo tar xvf "${{ runner.temp }}/BlenderInstall/blender.tar.xz" -C /opt/ &&
sudo mv /opt/blender*/ /opt/blender &&
sudo ln -sf /opt/blender/blender /usr/bin/blender
#############################
# Restore Packages #
#############################
- name: "[Pre-install] Install dotnet 8.x"
uses: actions/setup-dotnet@v4
with:
dotnet-version: "8.0.x"
- name: "[Pre-install] Restoring NuGet Packages"
run: dotnet tool install --global NuGetForUnity.Cli && nugetforunity restore
#############################
# Replace icon #
#############################
- if: ${{ inputs.buildType == 'development' }}
name: "[Pre-build] Replace icon with Development"
run: "cp -f bleedingedge/static/Icon_Development.png Assets/Art/UI/Icon_Stable.png"
- if: ${{ inputs.buildType == 'nightly' }}
name: "[Pre-build] Replace icon with Nightly"
run: "cp -f bleedingedge/static/Icon_Nightly.png Assets/Art/UI/Icon_Stable.png"
#############################
# Build YARG.Core #
#############################
- name: "[Pre-build] Build YARG.Core"
run: >
mkdir Assets/Plugins/YARG.Core &&
dotnet build YARG.Core/YARG.Core/YARG.Core.csproj /property:GenerateFullPaths=true /consoleloggerparameters:NoSummary --output Assets/Plugins/YARG.Core
#############################
# Build #
#############################
- name: "[Build] Run Builder"
run: |
${{ runner.temp }}/Unity/Editor/Unity -quit -batchmode -nographics -projectPath ${{ github.workspace }} -buildTarget StandaloneLinux64 -buildLinux64Player ${{ github.workspace }}/build/YARG -username ${{ secrets.LINUX_UNITY_EMAIL || secrets.UNITY_EMAIL }} -password ${{ secrets.LINUX_UNITY_PASSWORD || secrets.UNITY_PASSWORD }} -serial ${{ secrets.LINUX_UNITY_SERIAL || secrets.UNITY_SERIAL }} -logfile -
- name: "[Post-build] Remove YARG_BurstDebugInformation_DoNotShip"
run: (cd build && rm -rf YARG_BurstDebugInformation_DoNotShip)
- name: "[Post-build] Return license"
continue-on-error: true
run: ${{ runner.temp }}/Unity/Editor/Unity -quit -batchmode -nographics -returnlicense -projectPath ${{ github.workspace }} -username ${{ secrets.LINUX_UNITY_EMAIL || secrets.UNITY_EMAIL }} -password ${{ secrets.LINUX_UNITY_PASSWORD || secrets.UNITY_PASSWORD }} -logfile -
#############################
# Compress #
#############################
- name: "[Post-build] Compress to a .zip"
run: mkdir Release && (cd build && zip -r ../Release/YARG_${{ env.versionName }}-Linux-x64.zip .)
#############################
# Upload #
#############################
- name: "[Post-build] Upload to artifacts"
id: artifacts
uses: actions/upload-artifact@v4
with:
name: YARG (${{ env.versionName }}) - ${{ env.platform }}
path: Release/*
outputs:
artifactId: ${{ steps.artifacts.outputs.artifact-id }}