Build Unity Plugin Zip #43
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 Unity Plugin Zip | |
on: | |
workflow_dispatch: {} | |
label: | |
types: | |
- created | |
jobs: | |
linux_shared_library: | |
name: Linux Shared Library | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup Rust toolchain x86_64-unknown-linux-gnu | |
uses: actions-rs/toolchain@v1 | |
with: | |
target: x86_64-unknown-linux-gnu | |
- name: Compile | |
run: | | |
docker build -f ./script/reddio-linux/Dockerfile -t reddio-native-library:latest . | |
docker container create --name extract-reddio reddio-native-library:latest | |
mkdir -p ./reddio/target/x86_64-unknown-linux-gnu/release | |
docker container cp extract-reddio:/workspace/reddio/target/x86_64-unknown-linux-gnu/release/libreddio.a ./reddio/target/x86_64-unknown-linux-gnu/release/libreddio.a | |
docker container cp extract-reddio:/workspace/reddio/target/x86_64-unknown-linux-gnu/release/libreddio.so ./reddio/target/x86_64-unknown-linux-gnu/release/libreddio.so | |
docker container rm -f extract-reddio | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: libreddio-x86_64-unknown-linux-gnu | |
path: | | |
reddio/target/x86_64-unknown-linux-gnu/release/libreddio.a | |
reddio/target/x86_64-unknown-linux-gnu/release/libreddio.so | |
android_share_library: | |
name: Android Shared Library | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup cargo-ndk | |
run: | | |
cargo install cargo-ndk | |
- name: Setup Rust toolchain aarch64-linux-android | |
uses: actions-rs/toolchain@v1 | |
with: | |
target: aarch64-linux-android | |
- name: Setup Rust toolchain armv7-linux-androideabi | |
uses: actions-rs/toolchain@v1 | |
with: | |
target: armv7-linux-androideabi | |
- name: Setup Rust toolchain x86_64-linux-android | |
uses: actions-rs/toolchain@v1 | |
with: | |
target: x86_64-linux-android | |
- name: Setup NDK | |
uses: nttld/setup-ndk@v1 | |
with: | |
ndk-version: r25 | |
- name: Build Android Shared Library | |
run: | | |
cd reddio && cargo ndk -t armeabi-v7a -t arm64-v8a -t x86_64 build --release | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: libreddio-aarch64-linux-android | |
path: | | |
reddio/target/aarch64-linux-android/release/libreddio.a | |
reddio/target/aarch64-linux-android/release/libreddio.so | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: libreddio-armv7-linux-androideabi | |
path: | | |
reddio/target/armv7-linux-androideabi/release/libreddio.a | |
reddio/target/armv7-linux-androideabi/release/libreddio.so | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: libreddio-x86_64-linux-android | |
path: | | |
reddio/target/x86_64-linux-android/release/libreddio.a | |
reddio/target/x86_64-linux-android/release/libreddio.so | |
windows_shared_library: | |
name: Windows Shared Library | |
runs-on: windows-2022 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup Rust toolchain x86_64-pc-windows-msvc | |
uses: actions-rs/toolchain@v1 | |
with: | |
target: x86_64-pc-windows-msvc | |
- name: Compile | |
run: | | |
cd reddio && cargo build --release --target x86_64-pc-windows-msvc | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: libreddio-x86_64-pc-windows-msvc | |
path: | | |
reddio/target/x86_64-pc-windows-msvc/release/reddio.lib | |
reddio/target/x86_64-pc-windows-msvc/release/reddio.dll | |
macos_shared_library: | |
name: macOS Shared Library | |
runs-on: macos-12 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup Rust toolchain aarch64-apple-darwin | |
uses: actions-rs/toolchain@v1 | |
with: | |
target: aarch64-apple-darwin | |
- name: Setup Rust toolchain x86_64-apple-darwin | |
uses: actions-rs/toolchain@v1 | |
with: | |
target: x86_64-apple-darwin | |
- name: Build macOS shared Library | |
run: | | |
cd reddio && cargo build --target x86_64-apple-darwin --target aarch64-apple-darwin --release | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: libreddio-aarch64-apple-darwin | |
path: | | |
reddio/target/aarch64-apple-darwin/release/libreddio.a | |
reddio/target/aarch64-apple-darwin/release/libreddio.dylib | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: libreddio-x86_64-apple-darwin | |
path: | | |
reddio/target/x86_64-apple-darwin/release/libreddio.a | |
reddio/target/x86_64-apple-darwin/release/libreddio.dylib | |
ios_static_library: | |
name: iOS Static Library | |
runs-on: macos-12 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup cargo-lipo | |
run: | | |
cargo install cargo-lipo | |
- name: Setup Rust toolchain aarch64-apple-ios | |
uses: actions-rs/toolchain@v1 | |
with: | |
target: aarch64-apple-ios | |
- name: Setup Rust toolchain x86_64-apple-ios | |
uses: actions-rs/toolchain@v1 | |
with: | |
target: x86_64-apple-ios | |
- name: Build iOS Static Library | |
run: | | |
cd reddio && cargo lipo --release | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: libreddio-universal-apple-ios | |
path: | | |
reddio/target/universal/release/libreddio.a | |
unity_plugin_zip: | |
name: Package Unity Plugin Zip | |
runs-on: ubuntu-20.04 | |
needs: | |
- linux_shared_library | |
- android_share_library | |
- windows_shared_library | |
- macos_shared_library | |
- ios_static_library | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Prepare Playground | |
run: mkdir -p artifacts | |
- name: Download Artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
path: artifacts | |
- name: Display structure of downloaded files | |
run: ls -R | |
working-directory: artifacts | |
- name: Restructure Libraries | |
run: | | |
mkdir -p unity/Plugins/reddio-sdk-unity/iOS | |
mkdir -p unity/Plugins/reddio-sdk-unity/Android/arm64 | |
mkdir -p unity/Plugins/reddio-sdk-unity/Android/armeabi-v7a | |
mkdir -p unity/Plugins/reddio-sdk-unity/Android/x86_64 | |
mkdir -p unity/Plugins/reddio-sdk-unity/Editor/aarch64 | |
mkdir -p unity/Plugins/reddio-sdk-unity/Editor/x86_64 | |
# iOS | |
cp artifacts/libreddio-universal-apple-ios/libreddio.a unity/Plugins/reddio-sdk-unity/iOS/libreddio.a | |
# Android | |
cp artifacts/libreddio-aarch64-linux-android/libreddio.so unity/Plugins/reddio-sdk-unity/Android/arm64/libreddio.so | |
cp artifacts/libreddio-armv7-linux-androideabi/libreddio.so unity/Plugins/reddio-sdk-unity/Android/armeabi-v7a/libreddio.so | |
cp artifacts/libreddio-x86_64-linux-android/libreddio.so unity/Plugins/reddio-sdk-unity/Android/x86_64/libreddio.so | |
# Editor / Standalone | |
cp artifacts/libreddio-aarch64-apple-darwin/libreddio.dylib unity/Plugins/reddio-sdk-unity/Editor/aarch64/libreddio.dylib | |
cp artifacts/libreddio-x86_64-pc-windows-msvc/reddio.dll unity/Plugins/reddio-sdk-unity/Editor/x86_64/reddio.dll | |
cp artifacts/libreddio-x86_64-apple-darwin/libreddio.dylib unity/Plugins/reddio-sdk-unity/Editor/x86_64/libreddio.dylib | |
cp artifacts/libreddio-x86_64-unknown-linux-gnu/libreddio.so unity/Plugins/reddio-sdk-unity/Editor/x86_64/libreddio.so | |
# Script | |
cp -r reddio-csharp/reddio.crypto unity/Plugins/reddio-sdk-unity/reddio.crypto | |
cp -r reddio-csharp/reddio.api unity/Plugins/reddio-sdk-unity/reddio.api | |
cp -r reddio-unity/Assets/Plugins/reddio-sdk-unity/reddio.unity unity/Plugins/reddio-sdk-unity/reddio.unity | |
- name: Upload Artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: unity-plugin-zip | |
path: unity |