Updating to Godot 4.2-stable #62
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 | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
env: | |
OCULUS_VERSION: 59 | |
GODOT_ENGINE_VERSION: "4.2.0" | |
GODOT_ENGINE_STAGE: "stable" | |
INTEGRATION_VERSION: "v1.4.0-beta" | |
jobs: | |
lint: | |
name: 🧹 Lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Run clang-format style check | |
uses: jidicula/[email protected] | |
with: | |
clang-format-version: '14' | |
check-path: 'src' | |
exclude-regex: 'include' | |
- name: Cancelling parallel jobs | |
if: ${{ failure() }} | |
uses: andymckay/[email protected] | |
build-all: | |
runs-on: ${{ matrix.os }} | |
name: ${{ matrix.name }} | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- name: Windows | |
os: "windows-latest" | |
api-platform: windows | |
scons-platform: windows | |
artifact-name: windows | |
- name: macOS | |
os: "macos-11" | |
api-platform: mac | |
scons-platform: macos | |
artifact-name: macos | |
- name: Linux | |
os: "ubuntu-20.04" | |
api-platform: linux | |
scons-platform: linux | |
artifact-name: linux | |
- name: Android | |
os: "ubuntu-20.04" | |
api-platform: android | |
scons-platform: android | |
flags: arch=arm64v8 | |
artifact-name: android-lib | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Set godot-cpp commit hash env | |
shell: bash | |
run: | | |
cd godot-cpp | |
GODOT_CPP_COMMIT_HASH=$(git rev-parse HEAD) | |
echo "GODOT_CPP_COMMIT_HASH=$GODOT_CPP_COMMIT_HASH" >> $GITHUB_ENV | |
cd .. | |
- name: godot-cpp library cache | |
id: cache-godot-lib | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-godot-lib | |
with: | |
path: godot-cpp/bin | |
key: ${{ matrix.api-platform }}-build-${{ env.cache-name }}-${{ env.GODOT_CPP_COMMIT_HASH }} | |
- name: Set up Python 3.x | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.x" | |
architecture: "x64" | |
- name: Android dependencies | |
uses: nttld/setup-ndk@v1 | |
with: | |
ndk-version: r23c | |
link-to-sdk: true | |
if: matrix.api-platform == 'android' | |
- name: Install Scons | |
run: python -m pip install scons | |
- name: Compile Debug library | |
shell: bash | |
run: | | |
mkdir -p godot-cpp/bin | |
scons platform=${{ matrix.scons-platform }} target=template_debug generate_bindings=yes -j6 ${{ matrix.flags }} ${{ steps.cache-godot-lib.outputs.cache-hit == 'true' && 'build_library=no' || ''}} | |
- name: Compile Release library | |
shell: bash | |
run: | | |
scons platform=${{ matrix.scons-platform }} target=template_release generate_bindings=yes -j6 ${{ matrix.flags }} ${{ steps.cache-godot-lib.outputs.cache-hit == 'true' && 'build_library=no' || ''}} | |
- name: Upload generated addon libs | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ matrix.artifact-name }} | |
path: demo/addons/godot_oculus_platform | |
android-plugin: | |
runs-on: "ubuntu-20.04" | |
name: Android Plugin | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up JDK 17 for x64 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: "17" | |
distribution: "temurin" | |
architecture: x64 | |
- name: Change wrapper permissions | |
run: | | |
cd tools/godotoculusplatform-android-plugin/ | |
chmod +x ./gradlew | |
cd ../../ | |
- name: Build Android plugin | |
run: | | |
cd tools/godotoculusplatform-android-plugin/ | |
./gradlew build | |
cd ../../ | |
cp tools/godotoculusplatform-android-plugin/godotoculusplatform-android-plugin/build/outputs/aar/godotoculusplatform-android-plugin-debug.aar demo/addons/godot_oculus_platform/android_plugin | |
cp tools/godotoculusplatform-android-plugin/godotoculusplatform-android-plugin/build/outputs/aar/godotoculusplatform-android-plugin-release.aar demo/addons/godot_oculus_platform/android_plugin | |
- name: Upload Android Plugin | |
uses: actions/upload-artifact@v3 | |
with: | |
name: android-plugin | |
path: demo/addons/godot_oculus_platform/android_plugin | |
upload-addon: | |
runs-on: "ubuntu-20.04" | |
needs: [build-all, android-plugin] | |
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/godot_oculus_platform" ]; then | |
mkdir -p addons/godot_oculus_platform | |
cp ./LICENSE addons/godot_oculus_platform | |
fi | |
if [ -d windows ]; then | |
cp -r windows/* addons/godot_oculus_platform/ | |
rm -r windows | |
fi | |
if [ -d macos ]; then | |
cp -r macos/* addons/godot_oculus_platform/ | |
rm -r macos | |
fi | |
if [ -d linux ]; then | |
cp -r linux/* addons/godot_oculus_platform/ | |
rm -r linux | |
fi | |
if [ -d android-lib ]; then | |
cp -r android-lib/* addons/godot_oculus_platform/ | |
rm -r android-lib | |
fi | |
if [ ! -d "addons/godot_oculus_platform/android_plugin" ]; then | |
mkdir -p addons/godot_oculus_platform/android_plugin | |
fi | |
if [ -d android-plugin ]; then | |
cp -r android-plugin/* addons/godot_oculus_platform/android_plugin/ | |
rm -r android-plugin | |
fi | |
- name: Clean up addon | |
run: | | |
rm -r ./godot-cpp | |
rm -r ./src | |
rm -r ./tools | |
rm -r ./demo | |
rm ./SConstruct | |
rm ./LICENSE | |
rm ./README.md | |
rm .gitignore | |
rm .gitmodules | |
rm .clang-format | |
rm -r ./.git | |
rm -r ./.github | |
- name: Upload final artifact | |
uses: actions/upload-artifact@v3 | |
with: | |
name: GodotOculusPlatform-${{ env.INTEGRATION_VERSION }}_Godot-${{ env.GODOT_ENGINE_VERSION }}-${{ env.GODOT_ENGINE_STAGE }}_SDK-${{ env.OCULUS_VERSION }} | |
path: ./ |