Skip to content

Commit 9bd7df9

Browse files
committed
GitHub Workflow: Use new setup-godot-cpp github action from godot-cpp submodule.
1 parent f9564a9 commit 9bd7df9

File tree

5 files changed

+27
-239
lines changed

5 files changed

+27
-239
lines changed

.github/actions/build/action.yml

-114
This file was deleted.

.github/workflows/builds.yml

+23-8
Original file line numberDiff line numberDiff line change
@@ -260,12 +260,13 @@ jobs:
260260
# os: ubuntu-20.04
261261
runs-on: ${{ matrix.os }}
262262
steps:
263+
# Clone this repository
263264
- name: Checkout
264265
uses: actions/checkout@v4
265266
with:
266267
submodules: true
267268

268-
# Lint
269+
# Lint
269270
#- name: Setup clang-format
270271
# shell: bash
271272
# run: |
@@ -275,16 +276,27 @@ jobs:
275276
# run: |
276277
# clang-format src/** --dry-run --Werror
277278

278-
# Build
279-
- name: 🔗 GDExtension Debug Build
280-
uses: ./.github/actions/build
279+
# Setup dependencies
280+
- name: Setup godot-cpp
281+
uses: ./godot-cpp/.github/actions/setup-godot-cpp
281282
with:
282283
platform: ${{ matrix.platform }}
283-
arch: ${{ matrix.arch }}
284-
float-precision: ${{ matrix.float-precision }}
285-
build-target-type: ${{ matrix.target-type }}
284+
em-version: 3.1.62
286285

287-
# Sign
286+
# Build GDExtension (with caches)
287+
- name: Cache .scons_cache
288+
uses: actions/cache@v4
289+
with:
290+
path: ${{ github.workspace }}/.scons-cache/
291+
key: ${{ matrix.platform }}_${{ matrix.arch }}_${{ matrix.float-precision }}_${{ matrix.target-type }}_cache
292+
- name: Build GDExtension Debug Build
293+
shell: sh
294+
env:
295+
SCONS_CACHE: ${{ github.workspace }}/.scons-cache/
296+
run: |
297+
scons target=${{ matrix.target-type }} platform=${{ matrix.platform }} arch=${{ matrix.arch }} precision=${{ matrix.float-precision }}
298+
299+
# Sign the binary (macOS only)
288300
- name: Mac Sign
289301
# Disable sign if secrets are not set
290302
if: ${{ matrix.platform == 'macos' && env.APPLE_CERT_BASE64 }}
@@ -300,11 +312,14 @@ jobs:
300312
APPLE_DEV_TEAM_ID: ${{ secrets.APPLE_DEV_TEAM_ID }}
301313
APPLE_DEV_APP_ID: ${{ secrets.APPLE_DEV_APP_ID }}
302314

