Skip to content

Commit 0e8e118

Browse files
committed
CI: outsource Godot test to its own composite action
1 parent 1e907a2 commit 0e8e118

File tree

5 files changed

+135
-117
lines changed

5 files changed

+135
-117
lines changed

.github/composite/godot/action.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: godot
2+
description: "Run Godot integration tests"
3+
4+
inputs:
5+
godot_ver:
6+
required: true
7+
description: "Godot version (e.g. '3.2')"
8+
9+
rust_toolchain:
10+
required: false
11+
default: 'stable'
12+
description: "Rust toolchain specifier (e.g. 'nightly')"
13+
14+
rust_extra_args:
15+
required: false
16+
default: ''
17+
description: "Extra command line arguments for 'cargo build', e.g. features"
18+
19+
20+
runs:
21+
using: "composite"
22+
steps:
23+
- uses: actions/checkout@v2
24+
- name: Install Rust
25+
uses: ./.github/composite/rust
26+
with:
27+
rust: ${{ inputs.rust_toolchain }}
28+
- name: "Check cache for installed Godot version"
29+
id: "cache-godot"
30+
uses: actions/cache@v2
31+
with:
32+
path: ${{ runner.temp }}/godot_bin
33+
key: godot-${{ runner.os }}-v${{ inputs.godot_ver }}
34+
- name: "Install Godot"
35+
if: steps.cache-godot.outputs.cache-hit != 'true'
36+
run: |
37+
wget --no-verbose "https://downloads.tuxfamily.org/godotengine/${{ inputs.godot_ver }}/Godot_v${{ inputs.godot_ver }}-stable_linux_headless.64.zip" -O /tmp/godot.zip
38+
unzip -o /tmp/godot.zip -d ${{ runner.temp }}/godot_bin
39+
shell: bash
40+
- name: "Set environment variable"
41+
run: |
42+
echo "GODOT_BIN=${{ runner.temp }}/godot_bin/Godot_v${{ inputs.godot_ver }}-stable_linux_headless.64" >> $GITHUB_ENV
43+
shell: bash
44+
- name: "Build godot-rust"
45+
run: |
46+
echo "File size of api.json -- before:"
47+
stat -c %s gdnative-bindings/api.json
48+
49+
#echo "CRC32 of api.json: "
50+
#crc32 gdnative-bindings/api.json
51+
cd test
52+
cargo build ${{ inputs.rust_extra_args }}
53+
54+
cd ..
55+
echo "File size of api.json -- after:"
56+
stat -c %s gdnative-bindings/api.json
57+
shell: bash
58+
- name: "Run Godot integration tests"
59+
run: |
60+
cd test;
61+
mkdir -p ./project/lib;
62+
cp ../target/debug/libgdnative_test.so ./project/lib/;
63+
${GODOT_BIN} --path ./project/ > >(tee "${{ runner.temp }}/stdout.log");
64+
if grep -q "Leaked instance" "${{ runner.temp }}/stdout.log"; then
65+
exit 1;
66+
fi;
67+
${GODOT_BIN} -e --path ./project/ --run-editor-tests > >(tee "${{ runner.temp }}/stdout.log");
68+
if grep -q "Leaked instance" "${{ runner.temp }}/stdout.log"; then
69+
exit 1;
70+
fi;
71+
cargo build --features=type_tag_fallback;
72+
mkdir -p ./project/lib;
73+
cp ../target/debug/libgdnative_test.so ./project/lib/;
74+
${GODOT_BIN} --path ./project/ > >(tee "${{ runner.temp }}/stdout.log");
75+
if grep -q "Leaked instance" "${{ runner.temp }}/stdout.log"; then
76+
exit 1;
77+
fi;
78+
${GODOT_BIN} -e --path ./project/ --run-editor-tests > >(tee "${{ runner.temp }}/stdout.log");
79+
if grep -q "Leaked instance" "${{ runner.temp }}/stdout.log"; then
80+
exit 1;
81+
fi;
82+
shell: bash

.github/workflows/full-ci.yml

Lines changed: 38 additions & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ env:
3232

3333
# Local variables
3434
# Note: using variables is limited at the moment, see https://github.com/actions/runner/issues/480
35-
GODOT_VER: "3.4"
36-
GODOT_REL: stable
3735
GDRUST_FEATURES: "gdnative/async,gdnative/serde"
3836

3937
on:
@@ -51,11 +49,11 @@ jobs:
5149
runs-on: ubuntu-latest
5250
steps:
5351
- uses: actions/checkout@v2
54-
- name: Install Rust
52+
- name: "Install Rust"
5553
uses: ./.github/composite/rust
5654
with:
5755
components: rustfmt
58-
- name: Check rustfmt
56+
- name: "Check rustfmt"
5957
run: cargo fmt --all -- --check;
6058

