From cd621ee3ea9b419fe2ded1d96887303b0bcbe716 Mon Sep 17 00:00:00 2001 From: Serhii Snitsaruk Date: Tue, 1 Aug 2023 10:25:13 +0200 Subject: [PATCH] GH: Create Android workflow --- .github/workflows/android.yml | 188 ++++++++++++++++++++++++++++++++++ .github/workflows/linux.yml | 14 +-- 2 files changed, 195 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/android.yml diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml new file mode 100644 index 0000000..08a51d3 --- /dev/null +++ b/.github/workflows/android.yml @@ -0,0 +1,188 @@ +name: 🤖 Android builds +on: + workflow_call: + inputs: + godot_treeish: + description: A tag, branch or commit hash in the Godot repository. + type: string + default: master + limboai_treeish: + description: A tag, branch or commit hash in the LimboAI repository. + type: string + default: master + + workflow_dispatch: + inputs: + godot_treeish: + description: A tag, branch or commit hash in the Godot repository. + type: string + default: master + limboai_treeish: + description: A tag, branch or commit hash in the LimboAI repository. + type: string + default: master + +# Global Settings +env: + SCONS_CACHE_LIMIT: 4096 + SCONSFLAGS: production=yes tests=no verbose=yes warnings=extra werror=yes + DOTNET_NOLOGO: true + DOTNET_CLI_TELEMETRY_OPTOUT: true + +jobs: + android-builds: + runs-on: "ubuntu-20.04" + name: ${{ matrix.name }} + strategy: + fail-fast: false + matrix: + include: + - name: Template (arm64, debug) + arch: arm64 + target: template_debug + + - name: Template (arm64, release) + arch: arm64 + target: template_release + + - name: Template (arm32, debug) + arch: arm32 + target: template_debug + + - name: Template (arm32, release) + arch: arm32 + target: template_release + + - name: Template (x86_64, debug) + arch: x86_64 + target: template_debug + + - name: Template (x86_64, release) + arch: x86_64 + target: template_release + + - name: Template (x86_32, debug) + arch: x86_32 + target: template_debug + + - name: Template (x86_32, release) + arch: x86_32 + target: template_release + + env: + BIN: godot.linuxbsd.${{matrix.target}}.${{matrix.arch}} #${{ matrix.build-mono == true && '.mono' || '' }} + + steps: + - name: Clone Godot + uses: actions/checkout@v3 + with: + repository: godotengine/godot + ref: ${{ inputs.godot_treeish }} + + - name: Clone LimboAI module + uses: actions/checkout@v3 + with: + path: modules/limboai + ref: ${{ inputs.limboai_treeish }} + + - name: Set up Java 11 + uses: actions/setup-java@v3 + with: + distribution: temurin + java-version: 11 + + - name: Set up cache + uses: actions/cache@v3 + with: + path: ${{github.workspace}}/.scons_cache/ + key: ${{matrix.cache-name}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}} + restore-keys: | + ${{env.BIN}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}} + ${{env.BIN}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}} + ${{env.BIN}}-${{env.GODOT_BASE_BRANCH}} + + - name: Set up scons + run: | + python -c "import sys; print(sys.version)" + python -m pip install scons==4.4.0 + python --version + scons --version + + - name: Compilation + env: + SCONS_CACHE: ${{github.workspace}}/.scons_cache/ + run: | + scons platform=android target=${{matrix.target}} arch=${{matrix.arch}} ${{env.SCONSFLAGS}} + ls platform/android/java/lib/libs/* + + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + name: android-templates + path: platform/android/java/lib/libs/* + + + make-android-package: + runs-on: "ubuntu-20.04" + name: Make Android package + needs: android-builds + + steps: + - name: Clone Godot + uses: actions/checkout@v3 + with: + repository: godotengine/godot + ref: ${{ inputs.godot_treeish }} + + - name: Fetch editor artifact + uses: actions/download-artifact@v3 + with: + name: android-templates + path: platform/android/java/lib/libs/ + + - name: Set up Java 11 + uses: actions/setup-java@v3 + with: + distribution: temurin + java-version: 11 + + - name: Set up Python 3.x + uses: actions/setup-python@v4 + with: + python-version: 3.x + architecture: x64 + + - name: Setup scons + run: | + python -c "import sys; print(sys.version)" + python -m pip install scons==4.4.0 + python --version + scons --version + + - name: Generate Godot templates + run: | + cd platform/android/java + ./gradlew generateGodotTemplates + cd ../../.. + ls -l bin/ + + mkdir -p out/templates/ + mv bin/android_* out/templates/ + ls -l out/* + + - uses: geekyeggo/delete-artifact@v2 + with: + name: android-templates + failOnError: false + + - name: Upload Android lib + uses: actions/upload-artifact@v3 + with: + name: godot.limboai.android-lib + path: bin/godot-lib.* + + - name: Upload templates + uses: actions/upload-artifact@v3 + with: + name: godot.limboai.export-templates + path: out/* diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 888ee88..0f0d893 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -102,20 +102,20 @@ jobs: BIN: godot.linuxbsd.${{matrix.target}}.${{matrix.arch}}${{ matrix.build-mono == true && '.mono' || '' }} steps: - # Clone Godot - - uses: actions/checkout@v3 + - name: Clone Godot + uses: actions/checkout@v3 with: repository: godotengine/godot ref: ${{ inputs.godot_treeish }} - # Clone limboai module - - uses: actions/checkout@v3 + - name: Clone LimboAI module + uses: actions/checkout@v3 with: path: modules/limboai ref: ${{ inputs.limboai_treeish }} # About sed see: https://github.com/godotengine/buildroot/issues/6 - - name: Setup buildroot x86_64 + - name: Set up buildroot x86_64 if: matrix.arch == 'x86_64' run: | wget https://download.tuxfamily.org/godotengine/toolchains/linux/x86_64-godot-linux-gnu_sdk-buildroot.tar.bz2 @@ -126,7 +126,7 @@ jobs: ./relocate-sdk.sh cd .. - - name: Setup buildroot x86_32 + - name: Set up buildroot x86_32 if: matrix.arch == 'x86_32' run: | wget https://download.tuxfamily.org/godotengine/toolchains/linux/i686-godot-linux-gnu_sdk-buildroot.tar.bz2 @@ -152,7 +152,7 @@ jobs: SCONS_CACHE: ${{github.workspace}}/.scons_cache/ run: | PATH=${GITHUB_WORKSPACE}/buildroot/bin:$PATH - scons -j2 platform=linuxbsd target=${{matrix.target}} arch=${{matrix.arch}} module_mono_enabled=${{matrix.build-mono}} ${{env.SCONSFLAGS}} + scons platform=linuxbsd target=${{matrix.target}} arch=${{matrix.arch}} module_mono_enabled=${{matrix.build-mono}} ${{env.SCONSFLAGS}} - name: Generate C# glue if: matrix.build-mono && matrix.target == 'editor'