315+
# Clean up compilation files
303316
- name: Windows - Delete compilation files
304317
if: ${{ matrix.platform == 'windows' }}
305318
shell: pwsh
306319
run: |
307320
Remove-Item bin/* -Include *.exp,*.lib,*.pdb -Force
321+
322+
# Upload the build
308323
- name: Upload Artifact
309324
uses: actions/upload-artifact@v4
310325
with:

.gitmodules

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
[submodule "godot-cpp"]
22
path = godot-cpp
33
url = https://github.com/godotengine/godot-cpp.git
4-
branch = 4.0
4+
branch = 4.3

README.md

+2-115
Original file line numberDiff line numberDiff line change
@@ -26,121 +26,8 @@ For getting started after cloning your own copy to your local machine, you shoul
2626

2727
## Usage - Actions
2828

29-
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.
30-
31-
The action uses SConstruct for both godot-cpp and the GDExtension that is built.
32-
33-
To reuse the build actions, in a github actions yml file, do the following:
34-
35-
```yml
36-
name: Build GDExtension
37-
on:
38-
workflow_call:
39-
push:
40-
41-
jobs:
42-
build:
43-
strategy:
44-
fail-fast: false
45-
matrix:
46-
include:
47-
- platform: linux
48-
arch: x86_64
49-
os: ubuntu-20.04
50-
- platform: windows
51-
arch: x86_32
52-
os: windows-latest
53-
- platform: windows
54-
arch: x86_64
55-
os: windows-latest
56-
- platform: macos
57-
arch: universal
58-
os: macos-latest
59-
- platform: android
60-
arch: arm64
61-
os: ubuntu-20.04
62-
- platform: android
63-
arch: arm32
64-
os: ubuntu-20.04
65-
- platform: android
66-
arch: x86_64
67-
os: ubuntu-20.04
68-
- platform: android
69-
arch: x86_32
70-
os: ubuntu-20.04
71-
- platform: ios
72-
arch: arm64
73-
os: macos-latest
74-
- platform: web
75-
arch: wasm32
76-
os: ubuntu-20.04
77-
78-
runs-on: ${{ matrix.os }}
79-
steps:
80-
- name: Checkout
81-
uses: actions/checkout@v4
82-
with:
83-
submodules: true
84-
- name: 🔗 GDExtension Build
85-
uses: godotengine/godot-cpp-template/.github/actions/build@main
86-
with:
87-
platform: ${{ matrix.platform }}
88-
arch: ${{ matrix.arch }}
89-
float-precision: single
90-
build-target-type: template_release
91-
- name: 🔗 GDExtension Build
92-
uses: ./.github/actions/build
93-
with:
94-
platform: ${{ matrix.platform }}
95-
arch: ${{ matrix.arch }}
96-
float-precision: ${{ matrix.float-precision }}
97-
build-target-type: template_debug
98-
- name: Mac Sign
99-
if: ${{ matrix.platform == 'macos' && env.APPLE_CERT_BASE64 }}
100-
env:
101-
APPLE_CERT_BASE64: ${{ secrets.APPLE_CERT_BASE64 }}
102-
uses: godotengine/godot-cpp-template/.github/actions/sign@main
103-
with:
104-
FRAMEWORK_PATH: bin/macos/macos.framework
105-
APPLE_CERT_BASE64: ${{ secrets.APPLE_CERT_BASE64 }}
106-
APPLE_CERT_PASSWORD: ${{ secrets.APPLE_CERT_PASSWORD }}
107-
APPLE_DEV_PASSWORD: ${{ secrets.APPLE_DEV_PASSWORD }}
108-
APPLE_DEV_ID: ${{ secrets.APPLE_DEV_ID }}
109-
APPLE_DEV_TEAM_ID: ${{ secrets.APPLE_DEV_TEAM_ID }}
110-
APPLE_DEV_APP_ID: ${{ secrets.APPLE_DEV_APP_ID }}
111-
- name: Upload Artifact
112-
uses: actions/upload-artifact@v4
113-
with:
114-
name: GDExtension-${{ matrix.platform }}-${{ matrix.arch }}
115-
path: |
116-
${{ github.workspace }}/bin/**
117-
merge:
118-
runs-on: ubuntu-latest
119-
needs: build
120-
steps:
121-
- name: Merge Artifacts
122-
uses: actions/upload-artifact/merge@v4
123-
with:
124-
name: GDExtension-all
125-
pattern: GDExtension-*
126-
delete-merged: true
127-
```
128-
129-
The above example is a lengthy one, so we will go through it action by action to see what is going on.
130-
131-
In the `Checkout` step, we checkout the code.
132-
In the `🔗 GDExtension Build` step, we are using the reusable action:
133-
```yml
134-
uses: godotengine/godot-cpp-template/.github/actions/build@main
135-
with:
136-
platform: ${{ matrix.platform }}
137-
arch: ${{ matrix.arch }}
138-
float-precision: single
139-
build-target-type: template_release
140-
```
141-
with the parameters from the matrix.
142-
143-
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.
29+
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).
30+
After a workflow run is complete, you can find the file `godot-cpp-template.zip` on the `Actions` tab on GitHub.
14431

14532
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.
14633

0 commit comments

Comments
 (0)