Skip to content

Commit

Permalink
Add GitHub Workflow for Library Building Across Platforms
Browse files Browse the repository at this point in the history
Implement a GitHub workflow to automate the process of building the library for all supported platforms. This workflow will ensure consistent and efficient library builds, facilitating easy integration and deployment across different platforms.
  • Loading branch information
alessandrofama committed Jul 11, 2023
1 parent e661ff9 commit be920fc
Showing 1 changed file with 274 additions and 0 deletions.
274 changes: 274 additions & 0 deletions .github/workflows/build_all.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,274 @@
name: Build

on:
push:
branches:
- main
- dev
pull_request:
branches:
- main
- dev

env:
BASE_BRANCH: ci
WWISE_VERSION: "2022.1.5"
GODOT_ENGINE_VERSION: "4.0.3"
GODOT_ENGINE_STAGE: "stable"
INTEGRATION_VERSION: "2.0"

jobs:
build-all:
runs-on: ${{ matrix.os }}
name: ${{ matrix.name }}
strategy:
fail-fast: false
matrix:
include:
- name: Windows
os: "windows-2019"
sdk-platform: windows
scons-platform: windows
artifact-name: windows

- name: macOS
os: "macos-11"
sdk-platform: mac
scons-platform: macos
artifact-name: macos

- name: Linux
os: "ubuntu-20.04"
sdk-platform: linux
scons-platform: linux
artifact-name: linux

- name: iOS
os: "macos-11"
sdk-platform: ios
scons-platform: ios
flags: arch=arm64 ios_min_version=11.0
artifact-name: ios

- name: Android
os: "ubuntu-20.04"
sdk-platform: android
scons-platform: android
flags: ANDROID_NDK_ROOT=$ANDROID_NDK_LATEST_HOME arch=arm64
artifact-name: android-lib
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: recursive

- name: Wwise SDK cache
id: cache-wwise-sdk
uses: actions/cache@v3
env:
cache-name: cache-wwise-sdk
with:
path: addons/Wwise/native/wwise_sdk
key: ${{ matrix.sdk-platform }}-build-${{ env.cache-name }}-${{ env.WWISE_VERSION }}

