Skip to content

Commit c8d21c3

Browse files
committed
Add arm builds, x86_32, android, package script
1 parent a697929 commit c8d21c3

10 files changed

Lines changed: 300 additions & 98 deletions

File tree

.github/workflows/build.yml

Lines changed: 2 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: C/C++ CI
1+
name: C/C++ CI Tests
22

33
on: [push, pull_request]
44

@@ -9,40 +9,6 @@ env:
99
SCONS_CACHE: ${{ github.workspace }}/.scons-cache/
1010

1111
jobs:
12-
linux-x64:
13-
runs-on: ubuntu-24.04
14-
steps:
15-
- uses: actions/checkout@v6
16-
with:
17-
submodules: recursive
18-
- name: Restore Godot build cache
19-
uses: ./godot-cpp/.github/actions/godot-cache-restore
20-
with:
21-
cache-name: linux-x86_64
22-
scons-cache: ${{ env.SCONS_CACHE }}
23-
continue-on-error: true
24-
- name: Build for Linux editor x86_64
25-
run: |
26-
pip3 install scons
27-
scons platform=linux arch=x86_64
28-
ldd addons/godot-git-plugin/linux/*.so
29-
- name: Save Godot build cache
30-
uses: ./godot-cpp/.github/actions/godot-cache-save
31-
with:
32-
cache-name: linux-x86_64
33-
scons-cache: ${{ env.SCONS_CACHE }}
34-
continue-on-error: true
35-
- name: Prepare artifact
36-
run: |
37-
mkdir out
38-
mv addons out/
39-
- uses: actions/upload-artifact@v7
40-
with:
41-
name: libgit_plugin.linux.x86_64.editor.so-${{ github.sha }}
42-
if-no-files-found: error
43-
path: |
44-
out/
45-
4612
windows-x64:
4713
runs-on: windows-2022
4814
steps:
@@ -73,7 +39,7 @@ jobs:
7339
shell: bash
7440
run: |
7541
# Not needed to use the plugin.
76-
rm -f addons/godot-git-plugin/windows/*.{exp,lib}
42+
rm -f addons/godot-git-plugin/lib/*.{exp,lib}
7743
mkdir out
7844
mv addons out/
7945
- uses: actions/upload-artifact@v7
@@ -82,37 +48,3 @@ jobs:
8248
if-no-files-found: error
8349
path: |
8450
out/
85-
86-
macos-universal:
87-
runs-on: macos-latest
88-
steps:
89-
- uses: actions/checkout@v6
90-
with:
91-
submodules: recursive
92-
- name: Restore Godot build cache
93-
uses: ./godot-cpp/.github/actions/godot-cache-restore
94-
with:
95-
cache-name: macos-universal
96-
scons-cache: ${{ env.SCONS_CACHE }}
97-
continue-on-error: true
98-
- name: Build for macOS editor universal
99-
run: |
100-
pip install scons
101-
scons platform=macos arch=universal macos_deployment_target=10.13
102-
otool -L addons/godot-git-plugin/macos/*.dylib
103-
- name: Save Godot build cache
104-
uses: ./godot-cpp/.github/actions/godot-cache-save
105-
with:
106-
cache-name: macos-universal
107-
scons-cache: ${{ env.SCONS_CACHE }}
108-
continue-on-error: true
109-
- name: Prepare artifact
110-
run: |
111-
mkdir out
112-
mv addons out/
113-
- uses: actions/upload-artifact@v7
114-
with:
115-
name: libgit_plugin.macos.universal.editor.dylib-${{ github.sha }}
116-
if-no-files-found: error
117-
path: |
118-
out/
Lines changed: 241 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,241 @@
1+
name: 🔧 Build -> Package 📦
2+
on: [push, pull_request]
3+
4+
env:
5+
# Only used for the cache key. Increment version to force clean build.
6+
GODOT_BASE_BRANCH: master
7+
# LLVM version
8+
MINGW_LLVM_VERSION: "20260616"
9+
# Hardcoding this seem to be the only way
10+
ANDROID_NDK_ROOT: /usr/local/lib/android/sdk/ndk/28.1.13356709/
11+
12+
jobs:
13+
build:
14+
runs-on: ${{ matrix.os }}
15+
name: 🔧 Build
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
include:
20+
# Android
21+
- platform: android
22+
arch: 'x86_64'
23+
gdnative_flags: 'android_arch=x86_64'
24+
sconsflags: ''
25+
os: 'ubuntu-22.04'
26+
cache-name: android-x86_64
27+
- platform: android
28+
arch: 'arm64'
29+
gdnative_flags: 'android_arch=arm64v8'
30+
sconsflags: ''
31+
os: 'ubuntu-22.04'
32+
cache-name: android-arm64
33+
34+
# Linux
35+
- platform: linux
36+
arch: 'x86_32'
37+
buildroot: 'i686-godot-linux-gnu_sdk-buildroot'
38+
gdnative_flags: 'bits=32'
39+
sconsflags: ''
40+
os: 'ubuntu-22.04'
41+
cache-name: linux-x86_32
42+
- platform: linux
43+
arch: 'x86_64'
44+
buildroot: 'x86_64-godot-linux-gnu_sdk-buildroot'
45+
gdnative_flags: 'bits=64'
46+
sconsflags: ''
47+
os: 'ubuntu-22.04'
48+
cache-name: linux-x86_64
49+
- platform: linux
50+
arch: 'arm32'
51+
buildroot: 'arm-godot-linux-gnueabihf_sdk-buildroot'
52+
gdnative_flags: 'bits=32'
53+
sconsflags: ''
54+
os: 'ubuntu-22.04'
55+
cache-name: linux-arm32
56+
- platform: linux
57+
arch: 'arm64'
58+
buildroot: 'aarch64-godot-linux-gnu_sdk-buildroot'
59+
gdnative_flags: 'bits=64'
60+
sconsflags: ''
61+
os: 'ubuntu-22.04'
62+
cache-name: linux-arm64
63+
64+
# macOS
65+
- platform: macos
66+
arch: 'universal'
67+
gdnative_flags: 'macos_arch=universal bits=64'
68+
sconsflags: ''
69+
os: 'macos-latest'
70+
cache-name: macos-universal
71+
72+
# Windows
73+
- platform: windows
74+
arch: 'x86_32'
75+
gdnative_flags: 'bits=32'
76+
sconsflags: 'use_mingw=yes'
77+
os: 'ubuntu-22.04'
78+
cache-name: win-x86_32
79+
- platform: windows
80+
arch: 'x86_64'
81+
gdnative_flags: 'bits=64'
82+
sconsflags: 'use_mingw=yes'
83+
os: 'ubuntu-22.04'
84+
cache-name: win-x86_64
85+
- platform: windows
86+
arch: 'arm64'
87+
sconsflags: 'use_mingw=yes use_llvm=yes'
88+
os: 'ubuntu-22.04'
89+
cache-name: win-arm64
90+
skip_gdnative: true
91+
92+
env:
93+
SCONS_CACHE: ${{ github.workspace }}/.scons-cache/
94+
SCONSFLAGS: ${{ matrix.sconsflags }} platform=${{ matrix.platform }} arch=${{ matrix.arch }} build_profile=build_profile.json target=editor api_version=4.3 target_path=out/addons/godot-git-plugin/ --jobs=2
95+
96+
defaults:
97+
run:
98+
shell: bash
99+
100+
steps:
101+
- uses: actions/checkout@v6
102+
with:
103+
submodules: recursive
104+
105+
- name: Restore Godot build cache
106+
uses: ./godot-cpp/.github/actions/godot-cache-restore
107+
with:
108+
cache-name: ${{ matrix.cache-name }}
109+
scons-cache: ${{ env.SCONS_CACHE }}
110+
continue-on-error: true
111+
112+
- name: Setup Windows MinGW toolchain cache
113+
if: ${{ matrix.platform == 'windows' && matrix.arch == 'arm64' }}
114+
uses: actions/cache@v5
115+
with:
116+
path: |
117+
llvm-mingw-$MINGW_LLVM_VERSION-ucrt-ubuntu-22.04-x86_64.tar.bz2
118+
key: llvm-mingw-$MINGW_LLVM_VERSION-ucrt-ubuntu-22.04-x86_64
119+
120+
- name: Install mingw-LLVM
121+
if: ${{ matrix.platform == 'windows' && matrix.arch == 'arm64' }}
122+
run: |
123+
NAME=llvm-mingw-$MINGW_LLVM_VERSION-ucrt-ubuntu-22.04-x86_64
124+
URL="https://github.com/mstorsjo/llvm-mingw/releases/download/$MINGW_LLVM_VERSION/$NAME.tar.xz"
125+
if [ ! -f $NAME.bz2 ]; then
126+
wget $URL
127+
fi
128+
tar -xJf $NAME.tar.xz
129+
echo "$GITHUB_WORKSPACE/$NAME/bin" >> $GITHUB_PATH
130+
131+
- name: Install mingw-GCC
132+
if: ${{ matrix.platform == 'windows' && matrix.arch != 'arm64' }}
133+
run: |
134+
sudo apt-get update
135+
sudo apt-get install build-essential mingw-w64
136+
sudo update-alternatives --set i686-w64-mingw32-gcc /usr/bin/i686-w64-mingw32-gcc-posix
137+
sudo update-alternatives --set i686-w64-mingw32-g++ /usr/bin/i686-w64-mingw32-g++-posix
138+
sudo update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-posix
139+
sudo update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix
140+
dpkg -l | grep ii | grep mingw
141+
update-alternatives --get-selections | grep mingw
142+
143+
- name: Install Linux build dependencies
144+
if: ${{ matrix.platform == 'linux' }}
145+
run: |
146+
sudo apt-get update
147+
sudo apt-get install build-essential gcc-multilib g++-multilib wget
148+
149+
- name: Setup Linux buildroot toolchain cache
150+
if: ${{ matrix.platform == 'linux' }}
151+
uses: actions/cache@v5
152+
with:
153+
path: |
154+
${{ matrix.buildroot }}.tar.bz2
155+
key: linux-${{ matrix.buildroot }}-buildroot
156+
157+
- name: Set up Python 3.x
158+
uses: actions/setup-python@v6
159+
with:
160+
python-version: '3.x'
161+
architecture: 'x64'
162+
163+
- name: Configuring Python packages
164+
run: |
165+
python -c "import sys; print(sys.version)"
166+
python -m pip install scons
167+
168+
- name: Setup Linux toolchains
169+
if: ${{ matrix.platform == 'linux' }}
170+
run: |
171+
if [ ! -f ${{ matrix.buildroot }}.tar.bz2 ]; then
172+
wget https://github.com/godotengine/buildroot/releases/download/godot-2023.08.x-4/${{ matrix.buildroot }}.tar.bz2
173+
fi
174+
tar -xjf ${{ matrix.buildroot }}.tar.bz2
175+
${{ matrix.buildroot }}/relocate-sdk.sh
176+
rm ${{ matrix.buildroot }}/bin/cmake
177+
echo "$GITHUB_WORKSPACE/${{ matrix.buildroot }}/bin" >> $GITHUB_PATH
178+
echo "PKG_CONFIG=$GITHUB_WORKSPACE/${{ matrix.buildroot }}/share/pkgconfig/" >> $GITHUB_ENV
179+
180+
- name: Setup Android dependencies
181+
if: ${{ matrix.platform == 'android' }}
182+
uses: nttld/setup-ndk@v1
183+
with:
184+
ndk-version: r28b
185+
link-to-sdk: true
186+
187+
- name: Print tools versions
188+
run: |
189+
python --version
190+
scons --version
191+
cmake --version
192+
193+
- name: Compile Extension (4.3+) - ${{ matrix.platform }} - ${{ matrix.arch }}
194+
run: |
195+
scons
196+
197+
- name: Save Godot build cache
198+
uses: ./godot-cpp/.github/actions/godot-cache-save
199+
with:
200+
cache-name: ${{ matrix.cache-name }}
201+
scons-cache: ${{ env.SCONS_CACHE }}
202+
continue-on-error: true
203+
204+
- uses: actions/upload-artifact@v7
205+
with:
206+
name: ${{ github.job }}-${{ matrix.platform }}-${{ matrix.arch }}
207+
path: |
208+
out/
209+
210+
package:
211+
name: 📦 Package
212+
needs: build
213+
runs-on: "ubuntu-latest"
214+
steps:
215+
- uses: actions/checkout@v6
216+
with:
217+
submodules: recursive
218+
219+
- uses: actions/download-artifact@v8
220+
with:
221+
path: artifacts
222+
223+
- name: Bundle licenses.
224+
run: |
225+
cp LICENSE artifacts/LICENSE.godot-git-plugin
226+
cp thirdparty/mbedtls/LICENSE artifacts/LICENSE.mbedtls
227+
cp thirdparty/ssh2/libssh2/COPYING artifacts/LICENSE.libssh2
228+
cp thirdparty/git2/libgit2/COPYING artifacts/LICENSE.libgit2
229+
230+
- name: Package artifacts for release
231+
env:
232+
DESTINATION: "release"
233+
run: |
234+
mkdir release
235+
./misc/scripts/package_release.sh
236+
ls -R release
237+
238+
- uses: actions/upload-artifact@v7
239+
with:
240+
name: godot-git-plugin
241+
path: release/godot-git-plugin.zip

.gitignore

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,6 @@ extension_api.json
1919

2020
# Binaries
2121
__pycache__/
22-
build/
23-
bin/
24-
macos/
25-
linux/
26-
windows/
2722
*.lib
2823
*.a
2924
*.obj

SConstruct

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ opts = Variables([], ARGUMENTS)
1010
env = Environment(ENV=os.environ)
1111

1212
# Define our options
13-
opts.Add(PathVariable("target_path",
14-
"The path where the lib is installed.", "addons/godot-git-plugin/"))
13+
opts.Add(PathVariable("target_path", "The path where the lib is installed (will be created if it does not exists).",
14+
"addons/godot-git-plugin/", PathVariable.PathAccept))
1515
opts.Add(PathVariable("target_name", "The library name.",
1616
"libgit_plugin", PathVariable.PathAccept))
1717

addons/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*
2+
!.gitignore

addons/godot-git-plugin/git_plugin.gdextension

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)