Skip to content

Commit

Permalink
Refactor project structure. Simulation will be handled by godot inste…
Browse files Browse the repository at this point in the history
…ad of rust
  • Loading branch information
indubitablement2 committed Apr 15, 2024
1 parent 2a56b7a commit 37b7313
Show file tree
Hide file tree
Showing 55 changed files with 14,445 additions and 1,465 deletions.
12 changes: 12 additions & 0 deletions .github/actions/determinism/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: Test Godot project determinism
description: Test the Godot project determinism.
inputs:
bin:
description: The path to the Godot executable
required: true
runs:
using: "composite"
steps:
- name: Test determinism
shell: sh
run: ./godot/bin/${{ inputs.bin }} --headless --path ./client --quit-after 1000 --determinism-test=6000
18 changes: 18 additions & 0 deletions .github/actions/download-artifact/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Download Godot artifact
description: Download the Godot artifact.
inputs:
name:
description: The artifact name.
default: "${{ github.job }}"
path:
description: The path to download and extract to.
required: true
default: "./"
runs:
using: "composite"
steps:
- name: Download Godot Artifact
uses: actions/download-artifact@v3
with:
name: ${{ inputs.name }}
path: ${{ inputs.path }}
35 changes: 35 additions & 0 deletions .github/actions/godot-build/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Build Godot
description: Build Godot with the provided options.
inputs:
target:
description: Build target (editor, template_release, template_debug).
default: "editor"
platform:
description: Target platform.
required: false
sconsflags:
description: Extra flags.
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: |
cd godot
echo "Building with flags:" platform=${{ inputs.platform }} target=${{ inputs.target }} ${{ env.SCONSFLAGS }}
if [ "${{ inputs.target }}" != "editor" ]; then rm -rf editor; fi # Ensure we don't include editor code.
scons platform=${{ inputs.platform }} target=${{ inputs.target }} ${{ env.SCONSFLAGS }}
ls -l bin/
35 changes: 35 additions & 0 deletions .github/actions/godot-cache/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Setup Godot build cache
description: Setup 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:
# Upload cache on completion and check it out now
- name: Load .scons_cache directory
uses: actions/cache@v3
with:
path: ${{inputs.scons-cache}}
key: ${{inputs.cache-name}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}

# We try to match an existing cache to restore from it. Each potential key is checked against
# all existing caches as a prefix. E.g. 'linux-template-minimal' would match any cache that
# starts with "linux-template-minimal", such as "linux-template-minimal-master-refs/heads/master-6588a4a29af1621086feac0117d5d4d37af957fd".
#
# We check these prefixes in this order:
#
# 1. The exact match, including the base branch, the commit reference, and the SHA hash of the commit.
# 2. A partial match for the same base branch and the same commit reference.
# 3. A partial match for the same base branch and the base branch commit reference.
# 4. A partial match for the same base branch only (not ideal, matches any PR with the same base branch).

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}}-refs/heads/${{env.GODOT_BASE_BRANCH}}
${{inputs.cache-name}}-${{env.GODOT_BASE_BRANCH}}
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@v4
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.4.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: "godot/bin/*"
runs:
using: "composite"
steps:
- name: Upload Godot Artifact
uses: actions/upload-artifact@v3
with:
name: ${{ inputs.name }}
path: ${{ inputs.path }}
retention-days: 14
60 changes: 60 additions & 0 deletions .github/workflows/client_android_builds.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: 🤖 Client Android Builds
on:
workflow_call:

# Global Settings
env:
# Used for the cache key. Add version suffix to force clean build.
GODOT_BASE_BRANCH: 4.2
SCONSFLAGS: verbose=no warnings=extra werror=no debug_symbols=no lto=full custom_modules=../godot_custom_client

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

jobs:
android-template:
runs-on: "ubuntu-latest"
name: Template

steps:
- uses: actions/checkout@v4
with:
submodules: true

- name: Set up Java 17
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17

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

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

- name: Compilation (arm32)
uses: ./.github/actions/godot-build
with:
sconsflags: ${{ env.SCONSFLAGS }} arch=arm32
platform: android
target: template_release

- name: Compilation (arm64)
uses: ./.github/actions/godot-build
with:
sconsflags: ${{ env.SCONSFLAGS }} arch=arm64
platform: android
target: template_release

