forked from musescore/MuseScore
-
Notifications
You must be signed in to change notification settings - Fork 0
411 lines (370 loc) · 16.9 KB
/
Copy pathbuild_linux.yml
File metadata and controls
411 lines (370 loc) · 16.9 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
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
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
name: 'Build: Linux / Check: Unit tests (mtests)'
on:
# schedule: # scheduled workflows will only run on the default branch. edit default values under gen1 below
# - cron: '0 4 */1 * *' # At 04:00 on every day-of-month
push: # push.inputs field does not exist, use gen1 below
branches:
- 3.x
pull_request: # all branches. pull_request.inputs field does not exist, edit gen1 below
workflow_dispatch: # triggered by github web ui run "build linux" workflow button
inputs:
platforms:
description: 'Platforms to build:'
default: 'linux_x64 linux_armhf linux_arm64'
type: string
required: true
build_mode:
description: 'Build mode: devel, nightly, testing, stable'
default: 'devel'
type: string
required: true
runtest:
description: 'Check: Unit tests (mtests)'
default: 'on'
type: string
required: false
publish:
description: 'Publish to FTP when nightly generated (obsolete)'
default: 'off'
type: string
required: false
execfrom:
description: 'workflow github.event_name workaround, leave as is'
default: 'false'
type: string
required: true
workflow_call: # triggered by "uses" from other yml files. copy paste of workflow_dispatch for simplicity. "default" fields ignored (unsure)
inputs:
platforms:
description: 'Platforms to build:'
default: 'linux_x64 linux_armhf linux_arm64'
type: string
required: true
build_mode:
description: 'Build mode: devel, nightly, testing, stable'
default: 'devel'
type: string
required: true
runtest:
description: 'Check: Unit tests (mtests)'
default: 'on'
type: string
required: false
publish:
description: 'Publish to FTP when nightly generated (obsolete)'
default: 'off'
type: string
required: false
execfrom:
description: 'workflow github.event_name workaround, leave as is'
default: 'false'
type: string
required: true
jobs:
plan:
name: setup (linux yml)
runs-on: ubuntu-latest
outputs:
platforms: ${{ steps.gen1.outputs.platforms }}
build_mode: ${{ steps.gen1.outputs.build_mode }}
runtest: ${{ steps.gen1.outputs.runtest }}
publish: ${{ steps.gen1.outputs.publish }}
steps:
- id: gen1
name: Set or pass values
run: |
if [[ "${{ inputs.execfrom }}" == "publishdev" ]]; then
echo "triggered by on.push/pull_request/schedule of publishdev , on.workflow_call of build linux"
echo "platforms=${{ inputs.platforms }}" | tee -a "$GITHUB_OUTPUT"
echo "build_mode=${{ inputs.build_mode }}" | tee -a "$GITHUB_OUTPUT"
echo "runtest=${{ inputs.runtest }}" >> "$GITHUB_OUTPUT"
echo "publish=${{ inputs.publish }}" | tee -a "$GITHUB_OUTPUT"
elif [[ "${{ inputs.execfrom }}" == "buildall" ]]; then
echo "triggered by on.push/pull_request/schedule of buildall , on.workflow_call of build linux"
echo "platforms=${{ inputs.platforms }}" | tee -a "$GITHUB_OUTPUT"
echo "build_mode=${{ inputs.build_mode }}" | tee -a "$GITHUB_OUTPUT"
echo "runtest=on" >> "$GITHUB_OUTPUT"
echo "publish=${{ inputs.publish }}" | tee -a "$GITHUB_OUTPUT"
elif [[ "${{ github.event_name }}" == "pull_request" ]]; then
echo "triggered by 1. on.pull_request of build linux or 2. on.pull_request of workflows other than publishdev and buildall that triggers on.workflow_call of build linux"
echo "platforms=linux_x64 linux_armhf linux_arm64" | tee -a "$GITHUB_OUTPUT"
echo "build_mode=devel" | tee -a "$GITHUB_OUTPUT" # copied from make_build_mode_env.sh
echo "runtest=on" >> "$GITHUB_OUTPUT"
echo "publish=off" | tee -a "$GITHUB_OUTPUT"
elif [[ "${{ github.event_name }}" == "schedule" ]]; then
echo "triggered by 1. on.schedule of build linux or 2. on.schedule of workflows other than publishdev and buildall that triggers on.workflow_call of build linux"
echo "platforms=linux_x64 linux_armhf linux_arm64" | tee -a "$GITHUB_OUTPUT"
echo "build_mode=nightly" | tee -a "$GITHUB_OUTPUT" # copied from make_build_mode_env.sh
echo "runtest=on" >> "$GITHUB_OUTPUT"
echo "publish=off" | tee -a "$GITHUB_OUTPUT"
elif [[ "${{ github.event_name }}" == "push" ]]; then
echo "triggered 1. by on.push of build linux or 2. on.push of workflows other than publishdev and buildall that triggers on.workflow_call of build linux"
echo "platforms=linux_x64 linux_armhf linux_arm64" | tee -a "$GITHUB_OUTPUT"
echo "build_mode=devel" | tee -a "$GITHUB_OUTPUT" # copied from make_build_mode_env.sh
echo "runtest=on" >> "$GITHUB_OUTPUT"
echo "publish=off" | tee -a "$GITHUB_OUTPUT"
else
echo "platforms=${{ inputs.platforms }}" | tee -a "$GITHUB_OUTPUT"
echo "build_mode=${{ inputs.build_mode }}" | tee -a "$GITHUB_OUTPUT"
echo "runtest=${{ inputs.runtest }}" >> "$GITHUB_OUTPUT"
echo "publish=${{ inputs.publish }}" | tee -a "$GITHUB_OUTPUT"
fi
# linux_x64, linux_armhf and linux_arm64 are identical copies (May 2025), except for "if", "runs-on" and, "env" fields.
linux_x64:
if: ${{ contains(needs.plan.outputs.platforms, 'linux_x64') }}
runs-on: ubuntu-22.04
env:
ARCH: x86_64
##
needs:
- plan
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.12.1
with:
access_token: ${{ github.token }}
- name: Clone repository
uses: actions/checkout@v4
- name: Configure workflow
run: |
bash ./build/ci/tools/make_build_mode_env.sh -e ${{ github.event_name }} -m ${{ needs.plan.outputs.build_mode }}
BUILD_MODE=$(cat ./build.artifacts/env/build_mode.env)
bash ./build/ci/tools/make_build_number.sh
BUILD_NUMBER=$(cat ./build.artifacts/env/build_number.env)
DO_PUBLISH='false'
if [[ "${{ needs.plan.outputs.publish }}" == "on" && "$BUILD_MODE" == "nightly" ]]; then
DO_PUBLISH='true'
if [ -z "${{ secrets.OSUOSL_SSH_ENCRYPT_SECRET }}" ]; then
echo "::warning::OSUOSL_SSH_ENCRYPT_SECRET is empty; not publishing to OSUOSL"
DO_PUBLISH='false'
fi
fi
ADD_INFO="_${GITHUB_REF#refs/heads/}"
if [ "${{ github.event_name }}" == "pull_request" ]; then
ADD_INFO="_${{ github.event.pull_request.number }}_${{ github.event.pull_request.title }}"
fi
UPLOAD_ARTIFACT_NAME="$(tr '":<>|*?/\\’' '_' <<<"Mu3.7_${BUILD_NUMBER}_Lin_$ARCH${ADD_INFO}")"
echo "github.repository: ${{ github.repository }}"
echo "BUILD_MODE=$BUILD_MODE" | tee -a $GITHUB_ENV
echo "BUILD_NUMBER=$BUILD_NUMBER" | tee -a $GITHUB_ENV
echo "DO_PUBLISH=$DO_PUBLISH" | tee -a $GITHUB_ENV
echo "UPLOAD_ARTIFACT_NAME=$UPLOAD_ARTIFACT_NAME" | tee -a $GITHUB_ENV
- name: Setup environment (x86_64)
if: env.ARCH == 'x86_64'
run: |
bash ./build/ci/linux/setup.sh --arch $ARCH --is_calling_without_sudo true
- name: Build (x86_64)
if: env.ARCH == 'x86_64'
run: |
T_ID=${{ secrets.TELEMETRY_TRACK_ID }}; if [ -z "$T_ID" ]; then T_ID="''"; fi
bash ./build/ci/linux/build.sh -n ${{ github.run_id }} --build_mode $BUILD_MODE --telemetry $T_ID
- name: Package (x86_64)
if: env.ARCH == 'x86_64'
run: |
bash ./build/ci/linux/package.sh --arch $ARCH
- name: Checksum (x86_64)
if: env.ARCH == 'x86_64'
run: |
bash ./build/ci/tools/checksum.sh
- name: Setup, build, package, checksum (ARM)
if: env.ARCH == 'armv7l' || env.ARCH == 'aarch64'
run: |
# QEMU for binfmt issue make_appimage.sh https://github.com/AppImage/AppImageKit/issues/965
sudo apt-get update
sudo apt-get install qemu-user-static -y
T_ID=${{ secrets.TELEMETRY_TRACK_ID }}; if [ -z "$T_ID" ]; then T_ID="''"; fi
sudo docker run -i -v "${PWD}:/MuseScore" -v /usr/bin/qemu-arm-static:/usr/bin/qemu-arm-static "$DOCKERIMAGE" /bin/bash -c "cd /MuseScore && \
bash /MuseScore/build/ci/linux/setup.sh --arch $ARCH && \
bash /MuseScore/build/ci/linux/build.sh -n ${{ github.run_id }} --build_mode $BUILD_MODE --telemetry $T_ID && \
bash /MuseScore/build/ci/linux/package.sh --arch $ARCH && \
bash /MuseScore/build/ci/tools/checksum.sh"
- name: Publish to OSUOSL
if: env.DO_PUBLISH == 'true'
run: |
bash ./build/ci/tools/osuosl/publish.sh -s ${{ secrets.OSUOSL_SSH_ENCRYPT_SECRET }} --os linux -v 3
- name: Upload artifacts on GitHub
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: ${{ env.UPLOAD_ARTIFACT_NAME }}
path: ./build.artifacts/
linux_armhf:
if: ${{ contains(needs.plan.outputs.platforms, 'linux_armhf') }}
runs-on: ubuntu-22.04-arm
env:
ARCH: armv7l
DOCKERIMAGE: arm32v7/ubuntu:focal
##
needs:
- plan
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.12.1
with:
access_token: ${{ github.token }}
- name: Clone repository
uses: actions/checkout@v4
- name: Configure workflow
run: |
bash ./build/ci/tools/make_build_mode_env.sh -e ${{ github.event_name }} -m ${{ needs.plan.outputs.build_mode }}
BUILD_MODE=$(cat ./build.artifacts/env/build_mode.env)
bash ./build/ci/tools/make_build_number.sh
BUILD_NUMBER=$(cat ./build.artifacts/env/build_number.env)
DO_PUBLISH='false'
if [[ "${{ needs.plan.outputs.publish }}" == "on" && "$BUILD_MODE" == "nightly" ]]; then
DO_PUBLISH='true'
if [ -z "${{ secrets.OSUOSL_SSH_ENCRYPT_SECRET }}" ]; then
echo "::warning::OSUOSL_SSH_ENCRYPT_SECRET is empty; not publishing to OSUOSL"
DO_PUBLISH='false'
fi
fi
ADD_INFO="_${GITHUB_REF#refs/heads/}"
if [ "${{ github.event_name }}" == "pull_request" ]; then
ADD_INFO="_${{ github.event.pull_request.number }}_${{ github.event.pull_request.title }}"
fi
UPLOAD_ARTIFACT_NAME="$(tr '":<>|*?/\\’' '_' <<<"Mu3.7_${BUILD_NUMBER}_Lin_$ARCH${ADD_INFO}")"
echo "github.repository: ${{ github.repository }}"
echo "BUILD_MODE=$BUILD_MODE" | tee -a $GITHUB_ENV
echo "BUILD_NUMBER=$BUILD_NUMBER" | tee -a $GITHUB_ENV
echo "DO_PUBLISH=$DO_PUBLISH" | tee -a $GITHUB_ENV
echo "UPLOAD_ARTIFACT_NAME=$UPLOAD_ARTIFACT_NAME" | tee -a $GITHUB_ENV
- name: Setup environment (x86_64)
if: env.ARCH == 'x86_64'
run: |
bash ./build/ci/linux/setup.sh --arch $ARCH --is_calling_without_sudo true
- name: Build (x86_64)
if: env.ARCH == 'x86_64'
run: |
T_ID=${{ secrets.TELEMETRY_TRACK_ID }}; if [ -z "$T_ID" ]; then T_ID="''"; fi
bash ./build/ci/linux/build.sh -n ${{ github.run_id }} --build_mode $BUILD_MODE --telemetry $T_ID
- name: Package (x86_64)
if: env.ARCH == 'x86_64'
run: |
bash ./build/ci/linux/package.sh --arch $ARCH
- name: Checksum (x86_64)
if: env.ARCH == 'x86_64'
run: |
bash ./build/ci/tools/checksum.sh
- name: Setup, build, package, checksum (ARM)
if: env.ARCH == 'armv7l' || env.ARCH == 'aarch64'
run: |
# QEMU for binfmt issue make_appimage.sh https://github.com/AppImage/AppImageKit/issues/965
sudo apt-get update
sudo apt-get install qemu-user-static -y
T_ID=${{ secrets.TELEMETRY_TRACK_ID }}; if [ -z "$T_ID" ]; then T_ID="''"; fi
sudo docker run -i -v "${PWD}:/MuseScore" -v /usr/bin/qemu-arm-static:/usr/bin/qemu-arm-static "$DOCKERIMAGE" /bin/bash -c "cd /MuseScore && \
bash /MuseScore/build/ci/linux/setup.sh --arch $ARCH && \
bash /MuseScore/build/ci/linux/build.sh -n ${{ github.run_id }} --build_mode $BUILD_MODE --telemetry $T_ID && \
bash /MuseScore/build/ci/linux/package.sh --arch $ARCH && \
bash /MuseScore/build/ci/tools/checksum.sh"
- name: Publish to OSUOSL
if: env.DO_PUBLISH == 'true'
run: |
bash ./build/ci/tools/osuosl/publish.sh -s ${{ secrets.OSUOSL_SSH_ENCRYPT_SECRET }} --os linux -v 3
- name: Upload artifacts on GitHub
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: ${{ env.UPLOAD_ARTIFACT_NAME }}
path: ./build.artifacts/
linux_arm64:
if: ${{ contains(needs.plan.outputs.platforms, 'linux_arm64') }}
runs-on: ubuntu-22.04-arm
env:
ARCH: aarch64
DOCKERIMAGE: arm64v8/ubuntu:focal
##
needs:
- plan
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.12.1
with:
access_token: ${{ github.token }}
- name: Clone repository
uses: actions/checkout@v4
- name: Configure workflow
run: |
bash ./build/ci/tools/make_build_mode_env.sh -e ${{ github.event_name }} -m ${{ needs.plan.outputs.build_mode }}
BUILD_MODE=$(cat ./build.artifacts/env/build_mode.env)
bash ./build/ci/tools/make_build_number.sh
BUILD_NUMBER=$(cat ./build.artifacts/env/build_number.env)
DO_PUBLISH='false'
if [[ "${{ needs.plan.outputs.publish }}" == "on" && "$BUILD_MODE" == "nightly" ]]; then
DO_PUBLISH='true'
if [ -z "${{ secrets.OSUOSL_SSH_ENCRYPT_SECRET }}" ]; then
echo "::warning::OSUOSL_SSH_ENCRYPT_SECRET is empty; not publishing to OSUOSL"
DO_PUBLISH='false'
fi
fi
ADD_INFO="_${GITHUB_REF#refs/heads/}"
if [ "${{ github.event_name }}" == "pull_request" ]; then
ADD_INFO="_${{ github.event.pull_request.number }}_${{ github.event.pull_request.title }}"
fi
UPLOAD_ARTIFACT_NAME="$(tr '":<>|*?/\\’' '_' <<<"Mu3.7_${BUILD_NUMBER}_Lin_$ARCH${ADD_INFO}")"
echo "github.repository: ${{ github.repository }}"
echo "BUILD_MODE=$BUILD_MODE" | tee -a $GITHUB_ENV
echo "BUILD_NUMBER=$BUILD_NUMBER" | tee -a $GITHUB_ENV
echo "DO_PUBLISH=$DO_PUBLISH" | tee -a $GITHUB_ENV
echo "UPLOAD_ARTIFACT_NAME=$UPLOAD_ARTIFACT_NAME" | tee -a $GITHUB_ENV
- name: Setup environment (x86_64)
if: env.ARCH == 'x86_64'
run: |
bash ./build/ci/linux/setup.sh --arch $ARCH --is_calling_without_sudo true
- name: Build (x86_64)
if: env.ARCH == 'x86_64'
run: |
T_ID=${{ secrets.TELEMETRY_TRACK_ID }}; if [ -z "$T_ID" ]; then T_ID="''"; fi
bash ./build/ci/linux/build.sh -n ${{ github.run_id }} --build_mode $BUILD_MODE --telemetry $T_ID
- name: Package (x86_64)
if: env.ARCH == 'x86_64'
run: |
bash ./build/ci/linux/package.sh --arch $ARCH
- name: Checksum (x86_64)
if: env.ARCH == 'x86_64'
run: |
bash ./build/ci/tools/checksum.sh
- name: Setup, build, package, checksum (ARM)
if: env.ARCH == 'armv7l' || env.ARCH == 'aarch64'
run: |
# QEMU for binfmt issue make_appimage.sh https://github.com/AppImage/AppImageKit/issues/965
sudo apt-get update
sudo apt-get install qemu-user-static -y
T_ID=${{ secrets.TELEMETRY_TRACK_ID }}; if [ -z "$T_ID" ]; then T_ID="''"; fi
sudo docker run -i -v "${PWD}:/MuseScore" -v /usr/bin/qemu-arm-static:/usr/bin/qemu-arm-static "$DOCKERIMAGE" /bin/bash -c "cd /MuseScore && \
bash /MuseScore/build/ci/linux/setup.sh --arch $ARCH && \
bash /MuseScore/build/ci/linux/build.sh -n ${{ github.run_id }} --build_mode $BUILD_MODE --telemetry $T_ID && \
bash /MuseScore/build/ci/linux/package.sh --arch $ARCH && \
bash /MuseScore/build/ci/tools/checksum.sh"
- name: Publish to OSUOSL
if: env.DO_PUBLISH == 'true'
run: |
bash ./build/ci/tools/osuosl/publish.sh -s ${{ secrets.OSUOSL_SSH_ENCRYPT_SECRET }} --os linux -v 3
- name: Upload artifacts on GitHub
if: ${{ always() }}
uses: actions/upload-artifact@v4
with:
name: ${{ env.UPLOAD_ARTIFACT_NAME }}
path: ./build.artifacts/
run_mtests:
if: needs.plan.outputs.runtest == 'on'
needs:
- plan
runs-on: ubuntu-22.04
steps:
- name: Clone repository
uses: actions/checkout@v4
- name: Free disk space
run: |
sudo docker system prune -a -f
sudo rm -rf /usr/local/lib/android
- name: Setup environment
run: |
bash ./build/ci/linux/setup.sh --is_calling_without_sudo true --cflags '-fsanitize=address -fno-omit-frame-pointer' --cxxflags '-fsanitize=address -fno-omit-frame-pointer'
- name: Build
run: |
mkdir -p build.artifacts/env # = make_build_mode_env.sh in os build scripts
./build/ci/linux/build.sh -n ${{ github.run_id }} --build_mode mtests
- name: Run mtests
run: |
./build/ci/linux/runmtests.sh