6159
clippy:
@@ -72,12 +70,12 @@ jobs:
7270
postfix: ' (nightly)'
7371
steps:
7472
- uses: actions/checkout@v2
75-
- name: Install Rust
73+
- name: "Install Rust"
7674
uses: ./.github/composite/rust
7775
with:
7876
rust: ${{ matrix.rust.toolchain }}
7977
components: clippy
80-
- name: Check clippy
78+
- name: "Check clippy"
8179
run: cargo clippy --workspace --features ${GDRUST_FEATURES} -- -D clippy::style -D clippy::complexity -D clippy::perf -D clippy::dbg_macro -D clippy::todo -D clippy::unimplemented;
8280

8381
test:
@@ -112,16 +110,16 @@ jobs:
112110
runs-on: ${{ matrix.os.id }}
113111
steps:
114112
- uses: actions/checkout@v2
115-
- name: Install Rust
113+
- name: "Install Rust"
116114
uses: ./.github/composite/rust
117115
with:
118116
rust: ${{ matrix.rust.toolchain }}
119-
- name: Install LLVM
117+
- name: "Install LLVM"
120118
uses: ./.github/composite/llvm
121119
if: ${{ matrix.os.id == 'windows-latest' }}
122-
- name: Compile tests
120+
- name: "Compile tests"
123121
run: cargo test --workspace --features ${GDRUST_FEATURES} --no-run;
124-
- name: Test
122+
- name: "Test"
125123
run: cargo test --workspace --features ${GDRUST_FEATURES} ${{ matrix.testflags }};
126124

127125
build-release:
@@ -140,14 +138,14 @@ jobs:
140138
runs-on: ${{ matrix.os.id }}
141139
steps:
142140
- uses: actions/checkout@v2
143-
- name: Install Rust
141+
- name: "Install Rust"
144142
uses: ./.github/composite/rust
145143
with:
146144
rust: stable
147-
- name: Install LLVM
145+
- name: "Install LLVM"
148146
uses: ./.github/composite/llvm
149147
if: ${{ matrix.os.id == 'windows-latest' }}
150-
- name: Release build (check only)
148+
- name: "Release build (check only)"
151149
run: cargo check --release;
152150

