-
-
Notifications
You must be signed in to change notification settings - Fork 198
312 lines (256 loc) · 11.5 KB
/
full-ci.yml
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
name: Full CI
#
# Runs before merging. Rebases on master to make sure CI passes for latest integration, not only for the PR at the time of creation.
on:
merge_group:
push:
env:
GDEXT_FEATURES: ''
RETRY: ${{ github.workspace }}/.github/other/retry.sh
# LSan options: https://github.com/google/sanitizers/wiki/AddressSanitizerLeakSanitizer
# * report_objects: list individual leaked objects when running LeakSanitizer
LSAN_OPTIONS: report_objects=1
# ASan options: https://github.com/google/sanitizers/wiki/AddressSanitizerFlags
defaults:
run:
shell: bash
# If a new commit is pushed before the old one's CI has completed (on the same branch), abort previous run
#concurrency:
# group: ${{ github.head_ref }}
# cancel-in-progress: true
jobs:
rustfmt:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: "Install Rust"
uses: ./.github/composite/rust
with:
components: rustfmt
- name: "Check rustfmt"
run: cargo fmt --all -- --check
clippy:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: "Install Rust"
uses: ./.github/composite/rust
with:
components: clippy
- name: "Check clippy"
run: |
cargo clippy --all-targets $GDEXT_FEATURES ${{ matrix.rust-extra-args }} -- \
-D clippy::suspicious -D clippy::style -D clippy::complexity -D clippy::perf \
-D clippy::dbg_macro -D clippy::todo -D clippy::unimplemented -D warnings
unit-test:
name: unit-test (${{ matrix.name }}${{ matrix.rust-special }})
runs-on: ${{ matrix.os }}
continue-on-error: false
strategy:
fail-fast: false # cancel all jobs as soon as one fails?
matrix:
# Order this way because macOS typically has the longest duration, followed by Windows, so it benefits total workflow execution time.
# Additionally, the 'linux (msrv *)' special case will then be listed next to the other 'linux' jobs.
# Note: Windows uses '--target x86_64-pc-windows-msvc' by default as Cargo argument.
include:
- name: macos
os: macos-11
- name: windows
os: windows-latest
# Don't use latest Ubuntu (22.04) as it breaks lots of ecosystem compatibility.
# If ever moving to ubuntu-latest, need to manually install libtinfo5 for LLVM.
- name: linux
os: ubuntu-20.04
- name: linux
os: ubuntu-20.04
rust-toolchain: nightly
rust-special: -minimal-deps
rust-cache-key: minimal-deps
- name: linux
os: ubuntu-20.04
rust-toolchain: '1.66.0'
rust-special: -msrv
steps:
- uses: actions/checkout@v3
- name: "Install Rust"
uses: ./.github/composite/rust
with:
rust: ${{ matrix.rust-toolchain || 'stable' }}
cache-key: ${{ matrix.rust-cache-key }} # only needed when rustc version is possibly the same
- name: "Install minimal dependency versions from Cargo"
if: matrix.rust-special == '-minimal-deps'
run: cargo +nightly update -Z minimal-versions
- name: "Compile tests"
run: cargo test $GDEXT_FEATURES --no-run ${{ matrix.rust-extra-args }}
- name: "Test"
run: cargo test $GDEXT_FEATURES ${{ matrix.rust-extra-args }}
# For complex matrix workflow, see https://stackoverflow.com/a/65434401
godot-itest:
name: godot-itest (${{ matrix.name }})
runs-on: ${{ matrix.os }}
continue-on-error: false
timeout-minutes: 24
strategy:
fail-fast: false # cancel all jobs as soon as one fails?
matrix:
# Naming: {os}[-{runtimeVersion}]-{apiVersion}
# runtimeVersion = version of Godot binary; apiVersion = version of GDExtension API against which gdext is compiled.
# --disallow-focus: fail if #[itest(focus)] is encountered, to prevent running only a few tests for full CI
# Order this way because macOS typically has the longest duration, followed by Windows, so it benefits total workflow execution time.
# Additionally, the 'linux (msrv *)' special case will then be listed next to the other 'linux' jobs.
# Note: Windows uses '--target x86_64-pc-windows-msvc' by default as Cargo argument.
include:
# macOS
- name: macos
os: macos-12
artifact-name: macos-nightly
godot-binary: godot.macos.editor.dev.x86_64
rust-extra-args: --features godot/custom-godot
- name: macos-double
os: macos-12
artifact-name: macos-double-nightly
godot-binary: godot.macos.editor.dev.double.x86_64
rust-extra-args: --features godot/custom-godot,godot/double-precision
- name: macos-4.1
os: macos-12
artifact-name: macos-stable
godot-binary: godot.macos.editor.dev.x86_64
#godot-prebuilt-patch: '4.1'
# Windows
- name: windows
os: windows-latest
artifact-name: windows-nightly
godot-binary: godot.windows.editor.dev.x86_64.exe
rust-extra-args: --features godot/custom-godot
- name: windows-double
os: windows-latest
artifact-name: windows-double-nightly
godot-binary: godot.windows.editor.dev.double.x86_64.exe
rust-extra-args: --features godot/custom-godot,godot/double-precision
- name: windows-4.1
os: windows-latest
artifact-name: windows-stable
godot-binary: godot.windows.editor.dev.x86_64.exe
#godot-prebuilt-patch: '4.1'
# Linux
# Don't use latest Ubuntu (22.04) as it breaks lots of ecosystem compatibility.
# If ever moving to ubuntu-latest, need to manually install libtinfo5 for LLVM.
- name: linux
os: ubuntu-20.04
artifact-name: linux-nightly
godot-binary: godot.linuxbsd.editor.dev.x86_64
rust-extra-args: --features godot/custom-godot
- name: linux-double
os: ubuntu-20.04
artifact-name: linux-double-nightly
godot-binary: godot.linuxbsd.editor.dev.double.x86_64
rust-extra-args: --features godot/custom-godot,godot/double-precision
- name: linux-features
os: ubuntu-20.04
artifact-name: linux-nightly
godot-binary: godot.linuxbsd.editor.dev.x86_64
rust-extra-args: --features godot/custom-godot,godot/threads,godot/serde
# Linux compat
- name: linux-4.1
os: ubuntu-20.04
artifact-name: linux-stable
godot-binary: godot.linuxbsd.editor.dev.x86_64
#godot-prebuilt-patch: '4.1'
- name: linux-4.0.3
os: ubuntu-20.04
artifact-name: linux-4.0.3
godot-binary: godot.linuxbsd.editor.dev.x86_64
godot-prebuilt-patch: '4.0.3'
- name: linux-4.0.2
os: ubuntu-20.04
artifact-name: linux-4.0.3
godot-binary: godot.linuxbsd.editor.dev.x86_64
godot-prebuilt-patch: '4.0.2'
- name: linux-4.0.1
os: ubuntu-20.04
artifact-name: linux-4.0.3
godot-binary: godot.linuxbsd.editor.dev.x86_64
godot-prebuilt-patch: '4.0.1'
- name: linux-4.0
os: ubuntu-20.04
artifact-name: linux-4.0.3
godot-binary: godot.linuxbsd.editor.dev.x86_64
godot-prebuilt-patch: '4.0'
# Memory checks: special Godot binaries compiled with AddressSanitizer/LeakSanitizer to detect UB/leaks.
# See also https://rustc-dev-guide.rust-lang.org/sanitizers.html.
#
# Additionally, the Godot source is patched to make dlclose() a no-op, as unloading dynamic libraries loses stacktrace and
# cause false positives like println!. See https://github.com/google/sanitizers/issues/89.
#
# There is also a gcc variant besides clang, which is currently not used.
- name: linux-memcheck
os: ubuntu-20.04
artifact-name: linux-memcheck-clang-nightly
godot-binary: godot.linuxbsd.editor.dev.x86_64.llvm.san
godot-args: -- --disallow-focus
rust-toolchain: nightly
rust-env-rustflags: -Zrandomize-layout -Zsanitizer=address
rust-extra-args: --features godot/custom-godot
# Sanitizers can't build proc-macros and build scripts; with --target, cargo ignores RUSTFLAGS for those two.
rust-target: x86_64-unknown-linux-gnu
- name: linux-memcheck-4.0.3
os: ubuntu-20.04
artifact-name: linux-memcheck-clang-4.0.3
godot-binary: godot.linuxbsd.editor.dev.x86_64.llvm.san
godot-args: -- --disallow-focus
godot-prebuilt-patch: '4.0.3'
rust-toolchain: nightly
rust-env-rustflags: -Zrandomize-layout -Zsanitizer=address
# Sanitizers can't build proc-macros and build scripts; with --target, cargo ignores RUSTFLAGS for those two.
rust-target: x86_64-unknown-linux-gnu
steps:
- uses: actions/checkout@v3
- name: "Run Godot integration test"
uses: ./.github/composite/godot-itest
with:
artifact-name: godot-${{ matrix.artifact-name }}
godot-binary: ${{ matrix.godot-binary }}
godot-args: ${{ matrix.godot-args }}
godot-prebuilt-patch: ${{ matrix.godot-prebuilt-patch }}
rust-extra-args: ${{ matrix.rust-extra-args }}
rust-toolchain: ${{ matrix.rust-toolchain || 'stable' }}
rust-env-rustflags: ${{ matrix.rust-env-rustflags }}
rust-target: ${{ matrix.rust-target }}
with-llvm: ${{ contains(matrix.name, 'macos') && contains(matrix.rust-extra-args, 'custom-godot') }}
godot-check-header: ${{ matrix.godot-check-header }}
license-guard:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: "Check license headers"
uses: apache/skywalking-eyes/[email protected]
with:
# log: debug # optional: set the log level. The default value is `info`.
config: .github/other/licenserc.yml
# token: # optional: the token that license eye uses when it needs to comment on the pull request.
# Set to empty ("") to disable commenting on pull request. The default value is ${{ github.token }}
# mode: # optional: Which mode License-Eye should be run in. Choices are `check` or `fix`. The default value is `check`.
mode: check
# ---------------------------------------------------------------------------------------------------------------------------------------------
# CI status report
# Job to notify merge queue about success/failure
# 'push' is for workflows still triggered by bors
ci-status:
if: always() && (github.event_name == 'merge_group' || github.event_name == 'push')
needs:
- rustfmt
- clippy
- unit-test
- godot-itest
- license-guard
runs-on: ubuntu-20.04
steps:
- name: "Success"
if: ${{ !(contains(needs.*.result, 'failure')) }}
run: exit 0
- name: "Failure"
if: ${{ contains(needs.*.result, 'failure') }}
run: exit 1