-
-
Notifications
You must be signed in to change notification settings - Fork 73
135 lines (120 loc) · 5.06 KB
/
Copy pathtest_checks.yml
File metadata and controls
135 lines (120 loc) · 5.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
name: 🧪 Run Tests
on:
workflow_call:
env:
GODOT_VERSION: '4.7-stable'
jobs:
run-unit-tests:
name: Run Unit Tests ${{ matrix.dimensions.name }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
dimensions:
- { name: 2D, feature: single-dim2 }
- { name: 3D, feature: single-dim3 }
steps:
- uses: actions/checkout@v6
- name: Run Unit Tests
shell: bash
run: |
cargo test --all-targets --features="${{ matrix.dimensions.feature }},test,register-docs,api-4-7"
run-integration-tests:
name: Run Godot Tests ${{ matrix.dimensions.name }} (${{ matrix.os.name }})
runs-on: ${{ matrix.os.runner }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
os:
- { name: Linux, runner: ubuntu-latest }
- { name: macOS, runner: macos-26 }
- { name: Windows, runner: windows-latest }
dimensions:
- { name: 2D, short: 2d, feature: single-dim2 }
- { name: 3D, short: 3d, feature: single-dim3 }
steps:
- uses: actions/checkout@v6
- name: Setup Godot
uses: appsinacup/setup-godot-action@main
with:
version: ${{ env.GODOT_VERSION }}
- name: Build Extension
shell: bash
run: |
set -euo pipefail
cargo build --features="${{ matrix.dimensions.feature }},test,register-docs,api-4-7"
addon_dir="bin${{ matrix.dimensions.short }}/addons/godot-rapier${{ matrix.dimensions.short }}/bin"
case "$RUNNER_OS" in
Linux)
cp target/debug/libgodot_rapier.so "$addon_dir/libgodot_rapier.linux.x86_64-unknown-linux-gnu.so"
;;
macOS)
dylib="$addon_dir/libgodot_rapier.macos.framework/libgodot_rapier.macos.dylib"
cp target/debug/libgodot_rapier.dylib "$dylib"
codesign --force --sign - "$dylib"
;;
Windows)
cp target/debug/godot_rapier.dll "$addon_dir/libgodot_rapier.windows.x86_64-pc-windows-msvc.dll"
;;
*)
echo "Unsupported runner OS: $RUNNER_OS"
exit 1
;;
esac
- name: Run Godot Test Suite
shell: bash
run: |
set +e
set -o pipefail
"$GODOT4" --headless --path ./bin${{ matrix.dimensions.short }} --import 2>&1 | tee godot-import-${{ matrix.dimensions.short }}.log
import_status=${PIPESTATUS[0]}
# Godot has aborted while shutting down after a headless import on the Linux runner, long
# after the import itself finished. Importing is only a prerequisite here, so its exit
# status is reported and then dropped: an import that really failed shows up as a failing
# test run below, which is what this job gates on.
if [ "$import_status" -ne 0 ]; then
echo "::warning::Godot ${{ matrix.dimensions.name }} import exited with status ${import_status}; running the tests anyway"
fi
"$GODOT4" --headless --path ./bin${{ matrix.dimensions.short }} start.tscn 2>&1 | tee godot-tests-${{ matrix.dimensions.short }}.log
godot_status=${PIPESTATUS[0]}
set -e
if grep -q "STATUS: FAILED" godot-tests-${{ matrix.dimensions.short }}.log; then
echo "Godot ${{ matrix.dimensions.name }} tests failed"
exit 1
fi
if ! grep -q "STATUS: SUCCESS" godot-tests-${{ matrix.dimensions.short }}.log; then
echo "Godot ${{ matrix.dimensions.name }} tests did not finish successfully"
exit 1
fi
if [ "$godot_status" -ne 0 ]; then
echo "Godot exited with status ${godot_status}"
exit "$godot_status"
fi
- name: Run GDScript Unit Tests
shell: bash
run: |
set +e
set -o pipefail
"$GODOT4" --headless --path ./bin${{ matrix.dimensions.short }} --quit-after 600 test/unit/run_unit_tests.tscn 2>&1 | tee godot-unit-${{ matrix.dimensions.short }}.log
set -e
# A failed assert() either terminates the process before the SUCCESS sentinel is
# printed, or logs an "Assertion failed" error. Fail the job on either signal.
if ! grep -q "UNIT TESTS STATUS: SUCCESS" godot-unit-${{ matrix.dimensions.short }}.log; then
echo "GDScript unit tests did not complete successfully"
exit 1
fi
if grep -qi "Assertion failed" godot-unit-${{ matrix.dimensions.short }}.log; then
echo "GDScript unit tests reported a failed assertion"
exit 1
fi
- name: Upload Godot Test Log
if: always()
uses: actions/upload-artifact@v6
with:
name: godot-tests-${{ matrix.dimensions.short }}-${{ matrix.os.name }}-log
path: |
godot-import-${{ matrix.dimensions.short }}.log
godot-tests-${{ matrix.dimensions.short }}.log
godot-unit-${{ matrix.dimensions.short }}.log
if-no-files-found: warn