Skip to content

Commit b930361

Browse files
committed
Replace godot-videodecoder with EIRTeam.FFmpeg
1 parent 6177c27 commit b930361

18 files changed

+1167
-1681
lines changed

.github/workflows/linux_build.yml

Lines changed: 219 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -5,84 +5,172 @@ on:
55
- 'main'
66
pull_request:
77

8+
env:
9+
GODOT_VERSION: "4.2.1"
10+
811
jobs:
9-
build-linux:
12+
build-ffmpeg:
1013
runs-on: "ubuntu-20.04"
11-
name: Build
14+
name: Build FFmpeg (${{ matrix.name }})
1215
strategy:
1316
matrix:
1417
include:
1518
- name: 32 Bits
16-
arch: x86_32
17-
bin: godot.linuxbsd.template_release.x86_32
18-
template: godot_32
19-
videodecoder: linux_32
19+
cache_key: x86_32
20+
arch: linux32
2021
- name: 64 Bits
21-
arch: x86_64
22-
bin: godot.linuxbsd.template_release.x86_64
23-
template: godot_64
24-
videodecoder: linux_64
22+
cache_key: x86_64
23+
arch: linux64
2524

2625
steps:
27-
- name: "Checkout RetroHub"
26+
- name: "Check cached build"
27+
id: "cache_ffmpeg"
28+
uses: actions/cache@v4
29+
with:
30+
path: cached_builds/ffmpeg
31+
key: Linux-${{ matrix.cache_key }}-ffmpeg-build
32+
restore-keys: Linux-${{ matrix.cache_key }}-ffmpeg-build
33+
save-always: true
34+
lookup-only: true
35+
continue-on-error: true
36+
37+
- name: "Checkout FFmpeg"
38+
if: steps.cache_ffmpeg.outputs.cache-hit != 'true'
2839
uses: actions/checkout@v4
2940
with:
30-
path: "retrohub"
41+
repository: retrohub-org/FFmpeg-Builds
42+
path: "ffmpeg"
43+
44+
- name: "Free space"
45+
if: steps.cache_ffmpeg.outputs.cache-hit != 'true'
46+
run: |
47+
df -h
48+
sudo apt-get clean
49+
docker system prune -a -f
50+
sudo rm -rf /usr/local/lib/android /usr/share/dotnet /opt/ghc
51+
df -h
52+
53+
- name: "Compilation"
54+
if: steps.cache_ffmpeg.outputs.cache-hit != 'true'
55+
working-directory: ./ffmpeg
56+
run: |
57+
./makeimage.sh ${{ matrix.arch }} lgpl-godot 6.0
58+
./build.sh ${{ matrix.arch }} lgpl-godot 6.0
59+
mkdir -p -v ../cached_builds/ffmpeg
60+
tar -xvf artifacts/ffmpeg*${{ matrix.arch }}-lgpl-godot-6.0.tar.xz --directory=../cached_builds/ffmpeg --strip-components=1
61+
ls -la ../cached_builds/ffmpeg
62+
63+
build-eirteam_ffmpeg:
64+
runs-on: "ubuntu-20.04"
65+
name: Build EIRTeam.FFmpeg (${{ matrix.name }})
66+
needs: [build-ffmpeg]
67+
strategy:
68+
matrix:
69+
include:
70+
- name: 32 Bits
71+
cache_key: x86_32
72+
arch: x86_32
73+
eirteam_arch: linux32
74+
- name: 64 Bits
75+
cache_key: x86_64
76+
arch: x86_64
77+
eirteam_arch: linux64
3178

32-
- name: "Load cached objects (Godot editor)"
79+
steps:
80+
- name: "Check cached build"
3381
uses: actions/cache@v4
34-
id: "cache_editor"
82+
id: "cache_eirteam_ffmpeg"
3583
with:
36-
path: cached_builds/editor/godot
37-
key: editor-build
84+
path: cached_builds/eirteam_ffmpeg/${{ matrix.eirteam_arch }}
85+
key: Linux-${{ matrix.cache_key }}-eirteam_ffmpeg-build
86+
restore-keys: Linux-${{ matrix.cache_key }}-eirteam_ffmpeg-build
87+
save-always: true
88+
lookup-only: true
3889
continue-on-error: true
3990

