Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitHub Workflow: Use new setup-godot-cpp github action from godot-cpp submodule. #70

Merged
merged 1 commit into from
Feb 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
114 changes: 0 additions & 114 deletions .github/actions/build/action.yml

This file was deleted.

34 changes: 23 additions & 11 deletions .github/workflows/builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@ on:
pull_request:
merge_group:

env:
LIBNAME: example

jobs:
build:
strategy:
Expand Down Expand Up @@ -260,12 +257,13 @@ jobs:
# os: ubuntu-20.04
runs-on: ${{ matrix.os }}
steps:
# Clone this repository
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true

# Lint
# Lint
#- name: Setup clang-format
# shell: bash
# run: |
Expand All @@ -275,16 +273,27 @@ jobs:
# run: |
# clang-format src/** --dry-run --Werror

# Build
- name: 🔗 GDExtension Debug Build
uses: ./.github/actions/build
# Setup dependencies
- name: Setup godot-cpp
uses: ./godot-cpp/.github/actions/setup-godot-cpp
with:
platform: ${{ matrix.platform }}
arch: ${{ matrix.arch }}
float-precision: ${{ matrix.float-precision }}
build-target-type: ${{ matrix.target-type }}
em-version: 3.1.62

# Build GDExtension (with caches)
- name: Cache .scons_cache
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/.scons-cache/
key: ${{ matrix.platform }}_${{ matrix.arch }}_${{ matrix.float-precision }}_${{ matrix.target-type }}_cache
- name: Build GDExtension Debug Build
shell: sh
env:
SCONS_CACHE: ${{ github.workspace }}/.scons-cache/
run: |
scons target=${{ matrix.target-type }} platform=${{ matrix.platform }} arch=${{ matrix.arch }} precision=${{ matrix.float-precision }}

# Sign
# Sign the binary (macOS only)
- name: Mac Sign
# Disable sign if secrets are not set
if: ${{ matrix.platform == 'macos' && env.APPLE_CERT_BASE64 }}
Expand All @@ -300,11 +309,14 @@ jobs:
APPLE_DEV_TEAM_ID: ${{ secrets.APPLE_DEV_TEAM_ID }}
APPLE_DEV_APP_ID: ${{ secrets.APPLE_DEV_APP_ID }}