- name: Load .scons_cache directory
id: cache-godot-extension
uses: actions/cache@v3
with:
path: ${{github.workspace}}/.scons_cache/
key: ${{matrix.sdk-platform}}-${{env.BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
restore-keys: |
${{matrix.sdk-platform}}-${{env.BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
${{matrix.sdk-platform}}-${{env.BASE_BRANCH}}-${{github.ref}}
${{matrix.sdk-platform}}-${{env.BASE_BRANCH}}
- name: Set up Python 3.x
uses: actions/setup-python@v4
with:
python-version: "3.x"
architecture: "x64"

- name: Set up dependencies (Python, SCons)
run: python -m pip install scons

- name: Set up Windows dependencies
if: runner.os == 'Windows'
run: |
choco install 7zip -y
- name: Set up Linux dependencies
if: runner.os == 'Linux' && matrix.sdk-platform == 'linux'
run: |
sudo apt-get install build-essential pkg-config libx11-dev \
yasm zip unzip p7zip-full p7zip-rar
- name: Download Wwise SDK (Base)
uses: suisei-cn/actions-download-file@v1.4.0
if: steps.cache-wwise-sdk.outputs.cache-hit != 'true'
with:
url: "https://www.dropbox.com/s/rqbs81r1k51wq6i/wwise_sdk_2022.1.5_base.zip?dl=1"
target: ./addons/Wwise/native/wwise_sdk/

- name: Download Wwise SDK (Windows)
uses: suisei-cn/actions-download-file@v1.4.0
if: runner.os == 'Windows' && steps.cache-wwise-sdk.outputs.cache-hit != 'true'
with:
url: "https://www.dropbox.com/s/1gz37q6288i0v0r/wwise_sdk_2022.1.5_win.zip?dl=1"
target: ./addons/Wwise/native/wwise_sdk/

- name: Download Wwise SDK (macOS)
uses: suisei-cn/actions-download-file@v1.4.0
if: runner.os == 'MacOS' && matrix.sdk-platform == 'mac' && steps.cache-wwise-sdk.outputs.cache-hit != 'true'
with:
url: "https://www.dropbox.com/s/6ejqi6an0w92hco/wwise_sdk_2022.1.5_mac.zip?dl=1"
target: ./addons/Wwise/native/wwise_sdk/

- name: Download Wwise SDK (Linux)
uses: suisei-cn/actions-download-file@v1.4.0
if: runner.os == 'Linux' && matrix.sdk-platform == 'linux' && steps.cache-wwise-sdk.outputs.cache-hit != 'true'
with:
url: "https://www.dropbox.com/s/sjpg4c0nf6680p0/wwise_sdk_2022.1.5_linux_x64.zip?dl=1"
target: ./addons/Wwise/native/wwise_sdk/

- name: Download Wwise SDK (iOS)
uses: suisei-cn/actions-download-file@v1.4.0
if: runner.os == 'MacOS' && matrix.sdk-platform == 'ios' && steps.cache-wwise-sdk.outputs.cache-hit != 'true'
with:
url: "https://www.dropbox.com/s/mjbnyvhfjhbxj9f/wwise_sdk_2022.1.5_ios.zip?dl=1"
target: ./addons/Wwise/native/wwise_sdk/

- name: Download Wwise SDK (Android)
uses: suisei-cn/actions-download-file@v1.4.0
if: runner.os == 'Linux' && matrix.sdk-platform == 'android' && steps.cache-wwise-sdk.outputs.cache-hit != 'true'
with:
url: "https://www.dropbox.com/s/osu0scke8pbzdw0/wwise_sdk_2022.1.5_android.zip?dl=1"
target: ./addons/Wwise/native/wwise_sdk/

- name: Unzip SDK (Windows)
if: runner.os == 'Windows' && steps.cache-wwise-sdk.outputs.cache-hit != 'true'
run: |
cd ./addons/Wwise/native/wwise_sdk
7z x wwise_sdk_2022.1.5_base.zip
7z x wwise_sdk_2022.1.5_win.zip
cd ../../../../
- name: Unzip SDK (macOS)
if: runner.os == 'MacOS' && matrix.sdk-platform == 'mac' && steps.cache-wwise-sdk.outputs.cache-hit != 'true'
run: |
cd ./addons/Wwise/native/wwise_sdk
7z x wwise_sdk_2022.1.5_base.zip
7z x wwise_sdk_2022.1.5_mac.zip
cd ../../../../
- name: Unzip SDK (Linux)
if: runner.os == 'Linux' && matrix.sdk-platform == 'linux' && steps.cache-wwise-sdk.outputs.cache-hit != 'true'
run: |
cd ./addons/Wwise/native/wwise_sdk
7z x wwise_sdk_2022.1.5_base.zip
7z x wwise_sdk_2022.1.5_linux_x64.zip
cd ../../../../
- name: Unzip SDK (iOS)
if: runner.os == 'MacOS' && matrix.sdk-platform == 'ios' && steps.cache-wwise-sdk.outputs.cache-hit != 'true'
run: |
cd ./addons/Wwise/native/wwise_sdk
7z x wwise_sdk_2022.1.5_base.zip
7z x wwise_sdk_2022.1.5_ios.zip
cd ../../../../
- name: Unzip SDK (Android)
if: runner.os == 'Linux' && matrix.sdk-platform == 'android' && steps.cache-wwise-sdk.outputs.cache-hit != 'true'
run: |
cd ./addons/Wwise/native/wwise_sdk
7z x wwise_sdk_2022.1.5_base.zip
7z x wwise_sdk_2022.1.5_android.zip
cd ../../../../
- name: Compile Debug library
shell: bash
env:
SCONS_CACHE: ${{github.workspace}}/.scons_cache/
SCONS_CACHE_LIMIT: 7168
run: |
cd addons/Wwise/native
mkdir -p godot-cpp/bin
scons platform=${{ matrix.scons-platform }} target=template_debug dev_build=yes asserts=true wwise_sdk=wwise_sdk -j6 ${{ matrix.flags }}
cd ../../../
- name: Compile Release library
shell: bash
env:
SCONS_CACHE: ${{github.workspace}}/.scons_cache/
SCONS_CACHE_LIMIT: 7168
run: |
cd addons/Wwise/native
scons platform=${{ matrix.scons-platform }} target=template_release wwise_sdk=wwise_sdk -j6 ${{ matrix.flags }}
cd ../../../
- name: Upload libs
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.artifact-name }}
path: addons/Wwise/native/lib

upload-addon:
runs-on: "ubuntu-20.04"
needs: [build-all]
name: Addon
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Download all libs
uses: actions/download-artifact@v3

- name: Assemble all artifacts
run: |
ls
shopt -s dotglob
if [ ! -d "addons/Wwise/native/lib" ]; then
mkdir -p addons/Wwise/native/lib
fi
if [ -d windows ]; then
mv windows/* addons/Wwise/native/lib/
rm -r windows
fi
if [ -d macos ]; then
mv macos/* addons/Wwise/native/lib/
rm -r macos
fi
if [ -d linux ]; then
mv linux/* addons/Wwise/native/lib/
rm -r linux
fi
if [ -d android-lib ]; then
mv android-lib/* addons/Wwise/native/lib/
rm -r android-lib
fi
if [ -d ios ]; then
mv ios/* addons/Wwise/native/lib/
rm -r ios
fi
- name: Clean up addon
run: |
rm -r ./addons/Wwise/native/godot-cpp
rm -r ./addons/Wwise/native/src
rm -r ./addons/Wwise/native/vs2022
rm ./addons/Wwise/native/SConstruct
rm ./LICENSE
rm ./README.md
rm .gitattributes
rm .gitmodules
rm -r ./.git
rm -r ./.github
rm -r ./addons/Wwise/tests
mkdir -p wwise wwise/GeneratedSoundBanks wwise/GeneratedSoundBanks/Windows wwise/GeneratedSoundBanks/Mac wwise/GeneratedSoundBanks/Linux wwise/GeneratedSoundBanks/iOS wwise/GeneratedSoundBanks/Android
cp addons/Wwise/tools/wwise_ids.template wwise/GeneratedSoundBanks/wwise_ids.gd
rm -r ./addons/Wwise/tools
- name: Upload final artifact
uses: actions/upload-artifact@v3
with:
name: wwise-${{ env.WWISE_VERSION }}-for-godot-${{ env.GODOT_ENGINE_VERSION }}-${{ env.GODOT_ENGINE_STAGE }}-${{ env.INTEGRATION_VERSION }}
path: ./

0 comments on commit be920fc

Please sign in to comment.