-
-
Notifications
You must be signed in to change notification settings - Fork 13
305 lines (304 loc) · 11.7 KB
/
main.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
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
name: build
on: [push, pull_request]
jobs:
linux-build:
runs-on: ubuntu-20.04
strategy:
matrix:
ffmpeg: [n5.0, n6.0]
steps:
- name: Update APT
run: sudo apt-get update
- name: Install Dependencies
run: |
sudo apt-get install --assume-yes build-essential git make cmake autoconf automake libcurl4-openssl-dev \
libtool pkg-config libasound2-dev libpulse-dev libaudio-dev \
libjack-dev libx11-dev libxext-dev libxrandr-dev libxcursor-dev \
libxfixes-dev libxi-dev libxinerama-dev libxxf86vm-dev libxss-dev \
libgl1-mesa-dev libdbus-1-dev libudev-dev libgles2-mesa-dev \
libegl1-mesa-dev libibus-1.0-dev fcitx-libs-dev libsamplerate0-dev \
libsndio-dev libwayland-dev libxkbcommon-dev libdrm-dev libgbm-dev
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ">=3.10"
- name: Checkout love-appimage-source
uses: actions/checkout@v4
with:
repository: DarkEnergyProcessor/ls2-love-appimage-script
- name: Checkout LÖVE
uses: actions/checkout@v4
with:
repository: DarkEnergyProcessor/livesim3-love
path: love2d-master
submodules: recursive
- name: Checkout livesim2
uses: actions/checkout@v4
with:
path: depls2
submodules: true
- name: Get love-appimage-source Commit
id: las
run: python depls2/build-util/gha_commit_hash.py
- name: Get LOVE Commit
id: love
working-directory: love2d-master
run: python ../depls2/build-util/gha_commit_hash.py
- name: Pre-Prepare AppImage
run: make appimagetool LuaJIT-v2.1/Makefile
- name: Get LuaJIT branch
id: luajit
working-directory: LuaJIT-v2.1
run: python ../depls2/build-util/gha_commit_hash.py
- name: Restore Compiled AppImage
id: appimage
uses: actions/cache@v4
with:
key: ${{ steps.las.outputs.commit }}-${{ steps.luajit.outputs.commit }}-${{ steps.love.outputs.commit }}-${{ matrix.ffmpeg }}
path: squashfs-root
- name: Get Dependencies for AppImage
if: steps.appimage.outputs.cache-hit != 'true'
shell: python
env:
FFMPEG_BRANCH: ${{ matrix.ffmpeg }}
run: |
import os
for i in range(250):
if os.system(f"make getdeps FFMPEG_BRANCH={os.environ['FFMPEG_BRANCH']} LOVE_BRANCH=master") == 0:
raise SystemExit(0)
raise Exception("make getdeps failed")
- name: Build AppImage
if: steps.appimage.outputs.cache-hit != 'true'
env:
FFMPEG_BRANCH: ${{ matrix.ffmpeg }}
run: make FFMPEG_BRANCH=$FFMPEG_BRANCH LOVE_BRANCH=master
- name: Extract AppImage
if: steps.appimage.outputs.cache-hit != 'true'
run: ./love-master.AppImage --appimage-extract
- name: Copy squashfs-root to dist
run: cp -r squashfs-root dist
- name: Add livesim2
run: cp -r depls2 dist/share/livesim2
- name: Delete Stuff
working-directory: dist/share/livesim2
run: rm -rf .git build-util
- name: Update AppImage Metadata
working-directory: dist
run: |
set -e
rm love.svg love.desktop
cp ../depls2/assets/image/icon/new_icon_1024x1024.png livesim2.png
cp ../depls2/build-util/livesim2.desktop livesim2.desktop
- name: Build tar
working-directory: dist
run: tar cvzf ../livesim2.tar.gz *
- name: Build AppImage
run: ./appimagetool dist livesim2.AppImage
- name: Artifact AppImage
uses: actions/upload-artifact@v4
with:
name: livesim2-ffmpeg-${{ matrix.ffmpeg }}.AppImage
path: livesim2.AppImage
if-no-files-found: error
- name: Artifact tar
uses: actions/upload-artifact@v4
with:
name: livesim2-ffmpeg-${{ matrix.ffmpeg }}.tar.gz
path: livesim2.tar.gz
if-no-files-found: error
windows-build:
# windows-latest is required due to setCaseSensitiveInfo
runs-on: windows-latest
strategy:
matrix:
ffmpeg: ["5.0.1", "6.0"]
defaults:
run:
shell: cmd
steps:
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ">=3.10"
- name: Make Directory and Set Case Sensitive Mode
run: |
mkdir depls2
if errorlevel 1 exit /b 1
fsutil file setCaseSensitiveInfo depls2
if errorlevel 1 exit /b 1
- name: Checkout
uses: actions/checkout@v4
with:
path: depls2
- name: Clone Megasource
uses: actions/checkout@v4
with:
path: megasource
repository: love2d/megasource
ref: 11.x
- name: Get Megasource Commit
id: megasource
working-directory: megasource
run: python ../depls2/build-util/gha_commit_hash.py
- name: Checkout LOVE
uses: actions/checkout@v4
with:
path: megasource/libs/love
repository: DarkEnergyProcessor/livesim3-love
submodules: recursive
- name: Get LOVE Commit
id: love
working-directory: megasource/libs/love
run: python ../../../depls2/build-util/gha_commit_hash.py
- name: Restore Resource Hacker
id: resourcehacker
uses: actions/cache@v4
with:
key: resourcehacker
path: resourcehacker
- name: Get Resource Hacker
if: steps.resourcehacker.outputs.cache-hit != 'true'
run: |
curl -Lfo resourcehacker.zip http://www.angusj.com/resourcehacker/resource_hacker.zip
if errorlevel 1 exit /b 1
mkdir resourcehacker
if errorlevel 1 exit /b 1
7z x -oresourcehacker resourcehacker.zip
if errorlevel 1 exit /b 1
- name: Generate Icon
run: magick convert depls2/assets/image/icon/new_icon_1024x1024.png -resize 256x256 -define icon:auto-resize="256,128,96,64,48,32,16" livesim2.ico
- name: Generate Resource File
run: |
copy /y depls2\build-util\livesim2.manifest livesim2.manifest
if errorlevel 1 exit /b 1
python depls2/build-util/create_rc.py depls2/main.lua livesim2.rc
if errorlevel 1 exit /b 1
start "" /B /WAIT resourcehacker\ResourceHacker.exe -open livesim2.rc -save livesim2.res -action compile
- name: Download FFmpeg Development Libraries
env:
FFMPEG_VERSION: ${{ matrix.ffmpeg }}
run: curl -Lo ffmpeg-dev.7z https://github.com/GyanD/codexffmpeg/releases/download/%FFMPEG_VERSION%/ffmpeg-%FFMPEG_VERSION%-full_build-shared.7z
- name: Extract FFmpeg Development Libraries
run: 7z x ffmpeg-dev.7z
- name: Restore Compiled LOVE
id: lovec
uses: actions/cache@v4
with:
path: installdir
key: ${{ steps.megasource.outputs.commit }}-${{ steps.love.outputs.commit }}-${{ matrix.ffmpeg }}
- name: Configure
if: steps.lovec.outputs.cache-hit != 'true'
env:
FFMPEG_VERSION: ${{ matrix.ffmpeg }}
run: |
set BUILD_TARGET=x64
set LS2X_LIBAV_TARGET=-DLS2X_LIBAV_INCLUDE_DIR=%CD%\ffmpeg-%FFMPEG_VERSION%-full_build-shared\include
cmake -Bbuild -Smegasource -T v143 -A %BUILD_TARGET% --install-prefix=%CD%\installdir %LS2X_LIBAV_TARGET% -DLOVE_MPG123=0
- name: Build
if: steps.lovec.outputs.cache-hit != 'true'
run: cmake --build build --config Release --target install -j2
- name: Archive Lua Scripts
working-directory: depls2
run: |
echo 1> OUTSIDE_ASSET
7z a -ssc ../livesim2_luascript.zip -ir!*.lua OUTSIDE_ASSET
if errorlevel 1 exit /b 1
del OUTSIDE_ASSET
exit /b 0
- name: Make dist Directory
run: |
mkdir dist
if errorlevel 1 exit /b 1
fsutil file setCaseSensitiveInfo dist
if errorlevel 1 exit /b 1
- name: Copy depls2 to dist
run: xcopy depls2 dist /e /y /h /r
- name: Delete Some Stuff
working-directory: dist
run: |
del /s /q *.lua love_*.exe TODO.txt .gitignore .gitmodules mpg123.dll
rmdir /s /q .git .github build-util docs game libs
exit /b 0
- name: Copy LOVE to dist
run: |
xcopy installdir dist /e /y /h /r
if errorlevel 1 exit /b 1
del /s /q love_*.exe mpg123.dll
exit /b 0
- name: Replace Resource Data
run: |
copy /Y /B dist\lovec_*.exe temp.exe
if errorlevel 1 exit /b 1
start "" /B /WAIT resourcehacker\ResourceHacker.exe -open temp.exe -save newtemp.exe -action addoverwrite -res livesim2.res
- name: Fuse
run: copy /B newtemp.exe+livesim2_luascript.zip dist\livesim2.exe
- name: Test Version
working-directory: dist
run: livesim2.exe -version
- name: Artifact
uses: actions/upload-artifact@v4
with:
name: livesim2-ffmpeg-${{ matrix.ffmpeg }}
path: dist
if-no-files-found: error
android-build:
runs-on: ubuntu-latest
strategy:
matrix:
build_type: [Debug, Release]
steps:
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ">=3.10"
- name: Setup Java 17
uses: actions/setup-java@v4
with:
distribution: adopt-hotspot
java-version: 17
- name: Get livesim3-love-android Commit
id: ls3a
run: git ls-remote https://github.com/DarkEnergyProcessor/livesim3-love-android master | awk '{ print "commit="$1}' >> $GITHUB_OUTPUT
- name: Restore livesim3-love-android Cache
id: ls3a_cache
uses: actions/cache@v4
with:
key: ${{ steps.ls3a.outputs.commit }}-${{ matrix.build_type }}
path: livesim3-love-android-cached
- name: Checkout livesim3-love-android
uses: actions/checkout@v4
if: ${{ steps.ls3a_cache.outputs.cache-hit != 'true' }}
with:
repository: DarkEnergyProcessor/livesim3-love-android
path: livesim3-love-android
submodules: recursive
- name: Build livesim3-love-android
if: ${{ steps.ls3a_cache.outputs.cache-hit != 'true' }}
working-directory: livesim3-love-android
run: bash ./gradlew assembleEmbedNoRecord${{ matrix.build_type }}
- name: Copy Partially Compiled Directory (Cache Miss)
if: ${{ steps.ls3a_cache.outputs.cache-hit != 'true' }}
run: cp -r livesim3-love-android livesim3-love-android-cached
- name: Copy Partially Compiled Directory (Cache Hit)
if: ${{ steps.ls3a_cache.outputs.cache-hit == 'true' }}
run: cp -r livesim3-love-android-cached livesim3-love-android
- name: Checkout livesim2
uses: actions/checkout@v4
with:
path: livesim3-love-android/app/src/embed/assets
submodules: true
- name: Replace Version Information
working-directory: livesim3-love-android
run: python app/src/embed/assets/build-util/replace_gradle_properties.py app/src/embed/assets/main.lua gradle.properties -o gradle.properties
- name: Delete Some Stuff
working-directory: livesim3-love-android/app/src/embed/assets
run: rm -rf .git build-util
- name: Build APK
working-directory: livesim3-love-android
run: bash ./gradlew assembleEmbedNoRecord${{ matrix.build_type }}
- name: Artifact APK
uses: actions/upload-artifact@v4
with:
name: livesim2-android-${{ matrix.build_type }}
path: livesim3-love-android/app/build/outputs/apk
if-no-files-found: error