40-
- name: "Load cached objects (Godot templates)"
91+
- name: "Load FFmpeg build"
92+
id: "cache_ffmpeg"
93+
if: steps.cache_eirteam_ffmpeg.outputs.cache-hit != 'true'
4194
uses: actions/cache@v4
42-
id: "cache_template"
4395
with:
44-
path: cached_builds/template/${{ matrix.template }}
45-
key: Linux-${{ matrix.arch }}-template-build
46-
continue-on-error: true
96+
path: cached_builds/ffmpeg
97+
key: Linux-${{ matrix.cache_key }}-ffmpeg-build
98+
restore-keys: Linux-${{ matrix.cache_key }}-ffmpeg-build
99+
continue-on-error: false
100+
101+
- name: "Checkout EIRTeam.FFmpeg"
102+
if: steps.cache_eirteam_ffmpeg.outputs.cache-hit != 'true'
103+
uses: actions/checkout@v4
104+
with:
105+
repository: retrohub-org/EIRTeam.FFmpeg
106+
submodules: recursive
107+
path: "eirteam_ffmpeg"
108+
109+
- name: "Install dependencies"
110+
if: steps.cache_eirteam_ffmpeg.outputs.cache-hit != 'true'
111+
run: |
112+
sudo dpkg --add-architecture i386
113+
sudo apt-get update
114+
# The actual dependencies
115+
sudo apt-get install build-essential gcc-multilib g++-multilib pkg-config wget unzip
116+
python -m pip install scons==4.4.0
117+
118+
- name: "Compilation"
119+
if: steps.cache_eirteam_ffmpeg.outputs.cache-hit != 'true'
120+
working-directory: ./eirteam_ffmpeg
121+
run: |
122+
mkdir -p -v thirdparty
123+
mv $GITHUB_WORKSPACE/cached_builds/ffmpeg thirdparty
124+
125+
cd gdextension_build
126+
scons arch=${{ matrix.arch }} verbose=yes target=template_release
127+
128+
mkdir -p -v $GITHUB_WORKSPACE/cached_builds/eirteam_ffmpeg
129+
cp -r -v build/addons/ffmpeg/${{ matrix.eirteam_arch }} $GITHUB_WORKSPACE/cached_builds/eirteam_ffmpeg
130+
131+
build-godot:
132+
runs-on: "ubuntu-20.04"
133+
name: Build Godot (${{ matrix.name }})
134+
strategy:
135+
matrix:
136+
include:
137+
- name: 32 Bits
138+
cache_key: x86_32
139+
arch: x86_32
140+
bin_template: godot.linuxbsd.template_release.x86_32
141+
bin_editor: godot.linuxbsd.editor.x86_32
142+
template: godot_32
143+
- name: 64 Bits
144+
cache_key: x86_64
145+
arch: x86_64
146+
bin_template: godot.linuxbsd.template_release.x86_64
147+
bin_editor: godot.linuxbsd.editor.x86_64
148+
template: godot_64
47149

48-
- name: "Load cached objects (Videodecoder)"
150+
steps:
151+
- name: "Check cached build"
49152
uses: actions/cache@v4
50-
id: "cache_videodecoder"
153+
id: "cache_godot"
51154
with:
52-
path: cached_builds/videodecoder/${{ matrix.videodecoder }}
53-
key: Linux-${{ matrix.arch }}-videodecoder-build
155+
path: |
156+
cached_builds/editor/godot
157+
cached_builds/template/${{ matrix.template }}
158+
key: Linux-${{ matrix.cache_key }}-godot-build
159+
restore-keys: Linux-${{ matrix.cache_key }}-godot-build
160+
save-always: true
161+
lookup-only: true
54162
continue-on-error: true
55163

56164
- name: "Checkout Custom Godot"
57-
if: steps.cache_template.outputs.cache-hit != 'true'
165+
if: steps.cache_godot.outputs.cache-hit != 'true'
58166
uses: actions/checkout@v4
59167
with:
60168
repository: retrohub-org/godot
61169
ref: retrohub_patches_4x
62170
path: "godot"
63171

