-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f716671
commit 9becc70
Showing
2 changed files
with
273 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,271 @@ | ||
name: Build Addon | ||
|
||
on: [push, pull_request] | ||
|
||
env: | ||
godot-version: 4.2.1-stable | ||
|
||
jobs: | ||
# Build the Windows Artifacts | ||
build-windows: | ||
name: 🏁 Build Windows | ||
runs-on: windows-2019 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.9" | ||
|
||
- name: Setup Bazelisk | ||
uses: bazelbuild/setup-bazelisk@v3 | ||
|
||
- name: Prerequisites | ||
shell: bash | ||
run: | | ||
choco install visualstudio2019buildtools visualstudio2019-workload-vctools | ||
choco install opencv --version 3.4.10 | ||
- name: Download Godot | ||
run: | | ||
curl -L -O https://github.com/godotengine/godot/releases/download/${{ env.godot-version }}/Godot_v${{ env.godot-version }}_win64.exe.zip | ||
unzip -o Godot_v${{ env.godot-version }}_win64.exe.zip -d godot | ||
- name: Setup | ||
shell: bash | ||
run: | | ||
python ./setup.py --godot-binary ./godot/Godot_v${{ env.godot-version }}_win64.exe --custom-opencv-dir C:/tools/opencv/build | ||
- name: Build | ||
env: | ||
BAZEL_VC: "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\BuildTools\\VC" | ||
shell: bash | ||
run: | | ||
source ./venv/Scripts/activate | ||
python ./build.py desktop --type release | ||
- name: Upload build files (artifacts) | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: build-artifact-windows | ||
path: | | ||
mediapipe/bazel-bin/GDMP/desktop/*.dll | ||
# Build the Linux Artifacts | ||
build-linux: | ||
name: 🐧 Build Linux | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.9" | ||
|
||
- name: Setup Bazelisk | ||
uses: bazelbuild/setup-bazelisk@v3 | ||
|
||
- name: Prerequisites | ||
run: | | ||
sudo apt-get install -y \ | ||
ffmpeg \ | ||
libegl1-mesa-dev \ | ||
libopencv-core-dev \ | ||
libopencv-highgui-dev \ | ||
libopencv-calib3d-dev \ | ||
libopencv-features2d-dev \ | ||
libopencv-imgproc-dev \ | ||
libopencv-video-dev \ | ||
libopencv-contrib-dev | ||
sed -i 's/#"include\/opencv4/"include\/opencv4/g' mediapipe/third_party/opencv_linux.BUILD | ||
- name: Download Godot | ||
run: | | ||
curl -L -O https://github.com/godotengine/godot/releases/download/${{ env.godot-version }}/Godot_v${{ env.godot-version }}_linux.x86_64.zip | ||
unzip -o Godot_v${{ env.godot-version }}_linux.x86_64.zip -d godot | ||
- name: Setup | ||
run: | | ||
python ./setup.py --godot-binary ./godot/Godot_v${{ env.godot-version }}_linux.x86_64 | ||
- name: Build | ||
run: | | ||
source ./venv/bin/activate | ||
python ./build.py desktop --type release | ||
- name: Upload build files (artifacts) | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: build-artifact-linux | ||
path: | | ||
mediapipe/bazel-bin/GDMP/desktop/*.so | ||
# Build the Android Artifacts | ||
build-android: | ||
name: 🤖 Build Android | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Free Disk Space | ||
uses: jlumbroso/free-disk-space@main | ||
with: | ||
android: false | ||
|
||
- name: Setup Java | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'temurin' | ||
java-version: '17' | ||
cache: 'gradle' | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.9" | ||
|
||
- name: Setup Bazelisk | ||
uses: bazelbuild/setup-bazelisk@v3 | ||
|
||
- name: Setup Android NDK | ||
id: setup-ndk | ||
uses: nttld/setup-ndk@v1 | ||
with: | ||
ndk-version: r21e | ||
link-to-sdk: true | ||
|
||
- name: Setup Gradle 7.4.2 | ||
uses: gradle/actions/setup-gradle@v3 | ||
with: | ||
gradle-version: 7.4.2 | ||
|
||
- name: Download Godot | ||
run: | | ||
curl -L -O https://github.com/godotengine/godot/releases/download/${{ env.godot-version }}/Godot_v${{ env.godot-version }}_linux.x86_64.zip | ||
unzip -o Godot_v${{ env.godot-version }}_linux.x86_64.zip -d godot | ||
- name: Setup | ||
run: | | ||
python ./setup.py --godot-binary ./godot/Godot_v${{ env.godot-version }}_linux.x86_64 | ||
- name: Android SDK/NDK Patch | ||
run: | | ||
echo "android_sdk_repository(name = \"androidsdk\")" >> mediapipe/WORKSPACE | ||
echo "android_ndk_repository(name = \"androidndk\", api_level=21)" >> mediapipe/WORKSPACE | ||
- name: Build | ||
env: | ||
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} | ||
run: | | ||
source ./venv/bin/activate | ||
python ./build.py android --arch arm64-v8a --type release << EOL | ||
y | ||
y | ||
n | ||
EOL | ||
- name: Gradle Build | ||
env: | ||
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }} | ||
working-directory: ./android | ||
run: | | ||
gradle clean assembleRelease | ||
- name: Upload build files (artifacts) | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: build-artifact-android | ||
path: | | ||
android/build/outputs/aar/*.aar | ||
# Build the iOS Artifacts | ||
build-ios: | ||
name: 🍏 Build iOS | ||
runs-on: macos-13 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.9" | ||
|
||
- name: Setup Bazelisk | ||
uses: bazelbuild/setup-bazelisk@v3 | ||
|
||
- name: Download Godot | ||
run: | | ||
curl -L -O https://github.com/godotengine/godot/releases/download/${{ env.godot-version }}/Godot_v${{ env.godot-version }}_macos.universal.zip | ||
unzip -o Godot_v${{ env.godot-version }}_macos.universal.zip -d godot | ||
- name: Setup | ||
run: | | ||
python ./setup.py --godot-binary ./godot/Godot.app/Contents/MacOS/Godot | ||
- name: Build | ||
run: | | ||
source ./venv/bin/activate | ||
python ./build.py ios --type release | ||
- name: Upload build files (artifacts) | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: build-artifact-ios | ||
path: | | ||
mediapipe/bazel-bin/GDMP/ios/GDMP.zip | ||
# Assemble the Addon | ||
assemble-addon: | ||
name: Assemble Addon | ||
runs-on: ubuntu-22.04 | ||
needs: [build-windows, build-linux, build-android, build-ios] | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Download all workflow run artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
pattern: build-artifact-* | ||
|
||
- name: Populate Addon | ||
run: | | ||
cp LICENSE addons/GDMP/ | ||
cp README.md addons/GDMP/ | ||
mkdir -p addons/GDMP/libs/x86_64/ | ||
cp build-artifact-windows/*.dll addons/GDMP/libs/x86_64/ | ||
cp build-artifact-linux/*.so addons/GDMP/libs/x86_64/ | ||
cp build-artifact-android/*.aar addons/GDMP/libs | ||
unzip -o build-artifact-ios/GDMP.zip -d addons/GDMP/libs | ||
- name: Patch GDMP.gdextension | ||
run: | | ||
sed -i 's/libGDMP\..*\.so/libGDMP.so/g' addons/GDMP/GDMP.gdextension | ||
sed -i 's/GDMP\..*\.dll/GDMP.dll/g' addons/GDMP/GDMP.gdextension | ||
sed -i 's/GDMP\..*\.framework/GDMP.ios.release.framework/g' addons/GDMP/GDMP.gdextension | ||
sed -i 's/opencv_world3410d/opencv_world3410/g' addons/GDMP/GDMP.gdextension | ||
- name: Create Addon Artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: Addon | ||
path: | | ||
addons |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters