Skip to content

Commit

Permalink
Separate setup-godot-cpp action from build action, to allow for more …
Browse files Browse the repository at this point in the history
…customizability.
  • Loading branch information
Ivorforce committed Nov 10, 2024
1 parent 128d2ee commit 2109cd9
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 66 deletions.
71 changes: 5 additions & 66 deletions .github/actions/build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,73 +30,12 @@ inputs:
runs:
using: composite
steps:
# Android only
- name: Android - Set up Java 17
uses: actions/setup-java@v4
if: ${{ inputs.platform == 'android' }}
- name: Setup godot-cpp
uses: ./.github/actions/setup-godot-cpp
with:
distribution: temurin
java-version: 17

- name: Android - Remove existing Android SDK, and set up ENV vars
if: ${{ inputs.platform == 'android' }}
shell: sh
run: |
sudo rm -r /usr/local/lib/android/sdk/**
export ANDROID_HOME=/usr/local/lib/android/sdk
export ANDROID_SDK_ROOT=$ANDROID_HOME
export ANDROID_NDK_VERSION=23.2.8568313
export ANDROID_NDK_ROOT=${ANDROID_SDK_ROOT}/ndk/${ANDROID_NDK_VERSION}
echo "ANDROID_HOME=$ANDROID_HOME" >> "$GITHUB_ENV"
echo "ANDROID_SDK_ROOT=$ANDROID_SDK_ROOT" >> "$GITHUB_ENV"
echo "ANDROID_NDK_VERSION=$ANDROID_NDK_VERSION" >> "$GITHUB_ENV"
echo "ANDROID_NDK_ROOT=$ANDROID_NDK_ROOT" >> "$GITHUB_ENV"
- name: Android - Set up Android SDK
if: ${{ inputs.platform == 'android' }}
uses: android-actions/setup-android@v3
with:
packages: "ndk;${{ env.ANDROID_NDK_VERSION }} cmdline-tools;latest build-tools;34.0.0 platforms;android-34 cmake;3.22.1"
# Linux only
- name: Linux - dependencies
if: ${{ inputs.platform == 'linux' }}
shell: sh
run: |
sudo apt-get update -qq
sudo apt-get install -qqq build-essential pkg-config
# Web only
- name: Web - Set up Emscripten latest
if: ${{ inputs.platform == 'web' }}
uses: mymindstorm/setup-emsdk@v14
with:
version: ${{ inputs.em_version }}
actions-cache-folder: ${{ inputs.em-cache-directory }}.${{ inputs.float-precision }}.${{ inputs.build-target-type }}
- name: Web - Verify Emscripten setup
if: ${{ inputs.platform == 'web' }}
shell: sh
run: |
emcc -v
# Windows only
- name: Windows - Setup MinGW for Windows/MinGW build
uses: egor-tensin/setup-mingw@v2
if: ${{ inputs.platform == 'windows' }}
with:
version: 12.2.0
# Dependencies of godot
# Use python 3.x release (works cross platform)
- name: Set up Python 3.x
uses: actions/setup-python@v5
with:
# Semantic version range syntax or exact version of a Python version
python-version: "3.x"
# Optional - x64 or x86 architecture, defaults to x64
architecture: "x64"
- name: Setup scons
shell: bash
run: |
python -c "import sys; print(sys.version)"
python -m pip install scons==4.4.0
scons --version
platform: ${{ matrix.platform }}
em-version: ${{ inputs.em_version }}
em-cache-directory: ${{ inputs.em-cache-directory }}.${{ inputs.float-precision }}.${{ inputs.build-target-type }}
# Build
- name: Cache .scons_cache
uses: actions/cache@v4
Expand Down
84 changes: 84 additions & 0 deletions .github/actions/setup-godot-cpp/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Setup godot-cpp
description: Setup build dependencies for godot-cpp.

inputs:
platform:
required: true
description: Target platform.
em-version:
default: 3.1.62
description: Emscripten version.
em-cache-directory:
default: emsdk-cache
description: Emscripten cache directory.

runs:
using: composite
steps:
# Android only
- name: Android - Set up Java 17
uses: actions/setup-java@v4
if: ${{ inputs.platform == 'android' }}
with:
distribution: temurin
java-version: 17

- name: Android - Remove existing Android SDK, and set up ENV vars
if: ${{ inputs.platform == 'android' }}
shell: sh
run: |
sudo rm -r /usr/local/lib/android/sdk/**
export ANDROID_HOME=/usr/local/lib/android/sdk
export ANDROID_SDK_ROOT=$ANDROID_HOME
export ANDROID_NDK_VERSION=23.2.8568313
export ANDROID_NDK_ROOT=${ANDROID_SDK_ROOT}/ndk/${ANDROID_NDK_VERSION}
echo "ANDROID_HOME=$ANDROID_HOME" >> "$GITHUB_ENV"
echo "ANDROID_SDK_ROOT=$ANDROID_SDK_ROOT" >> "$GITHUB_ENV"
echo "ANDROID_NDK_VERSION=$ANDROID_NDK_VERSION" >> "$GITHUB_ENV"
echo "ANDROID_NDK_ROOT=$ANDROID_NDK_ROOT" >> "$GITHUB_ENV"
- name: Android - Set up Android SDK
if: ${{ inputs.platform == 'android' }}
uses: android-actions/setup-android@v3
with:
packages: "ndk;${{ env.ANDROID_NDK_VERSION }} cmdline-tools;latest build-tools;34.0.0 platforms;android-34 cmake;3.22.1"
# Linux only
- name: Linux - dependencies
if: ${{ inputs.platform == 'linux' }}
shell: sh
run: |
sudo apt-get update -qq
sudo apt-get install -qqq build-essential pkg-config
# Web only
- name: Web - Set up Emscripten latest
if: ${{ inputs.platform == 'web' }}
uses: mymindstorm/setup-emsdk@v14
with:
version: ${{ inputs.em-version }}
actions-cache-folder: ${{ inputs.em-cache-directory }}
- name: Web - Verify Emscripten setup
if: ${{ inputs.platform == 'web' }}
shell: sh
run: |
emcc -v
# Windows only
- name: Windows - Setup MinGW for Windows/MinGW build
uses: egor-tensin/setup-mingw@v2
if: ${{ inputs.platform == 'windows' }}
with:
version: 12.2.0
# Dependencies of godot
# Use python 3.x release (works cross platform)
- name: Set up Python 3.x
uses: actions/setup-python@v5
with:
# Semantic version range syntax or exact version of a Python version
python-version: "3.x"
# Optional - x64 or x86 architecture, defaults to x64
architecture: "x64"
- name: Setup scons
shell: bash
run: |
python -c "import sys; print(sys.version)"
python -m pip install scons==4.4.0
scons --version

0 comments on commit 2109cd9

Please sign in to comment.