153151
build-ios:
@@ -159,18 +157,18 @@ jobs:
159157
runs-on: macos-latest
160158
steps:
161159
- uses: actions/checkout@v2
162-
- name: Install Rust
160+
- name: "Install Rust"
163161
uses: ./.github/composite/rust
164162
#with:
165163
# rust: ${{ matrix.rust.toolchain }}
166-
- name: Install cargo-dinghy
164+
- name: "Install cargo-dinghy"
167165
run: |
168166
rustup target add x86_64-apple-ios;
169167
curl -L https://github.com/sonos/dinghy/releases/download/0.4.62/cargo-dinghy-macos-0.4.62.tgz -o cargo-dinghy-macos.tar.gz;
170168
tar -zxvf cargo-dinghy-macos.tar.gz;
171169
mkdir -p $HOME/.cargo/bin;
172170
cp cargo-dinghy-0.4.62/cargo-dinghy $HOME/.cargo/bin;
173-
- name: Cross-compile to iOS
171+
- name: "Cross-compile to iOS"
174172
run: |
175173
RUNTIME_ID=$(xcrun simctl list runtimes | grep iOS | cut -d ' ' -f 7 | tail -1);
176174
export SIM_ID=$(xcrun simctl create My-iphone11 com.apple.CoreSimulator.SimDeviceType.iPhone-11 $RUNTIME_ID);
@@ -191,11 +189,11 @@ jobs:
191189
runs-on: ubuntu-latest
192190
steps:
193191
- uses: actions/checkout@v2
194-
- name: Install Rust
192+
- name: "Install Rust"
195193
uses: ./.github/composite/rust
196194
#with:
197195
# rust: ${{ matrix.rust.toolchain }}
198-
- name: Install Java + NDK
196+
- name: "Install Java + NDK"
199197
run: |
200198
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64;
201199
export ANDROID_SDK_ROOT=/opt/ndk/android-ndk-r21d;
@@ -228,65 +226,38 @@ jobs:
228226
cargo build --target armv7-linux-androideabi --release;
229227
230228
integration-test-godot:
231-
name: itest-godot${{ matrix.rust.postfix }}
229+
name: itest-godot-${{ matrix.godot }}${{ matrix.postfix }}
232230
needs: rustfmt
233231
continue-on-error: ${{ matrix.rust.toolchain == 'nightly' }}
234232
strategy:
233+
fail-fast: false # cancel all jobs as soon as one fails?
235234
matrix:
236-
rust:
237-
- toolchain: stable
235+
include:
236+
- rust: stable
237+
godot: "3.4.1"
238238
postfix: ''
239-
- toolchain: nightly
239+
- rust: nightly
240+
godot: "3.4.1"
240241
postfix: ' (nightly)'
241-
- toolchain: '1.48'
242+
- rust: '1.48'
243+
godot: "3.4.1"
242244
postfix: ' (msrv 1.48)'
245+
- rust: stable
246+
godot: "3.2"
247+
postfix: ''
248+
build_args: '--features custom-godot'
249+
243250
runs-on: ubuntu-latest
244251
steps:
245252
- uses: actions/checkout@v2
246-
- name: Install Rust
247-
uses: ./.github/composite/rust
253+
- name: "Run Godot integration test"
254+
uses: ./.github/composite/godot
248255
with:
249-
rust: ${{ matrix.rust.toolchain }}
250-
- name: Check cache for installed Godot version
251-
id: cache-godot
252-
uses: actions/cache@v2
253-
with:
254-
path: ${{ runner.temp }}/godot_bin
255-
key: godot-${{ runner.os }}-v${{ env.GODOT_VER }}-${{ env.GODOT_REL }}
256-
- name: Install Godot
257-
if: steps.cache-godot.outputs.cache-hit != 'true'
258-
run: |
259-
wget "https://downloads.tuxfamily.org/godotengine/$GODOT_VER/Godot_v${GODOT_VER}-${GODOT_REL}_linux_headless.64.zip" -O /tmp/godot.zip
260-
unzip /tmp/godot.zip -d ${{ runner.temp }}/godot_bin
261-
- name: Build godot-rust
262-
run: |
263-
cd test;
264-
cargo build;
265-
- name: Run Godot integration tests
266-
run: |
267-
cd test;
268-
mkdir -p ./project/lib;
269-
cp ../target/debug/libgdnative_test.so ./project/lib/;
270-
"${{ runner.temp }}/godot_bin/Godot_v${GODOT_VER}-${GODOT_REL}_linux_headless.64" --path ./project/ > >(tee "${{ runner.temp }}/stdout.log");
271-
if grep -q "Leaked instance" "${{ runner.temp }}/stdout.log"; then
272-
exit 1;
273-
fi;
274-
"${{ runner.temp }}/godot_bin/Godot_v${GODOT_VER}-${GODOT_REL}_linux_headless.64" -e --path ./project/ --run-editor-tests > >(tee "${{ runner.temp }}/stdout.log");
275-
if grep -q "Leaked instance" "${{ runner.temp }}/stdout.log"; then
276-
exit 1;
277-
fi;
278-
cargo build --features=type_tag_fallback;
279-
mkdir -p ./project/lib;
280-
cp ../target/debug/libgdnative_test.so ./project/lib/;
281-
"${{ runner.temp }}/godot_bin/Godot_v${GODOT_VER}-${GODOT_REL}_linux_headless.64" --path ./project/ > >(tee "${{ runner.temp }}/stdout.log");
282-
if grep -q "Leaked instance" "${{ runner.temp }}/stdout.log"; then
283-
exit 1;
284-
fi;
285-
"${{ runner.temp }}/godot_bin/Godot_v${GODOT_VER}-${GODOT_REL}_linux_headless.64" -e --path ./project/ --run-editor-tests > >(tee "${{ runner.temp }}/stdout.log");
286-
if grep -q "Leaked instance" "${{ runner.temp }}/stdout.log"; then
287-
exit 1;
288-
fi;
289-
256+
rust_toolchain: ${{ matrix.rust }}
257+
rust_extra_args: ${{ matrix.build_args }}
258+
godot_ver: ${{ matrix.godot }}
259+
260+
290261
# This job doesn't actually test anything, but is used to tell bors that the build completed,
291262
# as there is no practical way to detect when a workflow is successful, listening to webhooks only.
292263
# The ID (not name) of this job is the one referenced in bors.toml.
@@ -304,5 +275,5 @@ jobs:
304275
- build-android
305276
runs-on: ubuntu-latest
306277
steps:
307-
- name: Mark the job as a success
278+
- name: "Mark the job as a success"
308279
run: exit 0

.github/workflows/minimal-ci.yml

Lines changed: 11 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ env:
1212

1313
# Local variables
1414
# Note: using variables is limited at the moment, see https://github.com/actions/runner/issues/480
15-
GODOT_VER: "3.4"
16-
GODOT_REL: stable
15+
GODOT_VER: "3.4.1"
1716
GDRUST_FEATURES: "gdnative/async,gdnative/serde"
1817

