-
Notifications
You must be signed in to change notification settings - Fork 2
192 lines (164 loc) · 7.71 KB
/
compile-godot-stable.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
# Compile Godot 4
# See also: https://docs.godotengine.org/en/latest/development/compiling/compiling_for_linuxbsd.html
name: Godot stable builds
#env:
on:
workflow_dispatch: # manual trigger
push:
defaults:
run:
shell: bash
env:
GODOT_VERSION: '4.1.1'
# 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:
compile-godot:
# For runners, see https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners
runs-on: ${{ matrix.runner }}
name: ${{ matrix.id }}-stable
# Some scons flags, from detect.py
# * EnumVariable("linker", "Linker program", "default", ("default", "bfd", "gold", "lld", "mold")),
# * BoolVariable("use_llvm", "Use the LLVM compiler", False),
# * BoolVariable("use_ubsan", "Use LLVM/GCC compiler undefined behavior sanitizer (UBSAN)", False),
# * BoolVariable("use_asan", "Use LLVM/GCC compiler address sanitizer (ASAN)", False),
# * BoolVariable("use_lsan", "Use LLVM/GCC compiler leak sanitizer (LSAN)", False),
# * BoolVariable("use_tsan", "Use LLVM/GCC compiler thread sanitizer (TSAN)", False),
# * BoolVariable("use_msan", "Use LLVM compiler memory sanitizer (MSAN)", False),
#
# Some sanitizers are incompatible: msan/asan, lsan/tsan, asan/tsan
strategy:
fail-fast: false
matrix:
include:
- id: linux
os: linux
runner: ubuntu-20.04
cmd:
install-scons: pip install scons==3.1.2
scons-platform: linuxbsd
# cores: nproc
- id: linux-memcheck-clang
os: linux
runner: ubuntu-20.04
cmd:
install-scons: pip install scons==3.1.2
scons-platform: linuxbsd
scons-extra-args: use_asan=yes use_ubsan=yes use_lsan=yes use_llvm=yes linker=lld
binary-postfix: .llvm.san
# https://github.com/godotengine/godot/blob/master/.github/workflows/linux_builds.yml
# - id: linux-memcheck-gcc
# os: linux
# runner: ubuntu-20.04
# cmd:
# install-scons: pip install scons==3.1.2
# scons-platform: linuxbsd
# scons-extra-args: use_asan=yes use_ubsan=yes use_lsan=yes linker=gold
# binary-postfix: .san
- id: macos
os: macos
runner: macos-latest
cmd:
install-scons: brew install scons
scons-platform: macos
- id: windows
os: windows
runner: windows-2019
cmd:
install-scons: pip install scons==3.1.2
scons-platform: windows
steps:
- name: "Clone Godot"
# Note: GODOT_BIN file does not yet exist, but the path can already be stored
run: |
git clone https://github.com/godotengine/godot.git --depth 1 --branch "$GODOT_VERSION-stable" .
echo "SHA=`git rev-parse HEAD`" >> $GITHUB_ENV
echo "SHORT_SHA=`git rev-parse --short HEAD`" >> $GITHUB_ENV
echo "GODOT_BIN=bin/godot.${{ matrix.cmd.scons-platform }}.editor.dev.x86_64${{ matrix.cmd.binary-postfix }}" >> $GITHUB_ENV
- name: "Check cache for Godot version ${{ env.SHORT_SHA }}"
id: cache-godot
uses: actions/cache@v3
with:
path: bin #${{ runner.temp }}/godot_bin
key: godot-${{ matrix.id }}-${{ env.SHA }}
- name: "Checkout this repo"
uses: actions/checkout@v3
with:
path: 'repo'
clean: 'false'
# LeakSanitizer cannot know symbols for unloaded dynamic libraries (like the GDExtension Rust one).
# Not only will it lose the stacktrace, but it also reports a 1024-byte leak for println!.
# Leaving the dynamic library open by not calling dlclose() works around that.
# See https://github.com/google/sanitizers/issues/89, which is not solved despite closed.
- name: "Apply no-dlclose patch for memcheck version"
run: |
git apply --verbose repo/res/no-dlclose-4.0.patch
echo "Difference:"
git diff
echo "Occurrence of close:"
cat ./drivers/unix/os_unix.cpp | grep close_dynamic_library -B 3 -A 10
if: ${{ contains(matrix.id, 'memcheck') }}
- name: "Install scons"
if: steps.cache-godot.outputs.cache-hit != 'true'
run: |
${{ matrix.cmd.install-scons }}
scons --version
- name: "[Linux] C dependencies"
if: steps.cache-godot.outputs.cache-hit != 'true' && matrix.os == 'linux'
run: |
sudo apt-get update
# The actual dependencies
sudo apt-get install build-essential pkg-config libx11-dev libxcursor-dev \
libxinerama-dev libgl1-mesa-dev libglu-dev libasound2-dev libpulse-dev \
libdbus-1-dev libudev-dev libxi-dev libxrandr-dev yasm xvfb wget unzip \
llvm libspeechd-dev speech-dispatcher fontconfig libfontconfig-dev
- name: "[macOS] - MoltenVK Vulkan library"
if: steps.cache-godot.outputs.cache-hit != 'true' && matrix.os == 'macos'
run: |
sh misc/scripts/install_vulkan_sdk_macos.sh
- name: "[Linux|macOS] Compile Godot..."
if: steps.cache-godot.outputs.cache-hit != 'true' && matrix.os != 'windows'
run: |
#echo "Number of cores: $(${{ matrix.cmd.cores }})"
scons platform=${{ matrix.cmd.scons-platform }} target=editor dev_build=yes ${{ matrix.cmd.scons-extra-args }}
- name: "[Linux|macOS] Make executable"
if: steps.cache-godot.outputs.cache-hit != 'true' && matrix.os != 'windows'
run: |
ls -la bin
chmod +x $GODOT_BIN
- name: "[Windows] - MSVC developer console"
if: steps.cache-godot.outputs.cache-hit != 'true' && matrix.os == 'windows'
uses: ilammy/msvc-dev-cmd@v1
# /FS: platform\windows\crash_handler_windows.cpp: fatal error C1041: cannot open program database
- name: "[Windows] Compile Godot..."
id: compile
if: steps.cache-godot.outputs.cache-hit != 'true' && matrix.os == 'windows'
continue-on-error: true
run: |
cl
scons platform=${{ matrix.cmd.scons-platform }} target=editor dev_build=yes mingw=no ${{ matrix.cmd.scons-extra-args }}
shell: cmd
# Workaround for the following error that often happens. /FS did not help.
# 'D:\a\godot4-nightly\godot4-nightly\vc140.pdb'; if multiple CL.EXE write to the same .PDB file, please use /FS
- name: "[Windows] Compile Godot with -j1 if previous failed..."
if: matrix.os == 'windows' && steps.compile.outcome == 'failure'
run: |
cl
scons -j1 platform=${{ matrix.cmd.scons-platform }} target=editor dev_build=yes mingw=no ${{ matrix.cmd.scons-extra-args }}
shell: cmd
# Upload artifact also when cached (so last successful workflow always has artifact)
- name: "Upload artifact"
uses: actions/upload-artifact@v3
with:
name: godot-${{ matrix.id }}-stable
path: bin
- name: "Summary"
# xargs has the nice side effect of trimming leading/trailing whitespace, see https://stackoverflow.com/a/12973694
# The other answers, while more "idiomatic" (if that can even be said for something like bash), are not properly handling newlines
run: |
ls -la bin
godotVer=$($GODOT_BIN --version | xargs)
echo "## Godot version: \`$godotVer\`" >> $GITHUB_STEP_SUMMARY
echo "Built for **${{ matrix.id }}** from commit [\`$SHA\`](https://github.com/godotengine/godot/commit/$SHA)." >> $GITHUB_STEP_SUMMARY