Skip to content

Commit 5ea544e

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

File tree

5 files changed

+27
-242
lines changed

5 files changed

+27
-242
lines changed

.github/actions/build/action.yml

Lines changed: 0 additions & 114 deletions
This file was deleted.

.github/workflows/builds.yml

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,6 @@ on:
55
pull_request:
66
merge_group:
77

8-
env:
9-
LIBNAME: example
10-
118
jobs:
129
build:
1310
strategy:
@@ -260,12 +257,13 @@ jobs:
260257
# os: ubuntu-20.04
261258
runs-on: ${{ matrix.os }}
262259
steps:
260+
# Clone this repository
263261
- name: Checkout
264262
uses: actions/checkout@v4
265263
with:
266264
submodules: true
267265

268-
# Lint
266+
# Lint
269267
#- name: Setup clang-format
270268
# shell: bash
271269
# run: |
@@ -275,16 +273,27 @@ jobs:
275273
# run: |
276274
# clang-format src/** --dry-run --Werror
277275

278-
# Build
279-
- name: 🔗 GDExtension Debug Build
280-
uses: ./.github/actions/build
276+
# Setup dependencies
277+
- name: Setup godot-cpp
278+
uses: ./godot-cpp/.github/actions/setup-godot-cpp
281279
with:
282280
platform: ${{ matrix.platform }}
283-
arch: ${{ matrix.arch }}
284-
float-precision: ${{ matrix.float-precision }}
285-
build-target-type: ${{ matrix.target-type }}
281+
em-version: 3.1.62
282+
283+
# Build GDExtension (with caches)
284+
- name: Cache .scons_cache
285+
uses: actions/cache@v4
286+
with:
287+
path: ${{ github.workspace }}/.scons-cache/
288+
key: ${{ matrix.platform }}_${{ matrix.arch }}_${{ matrix.float-precision }}_${{ matrix.target-type }}_cache
289+
- name: Build GDExtension Debug Build
290+
shell: sh
291+
env:
292+
SCONS_CACHE: ${{ github.workspace }}/.scons-cache/
293+
run: |
294+
scons target=${{ matrix.target-type }} platform=${{ matrix.platform }} arch=${{ matrix.arch }} precision=${{ matrix.float-precision }}
286295
287-
# Sign
296+
# Sign the binary (macOS only)
288297
- name: Mac Sign
289298
# Disable sign if secrets are not set
290299
if: ${{ matrix.platform == 'macos' && env.APPLE_CERT_BASE64 }}
@@ -300,11 +309,14 @@ jobs:
300309
APPLE_DEV_TEAM_ID: ${{ secrets.APPLE_DEV_TEAM_ID }}
301310
APPLE_DEV_APP_ID: ${{ secrets.APPLE_DEV_APP_ID }}
302311

312+
# Clean up compilation files
303313
- name: Windows - Delete compilation files
304314
if: ${{ matrix.platform == 'windows' }}
305315
shell: pwsh
306316
run: |
307317
Remove-Item bin/* -Include *.exp,*.lib,*.pdb -Force
318+
319+
# Upload the build
308320
- name: Upload Artifact
309321
uses: actions/upload-artifact@v4
310322
with:

.gitmodules

Lines changed: 1 addition & 1 deletion
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

Lines changed: 2 additions & 115 deletions
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)