- name: Generate Godot templates
run: |
cd godot/platform/android/java
./gradlew generateGodotTemplates
cd ../../..
ls -l bin/
- name: Upload artifact
uses: ./.github/actions/upload-artifact
40 changes: 40 additions & 0 deletions .github/workflows/client_ios_builds.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: 🍏 Client iOS Builds
on:
workflow_call:

# Global Settings
env:
# Used for the cache key. Add version suffix to force clean build.
GODOT_BASE_BRANCH: 4.2
SCONSFLAGS: verbose=no warnings=extra werror=no debug_symbols=no lto=full custom_modules=../godot_custom_client

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

jobs:
ios-template:
runs-on: "macos-latest"
name: Template

steps:
- uses: actions/checkout@v4
with:
submodules: true

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

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

- name: Compilation (arm64)
uses: ./.github/actions/godot-build
with:
sconsflags: ${{ env.SCONSFLAGS }}
platform: ios
target: template_release

- name: Upload artifact
uses: ./.github/actions/upload-artifact
65 changes: 65 additions & 0 deletions .github/workflows/client_linux_builds.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: 🐧 Client Linux Builds
on:
workflow_call:

# Global Settings
env:
# Used for the cache key. Add version suffix to force clean build.
GODOT_BASE_BRANCH: 4.2
SCONSFLAGS: verbose=no warnings=extra werror=no lto=full custom_modules=../godot_custom_client

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

jobs:
build-linux:
runs-on: "ubuntu-latest"
name: ${{ matrix.name }}
strategy:
fail-fast: false
matrix:
include:
- name: Editor
cache-name: linux-editor
target: editor
bin: "godot.linuxbsd.editor.x86_64"

- name: Template
cache-name: linux-template
target: template_release
sconsflags: debug_symbols=no

steps:
- uses: actions/checkout@v4
with:
submodules: true

- name: Setup Godot build cache
uses: ./.github/actions/godot-cache
with:
cache-name: ${{ matrix.cache-name }}
continue-on-error: true

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

- name: Compilation
uses: ./.github/actions/godot-build
with:
sconsflags: ${{ env.SCONSFLAGS }} ${{ matrix.sconsflags }}
platform: linuxbsd
target: ${{ matrix.target }}

- name: Prepare artifact
run: |
strip godot/bin/godot.*
chmod +x godot/bin/godot.*
- name: Upload artifact
uses: ./.github/actions/upload-artifact
with:
name: ${{ matrix.cache-name }}
# - name: Test determinism
# uses: ./.github/actions/determinism
# if: ${{ matrix.target }} == "editor"
66 changes: 66 additions & 0 deletions .github/workflows/client_macos_builds.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: 🍎 Client macOS Builds
on:
workflow_call:

# Global Settings
env:
# Used for the cache key. Add version suffix to force clean build.
GODOT_BASE_BRANCH: 4.2
SCONSFLAGS: verbose=no warnings=extra werror=no lto=full custom_modules=../godot_custom_client

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

jobs:
build-macos:
runs-on: "macos-latest"
name: ${{ matrix.name }}
strategy:
fail-fast: false
matrix:
include:
- name: Editor
cache-name: macos-editor
target: editor
bin: "./bin/godot.macos.editor.x86_64"

- name: Template
cache-name: macos-template
target: template_release
sconsflags: debug_symbols=no

steps:
- uses: actions/checkout@v4
with:
submodules: true

- name: Setup Godot build cache
uses: ./.github/actions/godot-cache
with:
cache-name: ${{ matrix.cache-name }}
continue-on-error: true

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

- name: Setup Vulkan SDK
run: |
sh godot/misc/scripts/install_vulkan_sdk_macos.sh
- name: Compilation
uses: ./.github/actions/godot-build
with:
sconsflags: ${{ env.SCONSFLAGS }}
platform: macos
target: ${{ matrix.target }}

- name: Prepare artifact
run: |
strip godot/bin/godot.*
chmod +x godot/bin/godot.*
- name: Upload artifact
uses: ./.github/actions/upload-artifact
with:
name: ${{ matrix.cache-name }}
Loading

0 comments on commit 37b7313

Please sign in to comment.