64-
- name: "Checkout godot-videodecoder"
65-
if: steps.cache_videodecoder.outputs.cache-hit != 'true'
66-
uses: actions/checkout@v4
67-
with:
68-
repository: retrohub-org/godot-videodecoder
69-
submodules: recursive
70-
path: "videodecoder"
71-
72-
- name: "[Videodecoder] Compilation"
73-
if: steps.cache_videodecoder.outputs.cache-hit != 'true'
74-
working-directory: ./videodecoder
75-
env:
76-
PLATFORMS: ${{ matrix.videodecoder }}
77-
run: |
78-
./build_gdextension.sh
79-
mkdir -p -v ../cached_builds/videodecoder
80-
cp -r -v target/* ../cached_builds/videodecoder
81-
82-
- name: "[Godot] Dependencies"
83-
if: steps.cache_template.outputs.cache-hit != 'true'
84-
working-directory: ./godot
85-
shell: bash
172+
- name: "Install dependencies"
173+
if: steps.cache_godot.outputs.cache-hit != 'true'
86174
run: |
87175
sudo rm -f /etc/apt/sources.list.d/microsoft-prod.list
88176
sudo add-apt-repository ppa:kisak/kisak-mesa
@@ -95,63 +183,121 @@ jobs:
95183
libgl1-mesa-dev:i386 libglu-dev libasound2-dev libpulse-dev libdbus-1-dev libudev-dev libxi-dev \
96184
libxi-dev:i386 libxrandr-dev libxrandr-dev:i386 yasm xvfb wget unzip
97185
98-
- name: "[Godot] Setup Godot build cache"
99-
if: steps.cache_template.outputs.cache-hit != 'true'
186+
- name: "Setup Godot build cache"
187+
if: steps.cache_godot.outputs.cache-hit != 'true'
100188
uses: ./godot/.github/actions/godot-cache
101189
with:
102190
cache-name: linux-template
103191
continue-on-error: true
104192

105-
- name: "[Godot] Setup python and scons"
106-
if: steps.cache_template.outputs.cache-hit != 'true'
193+
- name: "Setup python and scons"
194+
if: steps.cache_godot.outputs.cache-hit != 'true'
107195
uses: ./godot/.github/actions/godot-deps
108196

109-
- name: "[Godot] Compilation [template]"
110-
if: steps.cache_template.outputs.cache-hit != 'true'
197+
- name: "Compilation [editor]"
198+
if: steps.cache_godot.outputs.cache-hit != 'true'
199+
uses: ./godot/.github/actions/godot-build
200+
with:
201+
root: ./godot
202+
sconsflags: verbose=yes werror=no production=yes arch=${{ matrix.arch }}
203+
platform: linuxbsd
204+
target: editor
205+
206+
- name: "Compilation [template]"
207+
if: steps.cache_godot.outputs.cache-hit != 'true'
111208
uses: ./godot/.github/actions/godot-build
112209
with:
113210
root: ./godot
114211
sconsflags: verbose=yes warnings=all werror=no use_lto=yes optimize=size arch=${{ matrix.arch }}
115212
platform: linuxbsd
116213
target: template_release
117-
tools: false
118214

119-
- name: "[Godot] Clean and cache template build"
120-
if: steps.cache_template.outputs.cache-hit != 'true'
215+
- name: "Clean and cache template build"
216+
if: steps.cache_godot.outputs.cache-hit != 'true'
121217
run: |
122218
strip godot/bin/*
219+
mkdir -p -v cached_builds/editor
123220
mkdir -p -v cached_builds/template
124-
[[ -e godot/bin/${{ matrix.bin }} ]] && mv godot/bin/${{ matrix.bin }} cached_builds/template/${{ matrix.template }}
221+
mv godot/bin/${{ matrix.bin_editor }} cached_builds/editor/godot
222+
mv godot/bin/${{ matrix.bin_template }} cached_builds/template/${{ matrix.template }}
125223
126-
- name: "[Godot] Download editor"
127-
if: steps.cache_editor.outputs.cache-hit != 'true'
128-
run: |
129-
wget https://downloads.tuxfamily.org/godotengine/4.1/Godot_v4.1-stable_linux.x86_64.zip
130-
unzip Godot_v4.1-stable_linux.x86_64.zip
131-
mkdir -p -v cached_builds/editor
132-
mv Godot_v4.1-stable_linux.x86_64 cached_builds/editor/godot
224+
build-retrohub:
225+
runs-on: "ubuntu-20.04"
226+
name: Build RetroHub (${{ matrix.name }})
227+
needs: [build-godot, build-eirteam_ffmpeg]
228+
strategy:
229+
matrix:
230+
include:
231+
- name: 32 Bits
232+
cache_key: x86_32
233+
arch: x86_32
234+
template: godot_32
235+
eirteam_ffmpeg: linux32
236+
- name: 64 Bits
237+
cache_key: x86_64
238+
arch: x86_64
239+
template: godot_64
240+
eirteam_ffmpeg: linux64
241+
242+
steps:
243+
- name: "Load EIRTeam.FFmpeg build"
244+
uses: actions/cache@v4
245+
id: "cache_eirteam_ffmpeg"
246+
with:
247+
path: cached_builds/eirteam_ffmpeg/${{ matrix.eirteam_ffmpeg }}
248+
key: Linux-${{ matrix.cache_key }}-eirteam_ffmpeg-build
249+
restore-keys: Linux-${{ matrix.cache_key }}-eirteam_ffmpeg-build
250+
fail-on-cache-miss: true
251+
continue-on-error: false
252+
253+
- name: "Load Godot builds"
254+
uses: actions/cache@v4
255+
id: "cache_godot"
256+
with:
257+
path: |
258+
cached_builds/editor/godot
259+
cached_builds/template/${{ matrix.template }}
260+
key: Linux-${{ matrix.cache_key }}-godot-build
261+
restore-keys: Linux-${{ matrix.cache_key }}-godot-build
262+
fail-on-cache-miss: true
263+
continue-on-error: false
264+
265+
- name: "Checkout RetroHub"
266+
uses: actions/checkout@v4
267+
with:
268+
path: "retrohub"
133269

134270
- name: "Setup templates and libraries"
135271
env:
136-
TEMPLATE_PATH: /home/runner/.local/share/godot/export_templates/4.1.stable
272+
TEMPLATE_PATH: /home/runner/.local/share/godot/export_templates/${{ env.GODOT_VERSION }}.retrohub
137273
run: |
138274
mkdir -p -v $TEMPLATE_PATH
139275
cp cached_builds/template/${{ matrix.template }} $TEMPLATE_PATH/linux_release.${{ matrix.arch }}
140-
ln -s ../../../cached_builds/videodecoder/${{ matrix.videodecoder }} retrohub/addons/godot-videodecoder/${{ matrix.videodecoder }}
141-
ls -la cached_builds/videodecoder
142-
ls -la cached_builds/videodecoder/${{ matrix.videodecoder }}
143-
ls -la retrohub/addons/godot-videodecoder
144-
ls retrohub/addons/godot-videodecoder/${{ matrix.videodecoder }}
276+
ln -s ${{ github.workspace }}/cached_builds/eirteam_ffmpeg/${{ matrix.eirteam_ffmpeg }} retrohub/addons/ffmpeg/${{ matrix.eirteam_ffmpeg }}
145277
mkdir -p -v export/linux_${{ matrix.arch }}
146278
279+
# The editor uses the debug versions of addons. To save some work, duplicate EIRTeam.FFmpeg addon to make Godot happy
280+
cp retrohub/addons/ffmpeg/${{ matrix.eirteam_ffmpeg }}/libgdffmpeg.linux.{template_release,template_debug}.${{ matrix.arch }}.so
281+
147282
- name: "Package default themes"
148283
uses: ./retrohub/.github/actions/get-default-themes
149284

285+
- name: "Import project"
286+
working-directory: retrohub
287+
env:
288+
GODOT_PATH: ${{ github.workspace }}/cached_builds/editor/godot
289+
run: |
290+
# The first import loads EIRTeam.FFmpeg, an addon which blocks the editor as it requires a restart
291+
timeout 30s $GODOT_PATH --headless --editor || true
292+
$GODOT_PATH --headless --import || true
293+
294+
150295
- name: "Exporting RetroHub"
151296
working-directory: retrohub
297+
env:
298+
GODOT_PATH: ${{ github.workspace }}/cached_builds/editor/godot
152299
run: |
153-
../cached_builds/editor/godot --headless --export-release "Linux (${{ matrix.arch }})" ../export/linux_${{ matrix.arch }}/RetroHub
154-
chmod +x ../export/linux_${{ matrix.arch }}/RetroHub
300+
$GODOT_PATH --headless --verbose --export-release "Linux (${{ matrix.arch }})" ../export/linux_${{ matrix.arch }}/RetroHub
155301
156302
- name: "Upload Artifacts"
157303
uses: actions/upload-artifact@v4

0 commit comments

Comments
 (0)