Skip to content

Commit

Permalink
Merge pull request godotengine#98956 from akien-mga/3.2-ci-sync-with-3.x
Browse files Browse the repository at this point in the history
[3.2] CI: Partially sync workflows and actions with 3.x branch
  • Loading branch information
akien-mga authored Nov 8, 2024
2 parents a030197 + 742eae5 commit f85956e
Show file tree
Hide file tree
Showing 36 changed files with 665 additions and 472 deletions.
38 changes: 38 additions & 0 deletions .github/actions/godot-build/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Build Godot
description: Build Godot with the provided options.
inputs:
target:
description: The scons target (debug/release_debug/release).
default: "debug"
tools:
description: If tools are to be built.
default: false
tests:
description: If tests are to be built.
default: false
platform:
description: The Godot platform to build.
required: false
sconsflags:
default: ""
scons-cache:
description: The scons cache path.
default: "${{ github.workspace }}/.scons-cache/"
scons-cache-limit:
description: The scons cache size limit.
# actions/cache has 10 GiB limit, and GitHub runners have a 14 GiB disk.
# Limit to 7 GiB to avoid having the extracted cache fill the disk.
default: 7168
runs:
using: "composite"
steps:
- name: Scons Build
shell: sh
env:
SCONSFLAGS: ${{ inputs.sconsflags }}
SCONS_CACHE: ${{ inputs.scons-cache }}
SCONS_CACHE_LIMIT: ${{ inputs.scons-cache-limit }}
run: |
echo "Building with flags:" ${{ env.SCONSFLAGS }}
scons p=${{ inputs.platform }} target=${{ inputs.target }} tools=${{ inputs.tools }} tests=${{ inputs.tests }} --jobs=2 ${{ env.SCONSFLAGS }}
ls -l bin/
21 changes: 21 additions & 0 deletions .github/actions/godot-cache-restore/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Restore Godot build cache
description: Restore Godot build cache.
inputs:
cache-name:
description: The cache base name (job name by default).
default: "${{github.job}}"
scons-cache:
description: The scons cache path.
default: "${{github.workspace}}/.scons-cache/"
runs:
using: "composite"
steps:
- name: Restore .scons_cache directory
uses: actions/cache/restore@v4
with:
path: ${{inputs.scons-cache}}
key: ${{inputs.cache-name}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
restore-keys: |
${{inputs.cache-name}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
${{inputs.cache-name}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}
${{inputs.cache-name}}-${{env.GODOT_BASE_BRANCH}}
17 changes: 17 additions & 0 deletions .github/actions/godot-cache-save/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Save Godot build cache
description: Save Godot build cache.
inputs:
cache-name:
description: The cache base name (job name by default).
default: "${{github.job}}"
scons-cache:
description: The scons cache path.
default: "${{github.workspace}}/.scons-cache/"
runs:
using: "composite"
steps:
- name: Save .scons_cache directory
uses: actions/cache/save@v4
with:
path: ${{inputs.scons-cache}}
key: ${{inputs.cache-name}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
27 changes: 27 additions & 0 deletions .github/actions/godot-deps/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Setup python and scons
description: Setup python, install the pip version of scons.
inputs:
python-version:
description: The python version to use.
default: "3.x"
python-arch:
description: The python architecture.
default: "x64"
runs:
using: "composite"
steps:
# 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: ${{ inputs.python-version }}
# Optional - x64 or x86 architecture, defaults to x64
architecture: ${{ inputs.python-arch }}

- name: Setup scons
shell: bash
run: |
python -c "import sys; print(sys.version)"
python -m pip install scons==4.7.0
scons --version
19 changes: 19 additions & 0 deletions .github/actions/upload-artifact/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Upload Godot artifact
description: Upload the Godot artifact.
inputs:
name:
description: The artifact name.
default: "${{ github.job }}"
path:
description: The path to upload.
required: true
default: "bin/*"
runs:
using: "composite"
steps:
- name: Upload Godot Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.name }}
path: ${{ inputs.path }}
retention-days: 14
66 changes: 40 additions & 26 deletions .github/workflows/android_builds.yml
Original file line number Diff line number Diff line change
@@ -1,32 +1,34 @@
name: 🤖 Android Builds
on: [push, pull_request]
on:
workflow_call:

# Global Settings
env:
SCONSFLAGS: platform=android verbose=yes warnings=all werror=yes debug_symbols=no --jobs=2
# Only used for the cache key. Increment version to force clean build.
GODOT_BASE_BRANCH: 3.2
SCONSFLAGS: verbose=yes warnings=all werror=yes debug_symbols=no
ANDROID_HOME: /home/runner/work/godot/godot/android-sdk
ANDROID_NDK_ROOT: /home/runner/work/godot/godot/android-sdk/ndk/21.1.6352462
ANDROID_NDK_VERSION: 21.1.6352462

concurrency:
group: ci-${{github.actor}}-${{github.head_ref || github.run_number}}-${{github.ref}}-android
cancel-in-progress: true

jobs:
android-template:
runs-on: "ubuntu-20.04"

name: Template (target=release, tools=no)

steps:
- uses: actions/checkout@v4

# Azure repositories are not reliable, we need to prevent azure giving us packages.
- name: Make apt sources.list use the default Ubuntu repositories
run: |
sudo rm -f /etc/apt/sources.list.d/*
sudo cp -f misc/ci/sources.list /etc/apt/sources.list
sudo apt-get update
- name: Set up Java 8, Android SDK and NDK
run: |
# Not using actions/setup-java and android-actions/setup-android as I couldn't make them work for such old Java/SDK/NDK combination.
# Azure repositories are flaky, remove them.
sudo rm -f /etc/apt/sources.list.d/{azure,microsoft}*
sudo apt-get update
sudo apt-get install openjdk-8-jdk
sudo update-alternatives --set java /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java
mkdir -p ${{env.ANDROID_HOME}}
Expand All @@ -38,27 +40,39 @@ jobs:
# https://github.com/godotengine/build-containers/blob/3.2/Dockerfile.android
./cmdline-tools/bin/sdkmanager --sdk_root=${{env.ANDROID_HOME}} 'build-tools;28.0.3' 'platforms;android-28' 'cmake;3.10.2.4988404' 'ndk;${{env.ANDROID_NDK_VERSION}}'
# Use python 3.x release (works cross platform)
- name: Set up Python 3.x
uses: actions/setup-python@v5
- name: Restore Godot build cache
uses: ./.github/actions/godot-cache-restore
continue-on-error: true

- name: Setup python and scons
uses: ./.github/actions/godot-deps

- name: Compilation (armv7)
uses: ./.github/actions/godot-build
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'
sconsflags: ${{ env.SCONSFLAGS }} android_arch=armv7
platform: android
target: release
tools: false

- name: Configuring Python packages
run: |
python -c "import sys; print(sys.version)"
python -m pip install scons
python --version
scons --version
- name: Compilation (arm64v8)
uses: ./.github/actions/godot-build
with:
sconsflags: ${{ env.SCONSFLAGS }} android_arch=arm64v8
platform: android
target: release
tools: false

- name: Save Godot build cache
uses: ./.github/actions/godot-cache-save
continue-on-error: true

- name: Compilation
- name: Generate Godot templates
run: |
scons target=release tools=no android_arch=armv7
scons target=release tools=no android_arch=arm64v8
cd platform/android/java
./gradlew generateGodotTemplates
cd ../../..
ls -l bin/
- name: Upload artifact
uses: ./.github/actions/upload-artifact
52 changes: 30 additions & 22 deletions .github/workflows/ios_builds.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
name: 🍏 iOS Builds
on: [push, pull_request]
on:
workflow_call:

# Global Settings
env:
SCONSFLAGS: platform=iphone verbose=yes warnings=all werror=no debug_symbols=no --jobs=2
# Only used for the cache key. Increment version to force clean build.
GODOT_BASE_BRANCH: 3.2
# iOS platform on this branch doesn't build without errors.
SCONSFLAGS: verbose=yes warnings=all werror=no debug_symbols=no

concurrency:
group: ci-${{github.actor}}-${{github.head_ref || github.run_number}}-${{github.ref}}-ios
cancel-in-progress: true

jobs:
ios-template:
Expand All @@ -13,24 +21,24 @@ jobs:
steps:
- uses: actions/checkout@v4

# Use python 3.x release (works cross platform)
- name: Set up Python 3.x
uses: actions/setup-python@v5
- name: Restore Godot build cache
uses: ./.github/actions/godot-cache-restore
continue-on-error: true

- name: Setup python and scons
uses: ./.github/actions/godot-deps

- name: Compilation (arm64v8)
uses: ./.github/actions/godot-build
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'

# You can test your matrix by printing the current Python version
- name: Configuring Python packages
run: |
python -c "import sys; print(sys.version)"
python -m pip install scons
python --version
scons --version
- name: Compilation
run: |
scons target=release tools=no
ls -l bin/
sconsflags: ${{ env.SCONSFLAGS }}
platform: iphone
target: release
tools: false

- name: Save Godot build cache
uses: ./.github/actions/godot-cache-save
continue-on-error: true

- name: Upload artifact
uses: ./.github/actions/upload-artifact
69 changes: 31 additions & 38 deletions .github/workflows/javascript_builds.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
name: 🌐 JavaScript Builds
on: [push, pull_request]
on:
workflow_call:

# Global Settings
env:
SCONSFLAGS: platform=javascript verbose=yes warnings=all werror=yes debug_symbols=no --jobs=2
# Only used for the cache key. Increment version to force clean build.
GODOT_BASE_BRANCH: 3.2
SCONSFLAGS: verbose=yes warnings=all werror=yes debug_symbols=no
EM_VERSION: 1.39.20
EM_CACHE_FOLDER: 'emsdk-cache'
EM_CACHE_FOLDER: "emsdk-cache"

concurrency:
group: ci-${{github.actor}}-${{github.head_ref || github.run_number}}-${{github.ref}}-javascript
cancel-in-progress: true

jobs:
javascript-template:
Expand All @@ -15,49 +22,35 @@ jobs:
steps:
- uses: actions/checkout@v4

# Azure repositories are not reliable, we need to prevent azure giving us packages.
- name: Make apt sources.list use the default Ubuntu repositories
run: |
sudo rm -f /etc/apt/sources.list.d/*
sudo cp -f misc/ci/sources.list /etc/apt/sources.list
sudo apt-get update
# Additional cache for Emscripten generated system libraries
- name: Load Emscripten cache
id: javascript-template-emscripten-cache
uses: actions/cache@v4
with:
path: ${{env.EM_CACHE_FOLDER}}
key: ${{env.EM_VERSION}}-${{github.job}}

# 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'

# You can test your matrix by printing the current Python version
- name: Configuring Python packages
run: |
python -c "import sys; print(sys.version)"
python -m pip install scons
python --version
scons --version
- name: Set up Emscripten latest
uses: mymindstorm/setup-emsdk@v14
with:
version: ${{env.EM_VERSION}}
actions-cache-folder: ${{env.EM_CACHE_FOLDER}}
cache-key: emsdk-${{ matrix.cache-name }}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}

- name: Verify Emscripten setup
run: |
emcc -v
- name: Restore Godot build cache
uses: ./.github/actions/godot-cache-restore
continue-on-error: true

- name: Setup python and scons
uses: ./.github/actions/godot-deps

- name: Compilation
run: |
scons target=release tools=no use_closure_compiler=yes
ls -l bin/
uses: ./.github/actions/godot-build
with:
sconsflags: ${{ env.SCONSFLAGS }}
platform: javascript
target: release
tools: false

- name: Save Godot build cache
uses: ./.github/actions/godot-cache-save
continue-on-error: true

- name: Upload artifact
uses: ./.github/actions/upload-artifact
Loading

0 comments on commit f85956e

Please sign in to comment.