Skip to content

Commit e6a2177

Browse files
committed
CI: Extract godot-cpp testing into its own job
This ensures that the godot-cpp job has plenty of resources to run its build and avoid being affected by the main build. Additionally: - Extract test tasks into dedicated actions. - Upload artifacts as early as possible. - Ensure that we check master cache before random cache. (cherry picked from commit deb6025)
1 parent 1fe01a7 commit e6a2177

File tree

10 files changed

+233
-99
lines changed

10 files changed

+233
-99
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Download Godot artifact
2+
description: Download the Godot artifact.
3+
inputs:
4+
name:
5+
description: The artifact name.
6+
default: "${{ github.job }}"
7+
path:
8+
description: The path to download and extract to.
9+
required: true
10+
default: "./"
11+
runs:
12+
using: "composite"
13+
steps:
14+
- name: Download Godot Artifact
15+
uses: actions/download-artifact@v3
16+
with:
17+
name: ${{ inputs.name }}
18+
path: ${{ inputs.path }}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Dump Godot API
2+
description: Dump Godot API for GDExtension
3+
inputs:
4+
bin:
5+
description: The path to the Godot executable
6+
required: true
7+
runs:
8+
using: "composite"
9+
steps:
10+
# Dump GDExtension interface and API
11+
- name: Dump GDExtension interface and API for godot-cpp build
12+
shell: sh
13+
run: |
14+
${{ inputs.bin }} --headless --dump-gdextension-interface --dump-extension-api
15+
mkdir godot-api
16+
cp -f gdextension_interface.h godot-api/
17+
cp -f extension_api.json godot-api/
18+
19+
- name: Upload API dump
20+
uses: ./.github/actions/upload-artifact
21+
with:
22+
name: 'godot-api-dump'
23+
path: './godot-api/*'
24+

