-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
243 lines (213 loc) · 10.1 KB
/
Copy pathlagom-template.yml
File metadata and controls
243 lines (213 loc) · 10.1 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
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
name: Lagom Template
on:
workflow_call:
inputs:
toolchain:
required: true
type: string
os_name:
required: true
type: string
runner_labels:
required: true
type: string
arch:
required: true
type: string
build_preset:
required: true
type: string
clang_plugins:
required: false
type: boolean
default: false
container:
required: false
type: string
default: 'null'
env:
# runner.workspace = /home/runner/work/ladybird
# github.workspace = /home/runner/work/ladybird/ladybird
LADYBIRD_SOURCE_DIR: ${{ github.workspace }}
CCACHE_DIR: ${{ github.workspace }}/.ccache
VCPKG_ROOT: ${{ github.workspace }}/Build/vcpkg
# Use the compiler version for the ccache compiler hash. Otherwise, if plugins are enabled, the plugin .so files
# are included in the hash. This results in clean builds on every run as the .so files are rebuilt.
#
# Note: This only works because our plugins do not transform any code. If that becomes untrue, we must revisit this.
CCACHE_COMPILERCHECK: "%compiler% -v"
jobs:
CI:
runs-on: ${{ fromJSON(inputs.runner_labels) }}
container: ${{ fromJSON(inputs.container) }}
steps:
# Pull requests can trail behind `master` and can cause breakage if merging before running the CI checks on an updated branch.
# Luckily, GitHub creates and maintains a merge branch that is updated whenever the target or source branch is modified. By
# checking this branch out, we gain a stabler `master` at the cost of reproducibility.
- uses: actions/checkout@v6.0.3
if: ${{ github.event_name != 'pull_request' }}
- uses: actions/checkout@v6.0.3
if: ${{ github.event_name == 'pull_request' }}
with:
ref: refs/pull/${{ github.event.pull_request.number }}/merge
- name: Set Up Environment
uses: ./.github/actions/setup
id: 'setup'
with:
os: ${{ inputs.os_name }}
arch: ${{ inputs.arch }}
toolchain: ${{ inputs.toolchain }}
# === PREPARE FOR BUILDING ===
- name: Assign Build Parameters
if: ${{ inputs.os_name != 'Windows' }}
id: 'build-parameters'
run: |
CMAKE_OPTIONS="-DENABLE_CI_BASELINE_CPU=ON"
if ${{ inputs.os_name == 'Linux' }} ; then
# FIXME: https://github.com/WebAssembly/wabt/issues/2533
# wabt doesn't have binary releases for arm64 Linux
if ${{ inputs.arch == 'arm64' }} ; then
PKGCONFIG=$(which pkg-config)
CMAKE_OPTIONS="$CMAKE_OPTIONS -DPKG_CONFIG_EXECUTABLE=$PKGCONFIG"
fi
if ${{ inputs.toolchain == 'Clang' }} ; then
echo "host_cc=clang" >> "$GITHUB_OUTPUT"
echo "host_cxx=clang++" >> "$GITHUB_OUTPUT"
elif ${{ inputs.toolchain == 'GNU' }} ; then
echo "host_cc=gcc" >> "$GITHUB_OUTPUT"
echo "host_cxx=g++" >> "$GITHUB_OUTPUT"
fi
elif ${{ inputs.os_name == 'macOS' }} ; then
echo "host_cc=$(xcrun --find clang)" >> "$GITHUB_OUTPUT"
echo "host_cxx=$(xcrun --find clang++)" >> "$GITHUB_OUTPUT"
fi
if ${{ inputs.os_name == 'Linux' && inputs.build_preset == 'Sanitizer' }} ; then
CMAKE_OPTIONS="$CMAKE_OPTIONS -DLADYBIRD_GUI_FRAMEWORK=Gtk"
fi
if ${{ inputs.clang_plugins }} ; then
echo "ccache_key=${{ inputs.build_preset }}-CLANG_PLUGINS" >> "$GITHUB_OUTPUT"
CMAKE_OPTIONS="$CMAKE_OPTIONS -DENABLE_CLANG_PLUGINS=ON"
else
echo "ccache_key=${{ inputs.build_preset }}" >> "$GITHUB_OUTPUT"
CMAKE_OPTIONS="$CMAKE_OPTIONS -DINCLUDE_WASM_SPEC_TESTS=ON -DWASM_SPEC_TEST_SKIP_FORMATTING=ON"
fi
echo "cmake_options=$CMAKE_OPTIONS" >> "$GITHUB_OUTPUT"
- name: Restore Caches
uses: ./.github/actions/cache-restore
id: 'cache-restore'
with:
os: ${{ inputs.os_name }}
arch: ${{ inputs.arch }}
toolchain: ${{ inputs.toolchain }}
cache_key_extra: ${{ inputs.os_name == 'Windows' && inputs.build_preset || steps.build-parameters.outputs.ccache_key }}
ccache_path: ${{ steps.setup.outputs.ccache_path }}
vcpkg_cache_path: ${{ steps.setup.outputs.vcpkg_cache_path }}
- name: Set dynamic environment variables
if: ${{ inputs.os_name != 'Windows' }}
run: |
# Note: Required for vcpkg to use this compiler for its own builds.
echo "CC=${{ steps.build-parameters.outputs.host_cc }}" >> "$GITHUB_ENV"
echo "CXX=${{ steps.build-parameters.outputs.host_cxx }}" >> "$GITHUB_ENV"
- name: Create Build Environment
if: ${{ inputs.os_name != 'Windows' && inputs.build_preset != 'Fuzzers' }}
working-directory: ${{ github.workspace }}
env:
VCPKG_CACHE_SAS: ${{ github.ref == 'refs/heads/master' && secrets.VCPKG_CACHE_SAS || '' }}
VCPKG_CACHE_MODE: ${{ github.ref == 'refs/heads/master' && 'write' || '' }}
run: |
cmake --preset ${{ inputs.build_preset }} -B Build \
${{ steps.build-parameters.outputs.cmake_options }} \
-DPython3_EXECUTABLE=${{ env.pythonLocation }}/bin/python \
-DCMAKE_C_COMPILER=${{ steps.build-parameters.outputs.host_cc }} \
-DCMAKE_CXX_COMPILER=${{ steps.build-parameters.outputs.host_cxx }}
- name: Create Build Environment (Windows)
if: ${{ inputs.os_name == 'Windows' }}
working-directory: ${{ github.workspace }}
env:
VCPKG_CACHE_SAS: ${{ github.ref == 'refs/heads/master' && secrets.VCPKG_CACHE_SAS || '' }}
VCPKG_CACHE_MODE: ${{ github.ref == 'refs/heads/master' && 'write' || '' }}
run: |
cmake --preset ${{ inputs.build_preset }} -B Build `
-DENABLE_CI_BASELINE_CPU=ON
- name: Create Build Environment (Fuzzers)
if: ${{ inputs.build_preset == 'Fuzzers' }}
working-directory: ${{ github.workspace }}
env:
VCPKG_CACHE_SAS: ${{ github.ref == 'refs/heads/master' && secrets.VCPKG_CACHE_SAS || '' }}
VCPKG_CACHE_MODE: ${{ github.ref == 'refs/heads/master' && 'write' || '' }}
run: |
cmake --preset=Host_Tools -B "${GITHUB_WORKSPACE}/Build/host-tools-build" \
${{ steps.build-parameters.outputs.cmake_options }} \
-DPython3_EXECUTABLE=${{ env.pythonLocation }}/bin/python
ninja -C "${GITHUB_WORKSPACE}/Build/host-tools-build" install
cmake --preset ${{ inputs.build_preset }} -B Build \
${{ steps.build-parameters.outputs.cmake_options }} \
-DPython3_EXECUTABLE=${{ env.pythonLocation }}/bin/python \
-DCMAKE_C_COMPILER=${{ steps.build-parameters.outputs.host_cc }} \
-DCMAKE_CXX_COMPILER=${{ steps.build-parameters.outputs.host_cxx }} \
-DLagomTools_DIR=${GITHUB_WORKSPACE}/Build/host-tools/share/LagomTools
# === BUILD ===
- name: Build
working-directory: ${{ github.workspace }}/Build
run: |
cmake --build .
cmake --install . --strip --prefix "${GITHUB_WORKSPACE}/Install"
- name: Build with Qt
if: ${{ (inputs.os_name == 'macOS' || inputs.os_name == 'Linux') && inputs.build_preset == 'Sanitizer' }}
working-directory: ${{ github.workspace }}
run: |
cmake --preset ${{ inputs.build_preset }} -B Build -DLADYBIRD_GUI_FRAMEWORK=Qt
cmake --build Build
- name: Save Caches
uses: ./.github/actions/cache-save
with:
arch: ${{ inputs.arch }}
ccache_path: ${{ steps.setup.outputs.ccache_path }}
ccache_primary_key: ${{ steps.cache-restore.outputs.ccache_primary_key }}
vcpkg_cache_path: ${{ steps.setup.outputs.vcpkg_cache_path }}
vcpkg_cache_primary_key: ${{ steps.cache-restore.outputs.vcpkg_cache_primary_key }}
# === TEST ===
- name: Start PulseAudio
if: ${{ inputs.os_name == 'Linux' }}
run: |
echo "PULSE_SERVER=unix:/tmp/pulse-native" >> "$GITHUB_ENV"
pulseaudio --system -D --exit-idle-time=1800 \
--load="module-native-protocol-unix auth-anonymous=1 socket=/tmp/pulse-native" \
--load="module-null-sink sink_name=virtual_sink"
- name: Test
if: ${{ inputs.build_preset == 'Sanitizer' }}
working-directory: ${{ github.workspace }}
run: ctest --preset ${{ inputs.build_preset }} --output-on-failure --test-dir Build --timeout 1800
env:
TESTS_ONLY: 1
# NOTE: These are appended to the preset's options.
ASAN_OPTIONS: 'log_path=asan.log'
UBSAN_OPTIONS: 'log_path=ubsan.log'
- name: Test
if: ${{ inputs.build_preset != 'Fuzzers' && inputs.build_preset != 'All_Debug' && inputs.build_preset != 'Sanitizer' }}
working-directory: ${{ github.workspace }}
run: ctest --output-on-failure --test-dir Build --timeout 1800
env:
TESTS_ONLY: 1
- name: Upload LibWeb Test Artifacts
if: ${{ always() && inputs.build_preset != 'Fuzzers' && inputs.build_preset != 'All_Debug' }}
uses: actions/upload-artifact@v7
with:
name: libweb-test-artifacts-${{ inputs.os_name }}-${{ inputs.arch }}-${{ inputs.build_preset }}-${{ inputs.toolchain }}-${{ inputs.clang_plugins }}
path: |
Build/Tests/LibWeb/test-web/test-dumps/
Build/**/asan.log.*
Build/**/ubsan.log.*
retention-days: 0
if-no-files-found: ignore
- name: Sanitizer Output
if: ${{ !cancelled() && inputs.os_name != 'Windows' && inputs.build_preset == 'Sanitizer' }}
working-directory: ${{ github.workspace }}
run: |
log_output=$(find Build \( -name 'asan.log.*' -o -name 'ubsan.log.*' \) -exec cat {} \; )
if [ -z "$log_output" ]; then
echo "No sanitizer issues found."
else
echo "$log_output"
echo "Sanitizer errors happened while running tests; see the Test step above."
fi