-
Notifications
You must be signed in to change notification settings - Fork 7
276 lines (261 loc) · 10.5 KB
/
build.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
name: Build
on:
push:
# Only run on branches (not tags)
branches:
- '*'
workflow_dispatch:
workflow_run:
workflows: ['Update Mixxx']
types: [completed]
env:
VCPKG_ROOT: '${{ github.workspace }}/vcpkg'
MIXXX_ROOT: '${{ github.workspace }}/mixxx'
SCRIPTS_ROOT: '${{ github.workspace }}/scripts'
XCODE_ROOT: /Applications/Xcode_15.2.app
jobs:
build:
strategy:
matrix:
include:
- name: macOS (arm64)
os: macos-13
suffix: ''
triplet: arm64-osx-min1100-release
host_triplet: x64-osx-min1100-release
ccache_path: ~/Library/Caches/ccache
cpack_generator: DragNDrop
package_extension: dmg
cmake_args: >-
-DMACOS_BUNDLE=ON
- name: macOS (x86_64)
os: macos-13
suffix: ''
triplet: x64-osx-min1100-release
host_triplet: x64-osx-min1100-release
ccache_path: ~/Library/Caches/ccache
cpack_generator: DragNDrop
package_extension: dmg
cmake_args: >-
-DMACOS_BUNDLE=ON
- name: macOS (arm64, Debug Assertions)
os: macos-13
suffix: '-debugasserts'
triplet: arm64-osx-min1100-release
host_triplet: x64-osx-min1100-release
ccache_path: ~/Library/Caches/ccache
cpack_generator: DragNDrop
package_extension: dmg
cmake_args: >-
-DDEBUG_ASSERTIONS_FATAL=ON
-DMACOS_BUNDLE=ON
- name: macOS (x86_64, Debug Assertions)
os: macos-13
suffix: '-debugasserts'
triplet: x64-osx-min1100-release
host_triplet: x64-osx-min1100-release
ccache_path: ~/Library/Caches/ccache
cpack_generator: DragNDrop
package_extension: dmg
cmake_args: >-
-DDEBUG_ASSERTIONS_FATAL=ON
-DMACOS_BUNDLE=ON
- name: Linux (x86_64)
os: ubuntu-latest
suffix: ''
triplet: x64-linux-release
host_triplet: x64-linux-release
ccache_path: ~/.ccache
cpack_generator: TGZ
package_extension: tar.gz
# On Linux we build without battery support since this pulls in a
# dependency on GLib which is tricky to get right in a static linking scenario.
# See https://github.com/fwcd/m1xxx/pull/48#issuecomment-1807378063
cmake_args: >-
-DBATTERY=OFF
- name: Linux (x86_64, Debug Assertions)
os: ubuntu-latest
suffix: '-debugasserts'
triplet: x64-linux-release
host_triplet: x64-linux-release
ccache_path: ~/.ccache
cpack_generator: TGZ
package_extension: tar.gz
cmake_args: >-
-DDEBUG_ASSERTIONS_FATAL=ON
-DBATTERY=OFF
name: '${{ matrix.name }}'
runs-on: '${{ matrix.os }}'
env:
DEPS_BASE_NAME: 'deps-${{ matrix.triplet }}'
ARTIFACT_BASE_NAME: 'mixxx-${{ matrix.triplet }}${{ matrix.suffix }}'
VCPKG_DEFAULT_TRIPLET: '${{ matrix.triplet }}'
VCPKG_DEFAULT_HOST_TRIPLET: '${{ matrix.host_triplet }}'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: '0' # to compute the monotonic version correctly
submodules: true
- name: Output runner info
run: uname -a
- name: Fetch versions and paths
run: |
for mod in "${{ env.VCPKG_ROOT }}" "${{ env.MIXXX_ROOT }}"; do
echo "$(basename "$mod")_commit=$(cd $mod && git rev-parse HEAD)" >> "$GITHUB_ENV"
echo "$(basename "$mod")_commit_short=$(cd $mod && git rev-parse --short HEAD)" >> "$GITHUB_ENV"
done
echo "mixxx_version=$(scripts/mixxx-version)" >> "$GITHUB_ENV"
shell: bash
- name: Set up Linux build environment
if: runner.os == 'Linux'
run: ${{ env.SCRIPTS_ROOT }}/install-ubuntu-deps
- name: Set up macOS build environment
if: runner.os == 'macOS'
run: |
${{ env.SCRIPTS_ROOT }}/install-macos-deps
sudo xcode-select -s "${{ env.XCODE_ROOT }}"
echo "==> Build environment"
xcode-select -p
xcrun --show-sdk-version
# TODO: Remove this workaround once CMake in GitHub's runner image is
# updated to 3.29.2, i.e. the `PACKAGE_PREFIX_DIR` issue is fixed again (the
# breaking change was reverted). See
# - https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md (the image)
# - https://gitlab.kitware.com/cmake/cmake/-/commit/0e4db177647e29b5f4a99ec220e38b5dbbf01361 (the revert)
# - https://github.com/microsoft/vcpkg/pull/38088 (related discussion)
# - https://bugreports.qt.io/browse/QTBUG-124186 (related Qt bug)
- name: Pin CMake to 3.29.2
uses: jwlawson/actions-setup-cmake@v2
with:
cmake-version: '3.29.2'
# Build dependencies
- name: Bootstrap vcpkg
run: ${{ env.SCRIPTS_ROOT }}/bootstrap-vcpkg
- name: Set up vcpkg cache
uses: actions/cache@v4
with:
path: ${{ env.VCPKG_ROOT }}/installed
# TODO: Include hashed list of installed packages in key?
key: vcpkg-installed-${{ matrix.os }}-${{ env.VCPKG_DEFAULT_TRIPLET }}-${{ env.vcpkg_commit }}-${{ github.ref }}-${{ github.run_number }}
restore-keys: |
vcpkg-installed-${{ matrix.os }}-${{ env.VCPKG_DEFAULT_TRIPLET }}-${{ env.vcpkg_commit }}-${{ github.ref }}-
vcpkg-installed-${{ matrix.os }}-${{ env.VCPKG_DEFAULT_TRIPLET }}-${{ env.vcpkg_commit }}-
- name: Check disk space
run: df -h
- name: Output vcpkg dependency graph
run: ${{ env.SCRIPTS_ROOT }}/install-vcpkg-deps --graph --no-install --no-remove
- name: Install vcpkg packages
run: ${{ env.SCRIPTS_ROOT }}/install-vcpkg-deps --clean-after-build
- name: Upload vcpkg build logs
if: always()
uses: actions/upload-artifact@v4
with:
name: 'vcpkg-buildlogs-${{ matrix.triplet }}${{ matrix.suffix }}'
path: ${{ env.VCPKG_ROOT }}/buildtrees/**/*.log
- name: Save vcpkg cache
uses: actions/cache/save@v4
with:
# TODO: Share the key and the path with the previous step
path: ${{ env.VCPKG_ROOT }}/installed
key: vcpkg-installed-${{ matrix.os }}-${{ env.VCPKG_DEFAULT_TRIPLET }}-${{ env.vcpkg_commit }}-${{ github.ref }}-${{ github.run_number }}
# Export dependency archive to artifacts
- name: Export vcpkg archive
if: matrix.suffix == ''
working-directory: ${{ env.VCPKG_ROOT }}
run: >-
${{ env.SCRIPTS_ROOT }}/vcpkg export
--x-all-installed
--x-install-root="${{ env.VCPKG_ROOT }}/installed"
--zip
--output="${{ env.DEPS_BASE_NAME }}-${{ env.vcpkg_commit_short }}"
--output-dir="${{ env.VCPKG_ROOT }}"
- name: Upload vcpkg archive
if: matrix.suffix == ''
uses: actions/upload-artifact@v4
with:
name: ${{ env.DEPS_BASE_NAME }}-${{ env.vcpkg_commit_short }}
path: ${{ env.VCPKG_ROOT }}/${{ env.DEPS_BASE_NAME }}-${{ env.vcpkg_commit_short }}.zip
# Build Mixxx
- name: Configure build cache size
run: ccache -M 500M
- name: Set up build cache
uses: actions/cache@v4
with:
path: ${{ matrix.ccache_path }}
key: ccache-${{ matrix.triplet }}-${{ env.mixxx_commit }}-${{ github.ref }}-${{ github.run_number }}
restore-keys: |
ccache-${{ matrix.triplet }}-${{ env.mixxx_commit }}-${{ github.ref }}-
ccache-${{ matrix.triplet }}-${{ env.mixxx_commit }}-
ccache-${{ matrix.triplet }}-
- name: Configure Mixxx build
run: ${{ env.SCRIPTS_ROOT }}/configure-mixxx -- ${{ matrix.cmake_args }}
working-directory: ${{ env.MIXXX_ROOT }}
- name: Upload Mixxx configuration logs
if: always()
uses: actions/upload-artifact@v4
with:
name: configurelogs
path: ${{ env.MIXXX_ROOT }}/build/CMakeFiles/*.log
- name: Build Mixxx
run: ${{ env.SCRIPTS_ROOT }}/build-mixxx
working-directory: ${{ env.MIXXX_ROOT }}
- name: Save build cache
if: always()
uses: actions/cache/save@v4
with:
# TODO: Share the key with the setup step
path: ${{ matrix.ccache_path }}
key: ccache-${{ matrix.triplet }}-${{ env.mixxx_commit }}-${{ github.ref }}-${{ github.run_number }}
# Work around 'Resource busy' errors likely caused by a race condition
# between hdiutil and CPack by killing XProtect. Unfortunately this does
# not work reliably either, so we try a few times.
# We should replace this with a better solution once fixed upstream.
# See https://github.com/actions/runner-images/issues/7522
- name: Package Mixxx
if: matrix.package_extension && matrix.cpack_generator
uses: nick-fields/retry@v3
with:
timeout_minutes: 30
max_attempts: 8
retry_wait_seconds: 1
command: |
set -e
echo Killing XProtect...; sudo pkill -9 XProtect >/dev/null || true;
echo Waiting for XProtect...; while pgrep XProtect; do sleep 3; done;
cd "${{ env.MIXXX_ROOT }}/build"
cpack -G ${{ matrix.cpack_generator }} -V
mv *.${{ matrix.package_extension }} \
"mixxx-${{ env.mixxx_version }}-${{ matrix.triplet }}${{ matrix.suffix }}.${{ matrix.package_extension }}"
- name: Upload packaged Mixxx binaries
if: matrix.package_extension && matrix.cpack_generator
uses: actions/upload-artifact@v4
with:
name: ${{ env.ARTIFACT_BASE_NAME }}
path: ${{ env.MIXXX_ROOT }}/build/*.${{ matrix.package_extension }}
release:
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
needs: [build]
env:
PACKAGE_GLOB: 'mixxx-*/*'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: '0' # to compute the monotonic version correctly
submodules: true
- name: Fetch versions and paths
run: echo "mixxx_version=$(scripts/mixxx-version)" >> "$GITHUB_ENV"
shell: bash
- name: Download artifacts for all builds
uses: actions/download-artifact@v4
with:
# TODO: Only download artifacts starting with 'mixxx-' to avoid needlessly downloading the dependency archives
path: '${{ env.MIXXX_ROOT }}/build'
- name: Create a release
env:
GH_TOKEN: ${{ github.token }}
run: |
version='${{ env.mixxx_version }}'
tag="v$version"
gh release create --title "$tag" "$tag" || true
gh release upload "$tag" '${{ env.MIXXX_ROOT }}'/build/${{ env.PACKAGE_GLOB }} || true