.github/actions/godot-cache/action.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,20 @@ runs:
1616
with:
1717
path: ${{inputs.scons-cache}}
1818
key: ${{inputs.cache-name}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
19+
20+
# We try to match an existing cache to restore from it. Each potential key is checked against
21+
# all existing caches as a prefix. E.g. 'linux-template-minimal' would match any cache that
22+
# starts with "linux-template-minimal", such as "linux-template-minimal-master-refs/heads/master-6588a4a29af1621086feac0117d5d4d37af957fd".
23+
#
24+
# We check these prefixes in this order:
25+
#
26+
# 1. The exact match, including the base branch, the commit reference, and the SHA hash of the commit.
27+
# 2. A partial match for the same base branch and the same commit reference.
28+
# 3. A partial match for the same base branch and the base branch commit reference.
29+
# 4. A partial match for the same base branch only (not ideal, matches any PR with the same base branch).
30+
1931
restore-keys: |
2032
${{inputs.cache-name}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
2133
${{inputs.cache-name}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}
34+
${{inputs.cache-name}}-${{env.GODOT_BASE_BRANCH}}-refs/heads/${{env.GODOT_BASE_BRANCH}}
2235
${{inputs.cache-name}}-${{env.GODOT_BASE_BRANCH}}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Test Godot project converter
2+
description: Test the Godot project converter.
3+
inputs:
4+
bin:
5+
description: The path to the Godot executable
6+
required: true
7+
runs:
8+
using: "composite"
9+
steps:
10+
- name: Test 3-to-4 conversion
11+
shell: sh
12+
run: |
13+
mkdir converter_test
14+
cd converter_test
15+
touch project.godot
16+
../${{ inputs.bin }} --headless --validate-conversion-3to4
17+
cd ..
18+
rm converter_test -rf
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Test Godot project
2+
description: Run the test Godot project.
3+
inputs:
4+
bin:
5+
description: The path to the Godot executable
6+
required: true
7+
runs:
8+
using: "composite"
9+
steps:
10+
# Download and extract zip archive with project, folder is renamed to be able to easy change used project
11+
- name: Download test project
12+
shell: sh
13+
run: |
14+
wget https://github.com/godotengine/regression-test-project/archive/4.0.zip
15+
unzip 4.0.zip
16+
mv "regression-test-project-4.0" "test_project"
17+
18+
# Editor is quite complicated piece of software, so it is easy to introduce bug here.
19+
20+
- name: Open and close editor (Vulkan)
21+
shell: sh
22+
run: |
23+
xvfb-run ${{ inputs.bin }} --audio-driver Dummy --editor --quit --path test_project 2>&1 | tee sanitizers_log.txt || true
24+
misc/scripts/check_ci_log.py sanitizers_log.txt
25+
26+
- name: Open and close editor (GLES3)
27+
shell: sh
28+
run: |
29+
DRI_PRIME=0 xvfb-run ${{ inputs.bin }} --audio-driver Dummy --rendering-driver opengl3 --editor --quit --path test_project 2>&1 | tee sanitizers_log.txt || true
30+
misc/scripts/check_ci_log.py sanitizers_log.txt
31+
32+
# Run test project
33+
- name: Run project
34+
shell: sh
35+
run: |
36+
xvfb-run ${{ inputs.bin }} 40 --audio-driver Dummy --path test_project 2>&1 | tee sanitizers_log.txt || true
37+
misc/scripts/check_ci_log.py sanitizers_log.txt

.github/workflows/godot_cpp_test.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: 🪲 Godot CPP
2+
on:
3+
workflow_call:
4+
5+
# Global Settings
6+
env:
7+
# Used for the cache key, and godot-cpp checkout. Add version suffix to force clean build.
8+
GODOT_BASE_BRANCH: '4.0'
9+
10+
concurrency:
11+
group: ci-${{github.actor}}-${{github.head_ref || github.run_number}}-${{github.ref}}-cpp-tests
12+
cancel-in-progress: true
13+
14+
jobs:
15+
godot-cpp-tests:
16+
runs-on: "ubuntu-20.04"
17+
name: "Build and test Godot CPP"
18+
steps:
19+
- uses: actions/checkout@v3
20+
21+
- name: Setup python and scons
22+
uses: ./.github/actions/godot-deps
23+
24+
# Checkout godot-cpp
25+
- name: Checkout godot-cpp
26+
uses: actions/checkout@v3
27+
with:
28+
repository: godotengine/godot-cpp
29+
ref: ${{ env.GODOT_BASE_BRANCH }}
30+
submodules: 'recursive'
31+
path: 'godot-cpp'
32+
33+
# Download generated API dump
34+
- name: Download GDExtension interface and API dump
35+
uses: ./.github/actions/download-artifact
36+
with:
37+
name: 'godot-api-dump'
38+
path: './godot-api'
39+
40+
# Extract and override existing files with generated files
41+
- name: Extract GDExtension interface and API dump
42+
run: |
43+
cp -f godot-api/gdextension_interface.h godot-cpp/gdextension/
44+
cp -f godot-api/extension_api.json godot-cpp/gdextension/
45+
46+
# TODO: Add caching to the scons build and store it for CI via the godot-cache
47+
# action.
48+
49+
# Build godot-cpp test extension
50+
- name: Build godot-cpp test extension
51+
run: |
52+
cd godot-cpp/test
53+
scons target=template_debug dev_build=yes
54+
cd ../..

.github/workflows/linux_builds.yml

Lines changed: 37 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44

55
# Global Settings
66
env:
7-
# Used for the cache key, and godot-cpp checkout. Add version suffix to force clean build.
7+
# Used for the cache key. Add version suffix to force clean build.
88
GODOT_BASE_BRANCH: '4.0'
99
SCONSFLAGS: verbose=yes warnings=extra werror=yes module_text_server_fb_enabled=yes
1010
DOTNET_NOLOGO: true
@@ -25,52 +25,51 @@ jobs:
2525
- name: Editor w/ Mono (target=editor)
2626
cache-name: linux-editor-mono
2727
target: editor
28-
tests: false # Disabled due freeze caused by mix Mono build and CI
2928
sconsflags: module_mono_enabled=yes
30-
doc-test: true
3129
bin: "./bin/godot.linuxbsd.editor.x86_64.mono"
3230
build-mono: true
31+
tests: false # Disabled due freeze caused by mix Mono build and CI
32+
doc-test: true
3333
proj-conv: true
3434
artifact: true
3535

3636
- name: Editor with doubles and GCC sanitizers (target=editor, tests=yes, dev_build=yes, precision=double, use_asan=yes, use_ubsan=yes, linker=gold)
3737
cache-name: linux-editor-double-sanitizers
3838
target: editor
39-
tests: true
4039
# Debug symbols disabled as they're huge on this build and we hit the 14 GB limit for runners.
4140
sconsflags: dev_build=yes debug_symbols=no precision=double use_asan=yes use_ubsan=yes linker=gold
42-
proj-test: true
43-
# Can be turned off for PRs that intentionally break compat with godot-cpp,
44-
# until both the upstream PR and the matching godot-cpp changes are merged.
45-
godot-cpp-test: true
4641
bin: "./bin/godot.linuxbsd.editor.dev.double.x86_64.san"
4742
build-mono: false
43+
tests: true
44+
proj-test: true
45+
# Generate an API dump for godot-cpp tests.
46+
api-dump: true
4847
# Skip 2GiB artifact speeding up action.
4948
artifact: false
5049

5150
- name: Editor with clang sanitizers (target=editor, tests=yes, dev_build=yes, use_asan=yes, use_ubsan=yes, use_llvm=yes, linker=lld)
5251
cache-name: linux-editor-llvm-sanitizers
5352
target: editor
54-
tests: true
5553
sconsflags: dev_build=yes use_asan=yes use_ubsan=yes use_llvm=yes linker=lld
5654
bin: "./bin/godot.linuxbsd.editor.dev.x86_64.llvm.san"
5755
build-mono: false
56+
tests: true
5857
# Skip 2GiB artifact speeding up action.
5958
artifact: false
6059

6160
- name: Template w/ Mono (target=template_release)
6261
cache-name: linux-template-mono
6362
target: template_release
64-
tests: false
6563
sconsflags: module_mono_enabled=yes
6664
build-mono: false
65+
tests: false
6766
artifact: true
6867

6968
- name: Minimal template (target=template_release, everything disabled)
7069
cache-name: linux-template-minimal
7170
target: template_release
72-
tests: false
7371
sconsflags: modules_enabled_by_default=no disable_3d=yes disable_advanced_gui=yes deprecated=no minizip=no
72+
tests: false
7473
artifact: true
7574

7675
steps:
@@ -126,6 +125,24 @@ jobs:
126125
run: |
127126
./modules/mono/build_scripts/build_assemblies.py --godot-output-dir=./bin --godot-platform=linuxbsd
128127
128+
- name: Prepare artifact
129+
if: ${{ matrix.artifact }}
130+
run: |
131+
strip bin/godot.*
132+
chmod +x bin/godot.*
133+
134+
- name: Upload artifact
135+
uses: ./.github/actions/upload-artifact
136+
if: ${{ matrix.artifact }}
137+
with:
138+
name: ${{ matrix.cache-name }}
139+
140+
- name: Dump Godot API
141+
uses: ./.github/actions/godot-api-dump
142+
if: ${{ matrix.api-dump }}
143+
with:
144+
bin: ${{ matrix.bin }}
145+
129146
# Execute unit tests for the editor
130147
- name: Unit tests
131148
if: ${{ matrix.tests }}
@@ -143,79 +160,16 @@ jobs:
143160
${{ matrix.bin }} --doctool --headless 2>&1 > /dev/null || true
144161
git diff --color --exit-code && ! git ls-files --others --exclude-standard | sed -e 's/^/New doc file missing in PR: /' | grep 'xml$'
145162
146-
# Test 3.x -> 4.x project converter
147-
- name: Test project converter
148-
if: ${{ matrix.proj-conv }}
149-
run: |
150-
mkdir converter_test
151-
cd converter_test
152-
touch project.godot
153-
../${{ matrix.bin }} --headless --validate-conversion-3to4
154-
cd ..
155-
rm converter_test -rf
156-
157-
# Download and extract zip archive with project, folder is renamed to be able to easy change used project
158-
- name: Download test project
159-
if: ${{ matrix.proj-test }}
160-
run: |
161-
wget https://github.com/godotengine/regression-test-project/archive/4.0.zip
162-
unzip 4.0.zip
163-
mv "regression-test-project-4.0" "test_project"
164-
165-
# Editor is quite complicated piece of software, so it is easy to introduce bug here
166-
- name: Open and close editor (Vulkan)
167-
if: ${{ matrix.proj-test }}
168-
run: |
169-
xvfb-run ${{ matrix.bin }} --audio-driver Dummy --editor --quit --path test_project 2>&1 | tee sanitizers_log.txt || true
170-
misc/scripts/check_ci_log.py sanitizers_log.txt
171-
172-
- name: Open and close editor (GLES3)
173-
if: ${{ matrix.proj-test }}
174-
run: |
175-
DRI_PRIME=0 xvfb-run ${{ matrix.bin }} --audio-driver Dummy --rendering-driver opengl3 --editor --quit --path test_project 2>&1 | tee sanitizers_log.txt || true
176-
misc/scripts/check_ci_log.py sanitizers_log.txt
177-
178-
# Run test project
179-
- name: Run project
163+
# Download and run the test project
164+
- name: Test Godot project
165+
uses: ./.github/actions/godot-project-test
180166
if: ${{ matrix.proj-test }}
181-
run: |
182-
xvfb-run ${{ matrix.bin }} 40 --audio-driver Dummy --path test_project 2>&1 | tee sanitizers_log.txt || true
183-
misc/scripts/check_ci_log.py sanitizers_log.txt
184-
185-
# Checkout godot-cpp
186-
- name: Checkout godot-cpp
187-
if: ${{ matrix.godot-cpp-test }}
188-
uses: actions/checkout@v3
189167
with:
190-
repository: godotengine/godot-cpp
191-
ref: ${{ env.GODOT_BASE_BRANCH }}
192-
submodules: 'recursive'
193-
path: 'godot-cpp'
194-
195-
# Dump GDExtension interface and API
196-
- name: Dump GDExtension interface and API for godot-cpp build
197-
if: ${{ matrix.godot-cpp-test }}
198-
run: |
199-
${{ matrix.bin }} --headless --dump-gdextension-interface --dump-extension-api
200-
cp -f gdextension_interface.h godot-cpp/gdextension/
201-
cp -f extension_api.json godot-cpp/gdextension/
168+
bin: ${{ matrix.bin }}
202169

203-
# Build godot-cpp test extension
204-
- name: Build godot-cpp test extension
205-
if: ${{ matrix.godot-cpp-test }}
206-
run: |
207-
cd godot-cpp/test
208-
scons target=template_debug dev_build=yes
209-
cd ../..
210-
211-
- name: Prepare artifact
212-
if: ${{ matrix.artifact }}
213-
run: |
214-
strip bin/godot.*
215-
chmod +x bin/godot.*
216-
217-
- name: Upload artifact
218-
uses: ./.github/actions/upload-artifact
219-
if: ${{ matrix.artifact }}
170+
# Test the project converter
171+
- name: Test project converter
172+
uses: ./.github/actions/godot-converter-test
173+
if: ${{ matrix.proj-conv }}
220174
with:
221-
name: ${{ matrix.cache-name }}
175+
bin: ${{ matrix.bin }}

.github/workflows/macos_builds.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,6 @@ jobs:
5656
target: ${{ matrix.target }}
5757
tests: ${{ matrix.tests }}
5858

59-
# Execute unit tests for the editor
60-
- name: Unit tests
61-
if: ${{ matrix.tests }}
62-
run: |
63-
${{ matrix.bin }} --version
64-
${{ matrix.bin }} --help
65-
${{ matrix.bin }} --test
66-
6759
- name: Prepare artifact
6860
run: |
6961
strip bin/godot.*
@@ -73,3 +65,11 @@ jobs:
7365
uses: ./.github/actions/upload-artifact
7466
with:
7567
name: ${{ matrix.cache-name }}
68+
69+
# Execute unit tests for the editor
70+
- name: Unit tests
71+
if: ${{ matrix.tests }}
72+
run: |
73+
${{ matrix.bin }} --version
74+
${{ matrix.bin }} --help
75+
${{ matrix.bin }} --test

0 commit comments

Comments
 (0)