introduce modular patch #25
Workflow file for this run
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
name: Build Addon | |
on: [push, pull_request] | |
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: Setup | |
shell: bash | |
run: | | |
python ./setup.py --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 --output build/ | |
- name: Upload build files (artifacts) | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build-artifact-windows | |
path: | | |
build/*.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: Setup | |
run: | | |
python ./setup.py | |
- name: Build | |
run: | | |
source ./venv/bin/activate | |
python ./build.py desktop --type release --output build/ | |
- name: Upload build files (artifacts) | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build-artifact-linux | |
path: | | |
build/*.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/[email protected] | |
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 8.2 | |
uses: gradle/actions/setup-gradle@v3 | |
with: | |
gradle-version: 8.2 | |
- name: Setup | |
run: | | |
python ./setup.py | |
- 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 --output build/ | |
- name: Upload build files (artifacts) | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build-artifact-android | |
path: | | |
build/*.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: Setup | |
run: | | |
python ./setup.py | |
- name: Build | |
run: | | |
source ./venv/bin/activate | |
python ./build.py ios --type release --output build/ | |
- name: Upload build files (artifacts) | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build-artifact-ios | |
path: | | |
build/*.framework | |
# 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: | | |
mkdir dist | |
cp -a addons dist/ | |
cp LICENSE addons/GDMP/ | |
cp README.md dist/ | |
mkdir -p dist/addons/GDMP/libs/x86_64/ | |
cp build-artifact-windows/*.dll dist/addons/GDMP/libs/x86_64/ | |
cp build-artifact-linux/*.so dist/addons/GDMP/libs/x86_64/ | |
cp build-artifact-android/*.aar dist/addons/GDMP/libs/ | |
cp -a build-artifact-ios/*.framework dist/addons/GDMP/libs/ | |
- name: Create Addon Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Addon | |
path: | | |
dist |