1918
on:
@@ -35,84 +34,46 @@ jobs:
3534
runs-on: ubuntu-latest
3635
steps:
3736
- uses: actions/checkout@v2
38-
- name: Install Rust
37+
- name: "Install Rust"
3938
uses: ./.github/composite/rust
4039
with:
4140
rust: stable
4241
components: rustfmt
43-
- name: Check rustfmt
42+
- name: "Check rustfmt"
4443
run: cargo fmt --all -- --check;
4544

4645
clippy:
4746
runs-on: ubuntu-latest
4847
continue-on-error: ${{ matrix.rust == 'nightly' }}
4948
steps:
5049
- uses: actions/checkout@v2
51-
- name: Install Rust
50+
- name: "Install Rust"
5251
uses: ./.github/composite/rust
5352
with:
5453
rust: stable
5554
components: clippy
56-
- name: Check clippy
55+
- name: "Check clippy"
5756
run: cargo clippy --workspace --features ${GDRUST_FEATURES} -- -D clippy::style -D clippy::complexity -D clippy::perf -D clippy::dbg_macro -D clippy::todo -D clippy::unimplemented;
5857

5958
unit-test:
6059
runs-on: ubuntu-latest
6160
steps:
6261
- uses: actions/checkout@v2
63-
- name: Install Rust
62+
- name: "Install Rust"
6463
uses: ./.github/composite/rust
65-
- name: Compile tests
64+
- name: "Compile tests"
6665
run: cargo test --workspace --features ${GDRUST_FEATURES} --no-run;
67-
- name: Test
66+
- name: "Test"
6867
run: cargo test --workspace --features ${GDRUST_FEATURES};
6968

7069
integration-test-godot:
7170
runs-on: ubuntu-latest
7271
steps:
7372
- uses: actions/checkout@v2
74-
- name: Install Rust
75-
uses: ./.github/composite/rust
76-
- name: Check cache for installed Godot version
77-
id: cache-godot
78-
uses: actions/cache@v2
73+
- name: "Run Godot integration test"
74+
uses: ./.github/composite/godot
7975
with:
80-
path: ${{ runner.temp }}/godot_bin
81-
key: godot-${{ runner.os }}-v${{ env.GODOT_VER }}-${{ env.GODOT_REL }}
82-
- name: Install Godot
83-
if: steps.cache-godot.outputs.cache-hit != 'true'
84-
run: |
85-
wget "https://downloads.tuxfamily.org/godotengine/$GODOT_VER/Godot_v${GODOT_VER}-${GODOT_REL}_linux_headless.64.zip" -O /tmp/godot.zip
86-
unzip /tmp/godot.zip -d ${{ runner.temp }}/godot_bin
87-
- name: Build godot-rust
88-
run: |
89-
cd test;
90-
cargo build;
91-
- name: Run Godot integration tests
92-
run: |
93-
cd test;
94-
mkdir -p ./project/lib;
95-
cp ../target/debug/libgdnative_test.so ./project/lib/;
96-
"${{ runner.temp }}/godot_bin/Godot_v${GODOT_VER}-${GODOT_REL}_linux_headless.64" --path ./project/ > >(tee "${{ runner.temp }}/stdout.log");
97-
if grep -q "Leaked instance" "${{ runner.temp }}/stdout.log"; then
98-
exit 1;
99-
fi;
100-
"${{ runner.temp }}/godot_bin/Godot_v${GODOT_VER}-${GODOT_REL}_linux_headless.64" -e --path ./project/ --run-editor-tests > >(tee "${{ runner.temp }}/stdout.log");
101-
if grep -q "Leaked instance" "${{ runner.temp }}/stdout.log"; then
102-
exit 1;
103-
fi;
104-
cargo build --features=type_tag_fallback;
105-
mkdir -p ./project/lib;
106-
cp ../target/debug/libgdnative_test.so ./project/lib/;
107-
"${{ runner.temp }}/godot_bin/Godot_v${GODOT_VER}-${GODOT_REL}_linux_headless.64" --path ./project/ > >(tee "${{ runner.temp }}/stdout.log");
108-
if grep -q "Leaked instance" "${{ runner.temp }}/stdout.log"; then
109-
exit 1;
110-
fi;
111-
"${{ runner.temp }}/godot_bin/Godot_v${GODOT_VER}-${GODOT_REL}_linux_headless.64" -e --path ./project/ --run-editor-tests > >(tee "${{ runner.temp }}/stdout.log");
112-
if grep -q "Leaked instance" "${{ runner.temp }}/stdout.log"; then
113-
exit 1;
114-
fi;
115-
76+
godot_ver: ${{ env.GODOT_VER }}
11677

11778
# Not really needed, since bors is not involved. Just needs an extra runner and makes the tests run longer.
11879

0 commit comments

Comments
 (0)