# Clean up compilation files
- name: Windows - Delete compilation files
if: ${{ matrix.platform == 'windows' }}
shell: pwsh
run: |
Remove-Item bin/* -Include *.exp,*.lib,*.pdb -Force

# Upload the build
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
Expand Down
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[submodule "godot-cpp"]
path = godot-cpp
url = https://github.com/godotengine/godot-cpp.git
branch = 4.0
branch = 4.3
117 changes: 2 additions & 115 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,121 +26,8 @@ For getting started after cloning your own copy to your local machine, you shoul

## Usage - Actions

The actions builds `godot-cpp` at a specified location, and then builds the `gdextension` at a configurable location. It builds for desktop, mobile and web and allows for configuration on what platforms you need. It also supports configuration for debug and release builds, and for double builds.

The action uses SConstruct for both godot-cpp and the GDExtension that is built.

To reuse the build actions, in a github actions yml file, do the following:

```yml
name: Build GDExtension
on:
workflow_call:
push:

jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- platform: linux
arch: x86_64
os: ubuntu-20.04
- platform: windows
arch: x86_32
os: windows-latest
- platform: windows
arch: x86_64
os: windows-latest
- platform: macos
arch: universal
os: macos-latest
- platform: android
arch: arm64
os: ubuntu-20.04
- platform: android
arch: arm32
os: ubuntu-20.04
- platform: android
arch: x86_64
os: ubuntu-20.04
- platform: android
arch: x86_32
os: ubuntu-20.04
- platform: ios
arch: arm64
os: macos-latest
- platform: web
arch: wasm32
os: ubuntu-20.04

runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
- name: 🔗 GDExtension Build
uses: godotengine/godot-cpp-template/.github/actions/build@main
with:
platform: ${{ matrix.platform }}
arch: ${{ matrix.arch }}
float-precision: single
build-target-type: template_release
- name: 🔗 GDExtension Build
uses: ./.github/actions/build
with:
platform: ${{ matrix.platform }}
arch: ${{ matrix.arch }}
float-precision: ${{ matrix.float-precision }}
build-target-type: template_debug
- name: Mac Sign
if: ${{ matrix.platform == 'macos' && env.APPLE_CERT_BASE64 }}
env:
APPLE_CERT_BASE64: ${{ secrets.APPLE_CERT_BASE64 }}
uses: godotengine/godot-cpp-template/.github/actions/sign@main
with:
FRAMEWORK_PATH: bin/macos/macos.framework
APPLE_CERT_BASE64: ${{ secrets.APPLE_CERT_BASE64 }}
APPLE_CERT_PASSWORD: ${{ secrets.APPLE_CERT_PASSWORD }}
APPLE_DEV_PASSWORD: ${{ secrets.APPLE_DEV_PASSWORD }}
APPLE_DEV_ID: ${{ secrets.APPLE_DEV_ID }}
APPLE_DEV_TEAM_ID: ${{ secrets.APPLE_DEV_TEAM_ID }}
APPLE_DEV_APP_ID: ${{ secrets.APPLE_DEV_APP_ID }}
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: GDExtension-${{ matrix.platform }}-${{ matrix.arch }}
path: |
${{ github.workspace }}/bin/**
merge:
runs-on: ubuntu-latest
needs: build
steps:
- name: Merge Artifacts
uses: actions/upload-artifact/merge@v4
with:
name: GDExtension-all
pattern: GDExtension-*
delete-merged: true
```

The above example is a lengthy one, so we will go through it action by action to see what is going on.

In the `Checkout` step, we checkout the code.
In the `🔗 GDExtension Build` step, we are using the reusable action:
```yml
uses: godotengine/godot-cpp-template/.github/actions/build@main
with:
platform: ${{ matrix.platform }}
arch: ${{ matrix.arch }}
float-precision: single
build-target-type: template_release
```
with the parameters from the matrix.

As a result of this step, the binaries will be built in the `bin` folder (as specified in the SConstruct file). After all builds are completed, all individual builds will be merged into one common GDExtension-all zip that you can download.
This repository comes with a GitHub action that builds the GDExtension for cross-platform use. It triggers automatically for each pushed change. You can find and edit it in [builds.yml](.github/workflows/builds.yml).
After a workflow run is complete, you can find the file `godot-cpp-template.zip` on the `Actions` tab on GitHub.

Note: for macos, you will have to build the binary as a `.dylib` in a `EXTENSION-NAME.framework` folder. The framework folder should also have a `Resources` folder with a file called `Info.plist`. Without this file, signing will fail.

Expand Down
2 changes: 1 addition & 1 deletion godot-cpp
Submodule godot-cpp updated 44 files
+14 −11 .github/actions/godot-cache-restore/action.yml
+6 −5 .github/actions/godot-cache-save/action.yml
+62 −0 .github/actions/setup-godot-cpp/action.yml
+14 −37 .github/workflows/ci.yml
+21 −0 .github/workflows/runner.yml
+7 −2 .github/workflows/static_checks.yml
+4 −0 .gitignore
+15 −219 CMakeLists.txt
+1 −2 README.md
+59 −152 binding_generator.py
+183 −0 build_profile.py
+1 −1 cmake/common_compiler_flags.cmake
+240 −0 cmake/godotcpp.cmake
+57 −0 doc/cmake.md
+6 −2 include/godot_cpp/classes/ref.hpp
+21 −11 include/godot_cpp/classes/wrapped.hpp
+5 −2 include/godot_cpp/core/class_db.hpp
+8 −0 include/godot_cpp/core/defs.hpp
+73 −0 include/godot_cpp/core/print_string.hpp
+10 −9 include/godot_cpp/core/type_info.hpp
+1 −1 include/godot_cpp/templates/safe_refcount.hpp
+1 −1 include/godot_cpp/variant/basis.hpp
+42 −44 include/godot_cpp/variant/quaternion.hpp
+0 −2 include/godot_cpp/variant/variant.hpp
+4 −3 include/godot_cpp/variant/vector4.hpp
+31 −17 misc/scripts/check_get_file_list.py
+22 −20 src/classes/wrapped.cpp
+6 −1 src/core/class_db.cpp
+39 −0 src/core/print_string.cpp
+5 −2 src/variant/basis.cpp
+28 −40 src/variant/quaternion.cpp
+1 −0 test/SConstruct
+5 −1 test/build_profile.json
+6 −0 test/project/main.gd
+22 −0 test/src/example.cpp
+3 −0 test/src/example.h
+5 −0 tools/android.py
+31 −1 tools/common_compiler_flags.py
+42 −1 tools/godotcpp.py
+5 −0 tools/ios.py
+4 −0 tools/linux.py
+5 −0 tools/macos.py
+9 −1 tools/web.py
+56 −9 tools/windows.py