-
Notifications
You must be signed in to change notification settings - Fork 3.1k
401 lines (369 loc) · 15.1 KB
/
build_windows.yml
File metadata and controls
401 lines (369 loc) · 15.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
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
name: 'Build: Windows'
on:
pull_request:
workflow_dispatch:
inputs:
platforms:
description: 'Platforms to build:'
default: 'windows_x64 windows_portable'
required: true
build_mode:
description: 'Build mode: devel, nightly, testing, stable'
default: 'devel'
required: true
publish:
description: 'Publish to FTP: on - publish'
default: 'off'
required: false
sentry_project:
description: 'Upload symbols and dumps to Sentry (choose a project): mu4(default for stable build), mu4-sandbox'
default: ''
required: false
workflow_call:
inputs:
platforms:
description: 'Platforms to build:'
default: 'windows_x64 windows_portable'
type: string
required: true
build_mode:
description: 'Build mode: devel, nightly, testing, stable'
default: 'devel'
type: string
required: true
publish:
description: 'Publish to FTP: on - publish'
default: 'off'
type: string
required: false
sentry_project:
description: 'Upload symbols and dumps to Sentry (choose a project): mu4(default for stable build), mu4-sandbox'
default: ''
type: string
required: false
build_number:
description: "Build number (if not provided, will be generated)"
default: ""
type: string
required: false
jobs:
windows_x64:
if: github.event_name != 'workflow_dispatch' || contains(inputs.platforms, 'windows_x64')
runs-on: windows-2025
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.13.0
with:
access_token: ${{ github.token }}
- name: Clone repository
uses: actions/checkout@v6
- name: Configure workflow
shell: bash
env:
pull_request_title: ${{ github.event.pull_request.title }}
SENTRY_MUSE_MU4_KEY: ${{ secrets.SENTRY_MUSE_MU4_KEY }}
SENTRY_MUSE_MU4_SANDBOX_KEY: ${{ secrets.SENTRY_MUSE_MU4_SANDBOX_KEY }}
SENTRY_PROJECT: ${{ inputs.sentry_project }}
run: |
bash ./buildscripts/ci/tools/make_build_mode_env.sh -e ${{ github.event_name }} -m ${{ inputs.build_mode }}
BUILD_MODE=$(cat ./build.artifacts/env/build_mode.env)
if [ -n "${{ inputs.build_number }}" ]; then
BUILD_NUMBER="${{ inputs.build_number }}"
bash ./buildscripts/ci/tools/make_build_number.sh "$BUILD_NUMBER"
else
bash ./buildscripts/ci/tools/make_build_number.sh
fi
BUILD_NUMBER=$(cat ./build.artifacts/env/build_number.env)
DO_UPDATE_TS='false'
if [[ "$BUILD_MODE" == "testing" || "$BUILD_MODE" == "stable" ]]; then
DO_UPDATE_TS='true'
if [ -z "${{ secrets.TRANSIFEX_API_TOKEN }}" ]; then
echo "::warning::TRANSIFEX_API_TOKEN is empty; updating .ts files disabled"
DO_UPDATE_TS='false'
fi
fi
DO_PLACEHOLDER_TRANSLATIONS='false'
if [[ "$BUILD_MODE" == "nightly" || "$BUILD_MODE" == "devel" ]]; then
DO_PLACEHOLDER_TRANSLATIONS='true'
fi
DO_UPLOAD_SYMBOLS='false'
SENTRY_URL=""
if [ "$SENTRY_MUSE_MU4_KEY" != "" ]; then
if [ -z "$SENTRY_PROJECT" ] && [ "$BUILD_MODE" == "stable" ]; then
SENTRY_PROJECT="mu4"
fi
if [ "$SENTRY_PROJECT" == "mu4" ]; then
DO_UPLOAD_SYMBOLS='true'
SENTRY_URL=https://sentry.musescore.com/api/4/minidump/?sentry_key=$SENTRY_MUSE_MU4_KEY
fi
fi
if [ -z "$SENTRY_PROJECT" ] && [ "$BUILD_MODE" == "nightly" ]; then
SENTRY_PROJECT="mu4-sandbox"
fi
if [ "$SENTRY_PROJECT" == "mu4-sandbox" ] && [ "$SENTRY_MUSE_MU4_SANDBOX_KEY" != "" ]; then
DO_UPLOAD_SYMBOLS='true'
SENTRY_URL=https://sentry.musescore.com/api/3/minidump/?sentry_key=$SENTRY_MUSE_MU4_SANDBOX_KEY
fi
DO_PUBLISH='false'
if [ "${{ inputs.publish }}" == "on" ]; 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 }}_${pull_request_title}"
fi
UPLOAD_ARTIFACT_NAME="$(tr '":<>|*?/\\’' '_' <<<"MU4_${BUILD_NUMBER}_Win${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_UPDATE_TS=$DO_UPDATE_TS" | tee -a $GITHUB_ENV
echo "DO_PLACEHOLDER_TRANSLATIONS=$DO_PLACEHOLDER_TRANSLATIONS" | tee -a $GITHUB_ENV
echo "DO_UPLOAD_SYMBOLS=$DO_UPLOAD_SYMBOLS" | tee -a $GITHUB_ENV
echo "SENTRY_PROJECT=$SENTRY_PROJECT" | tee -a $GITHUB_ENV
echo "SENTRY_URL=$SENTRY_URL" | 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: Restore ccache files
id: restore-ccache
uses: actions/cache/restore@v5
with:
path: ${{ github.workspace }}/.ccache
key: ${{runner.os}}-${{runner.arch}}-ccache-
restore-keys: ${{runner.os}}-${{runner.arch}}-ccache-
- name: Setup ccache
run: |
choco install -y ccache
bash ./buildscripts/ci/tools/setup_ccache_config.sh
- name: Install Qt
uses: jurplel/install-qt-action@v4
with:
version: 6.10.2
host: 'windows'
target: 'desktop'
arch: 'win64_msvc2022_64'
modules: 'qt5compat qtnetworkauth qtshadertools qtwebsockets'
cache: true
- name: Setup environment
run: |
buildscripts\ci\windows\setup.bat
- name: Generate _en.ts files
shell: bash
env:
LUPDATE_ARGS: ""
POSTPROCESS_ARGS: "--warn-only ${{ env.DO_PLACEHOLDER_TRANSLATIONS == 'true' && '--generate-placeholder-translations' || '' }}"
POSTPROCESS_LAUNCHER: "python3 -X utf8"
run: |
bash ./tools/translations/run_lupdate.sh
- name: Update .ts files (tx pull)
if: env.DO_UPDATE_TS == 'true'
uses: cbjeukendrup/cli-action@windows
with:
token: ${{ secrets.TRANSIFEX_API_TOKEN }}
args: "pull -f"
- name: Register msvc problem matcher
run: echo "::add-matcher::.github/problem_matchers/msvc.json"
- name: Build
shell: cmd
run: |
IF ${{ env.SENTRY_URL != 0 }} == true ( SET C_URL="${{ env.SENTRY_URL }}" ) ELSE ( SET C_URL="" )
buildscripts\ci\windows\build.bat -n ${{ env.BUILD_NUMBER }} --crash_log_url %C_URL%
- name: Show ccache stats
run: |
ccache -sv
- name: Package
shell: cmd
run: |
IF ${{ secrets.WIN_SIGN_S3_SECRET != 0 }} == true ( SET S_S=${{ secrets.WIN_SIGN_S3_SECRET }} ) ELSE ( SET S_S="''" )
IF ${{ secrets.WIN_SIGN_S3_KEY != 0 }} == true ( SET S_K=${{ secrets.WIN_SIGN_S3_KEY }} ) ELSE ( SET S_K="''" )
IF ${{ env.BUILD_MODE }} == stable ( SET GUID=${{ secrets.WIN_MSI_STABLE_MU4_GUID }} ) ELSE ( SET GUID=${{ secrets.WIN_MSI_TESTING_MU4_GUID }} )
buildscripts\ci\windows\package.bat --signsecret %S_S% --signkey %S_K% --guid %GUID%
- name: Checksum
run: |
bash ./buildscripts/ci/tools/checksum.sh
- name: Generate and upload dump symbols
if: env.DO_UPLOAD_SYMBOLS == 'true'
shell: bash
run: |
APP_BIN=$(pwd)/build.release/MuseScore5.pdb
cmake -DAPP_BIN=${APP_BIN} \
-DSENTRY_URL=https://sentry.musescore.com \
-DSENTRY_ORG=sentry \
-DSENTRY_AUTH_TOKEN=${{ secrets.SENTRY_MUSE_AUTH_TOKEN }} \
-DSENTRY_PROJECT=${SENTRY_PROJECT} \
-P buildscripts/ci/crashdumps/ci_generate_and_upload.cmake
- name: Publish to OSUOSL
if: env.DO_PUBLISH == 'true'
shell: bash
run: |
bash ./buildscripts/ci/tools/osuosl/publish.sh -s ${{ secrets.OSUOSL_SSH_ENCRYPT_SECRET }} --os windows -v 4
- name: Upload artifacts on GitHub
if: ${{ always() }}
uses: actions/upload-artifact@v7
with:
name: ${{ env.UPLOAD_ARTIFACT_NAME }}
path: build.artifacts\
- name: Prepare ccache files for saving
id: prepare-save-ccache
if: always()
shell: bash
run: |
ccache --recompress 10
echo "CCACHE_TIMESTAMP=$(date -u +"%F-%T")" | tee -a $GITHUB_OUTPUT
- name: Save ccache files
if: always()
uses: actions/cache/save@v5
with:
key: ${{ steps.restore-ccache.outputs.cache-primary-key }}${{ steps.prepare-save-ccache.outputs.CCACHE_TIMESTAMP }}
path: ${{ github.workspace }}/.ccache
windows_portable:
# Disable on pull_request
if: |
github.event_name != 'pull_request' &&
(github.event_name != 'workflow_dispatch' || contains(inputs.platforms, 'windows_portable'))
runs-on: windows-2025
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.13.0
with:
access_token: ${{ github.token }}
- name: Clone repository
uses: actions/checkout@v6
- name: Configure workflow
shell: bash
env:
pull_request_title: ${{ github.event.pull_request.title }}
run: |
bash ./buildscripts/ci/tools/make_build_mode_env.sh -e ${{ github.event_name }} -m ${{ inputs.build_mode }}
BUILD_MODE=$(cat ./build.artifacts/env/build_mode.env)
if [ -n "${{ inputs.build_number }}" ]; then
BUILD_NUMBER="${{ inputs.build_number }}"
bash ./buildscripts/ci/tools/make_build_number.sh "$BUILD_NUMBER"
else
bash ./buildscripts/ci/tools/make_build_number.sh
fi
BUILD_NUMBER=$(cat ./build.artifacts/env/build_number.env)
DO_UPDATE_TS='false'
if [[ "$BUILD_MODE" == "testing" || "$BUILD_MODE" == "stable" ]]; then
DO_UPDATE_TS='true'
if [ -z "${{ secrets.TRANSIFEX_API_TOKEN }}" ]; then
echo "::warning::TRANSIFEX_API_TOKEN is empty; updating .ts files disabled"
DO_UPDATE_TS='false'
fi
fi
DO_PLACEHOLDER_TRANSLATIONS='false'
if [[ "$BUILD_MODE" == "nightly" || "$BUILD_MODE" == "devel" ]]; then
DO_PLACEHOLDER_TRANSLATIONS='true'
fi
DO_PUBLISH='false'
if [ "${{ inputs.publish }}" == "on" ]; 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 }}_${pull_request_title}"
fi
UPLOAD_ARTIFACT_NAME="$(tr '":<>|*?/\\’' '_' <<<"MU4_${BUILD_NUMBER}_Win_portable${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_UPDATE_TS=$DO_UPDATE_TS" | tee -a $GITHUB_ENV
echo "DO_PLACEHOLDER_TRANSLATIONS=$DO_PLACEHOLDER_TRANSLATIONS" | 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: Restore ccache files
id: restore-ccache
uses: actions/cache/restore@v5
with:
path: ${{ github.workspace }}/.ccache
key: ${{runner.os}}-${{runner.arch}}-ccache-
restore-keys: ${{runner.os}}-${{runner.arch}}-ccache-
- name: Setup ccache
run: |
choco install -y ccache
bash ./buildscripts/ci/tools/setup_ccache_config.sh
- name: Install Qt
uses: jurplel/install-qt-action@v4
with:
version: 6.10.2
host: 'windows'
target: 'desktop'
arch: 'win64_msvc2022_64'
modules: 'qt5compat qtnetworkauth qtshadertools qtwebsockets'
cache: true
- name: Setup environment
run: |
buildscripts\ci\windows\setup.bat --portable ON
- name: Generate _en.ts files
shell: bash
env:
LUPDATE_ARGS: ""
POSTPROCESS_ARGS: "--warn-only ${{ env.DO_PLACEHOLDER_TRANSLATIONS == 'true' && '--generate-placeholder-translations' || '' }}"
POSTPROCESS_LAUNCHER: "python3 -X utf8"
run: |
bash ./tools/translations/run_lupdate.sh
- name: Update .ts files (tx pull)
if: env.DO_UPDATE_TS == 'true'
uses: cbjeukendrup/cli-action@windows
with:
token: ${{ secrets.TRANSIFEX_API_TOKEN }}
args: "pull -f"
- name: Build
shell: cmd
run: |
IF ${{ env.SENTRY_URL != 0 }} == true ( SET C_URL="${{ env.SENTRY_URL }}" ) ELSE ( SET C_URL="" )
buildscripts\ci\windows\build.bat --portable ON -n ${{ env.BUILD_NUMBER }} --crash_log_url %C_URL%
- name: Show ccache stats
run: |
ccache -sv
- name: Package
shell: cmd
run: |
IF ${{ secrets.WIN_SIGN_S3_SECRET != 0 }} == true ( SET S_S=${{ secrets.WIN_SIGN_S3_SECRET }} ) ELSE ( SET S_S="''" )
IF ${{ secrets.WIN_SIGN_S3_KEY != 0 }} == true ( SET S_K=${{ secrets.WIN_SIGN_S3_KEY }} ) ELSE ( SET S_K="''" )
buildscripts\ci\windows\package.bat --portable ON --signsecret %S_S% --signkey %S_K%
- name: Checksum
run: |
bash ./buildscripts/ci/tools/checksum.sh
- name: Publish to OSUOSL
if: env.DO_PUBLISH == 'true'
shell: bash
run: |
bash ./buildscripts/ci/tools/osuosl/publish.sh -s ${{ secrets.OSUOSL_SSH_ENCRYPT_SECRET }} --os windows -v 4 --arch x86_64
- name: Upload artifacts on GitHub
uses: actions/upload-artifact@v7
with:
name: ${{ env.UPLOAD_ARTIFACT_NAME }}
path: build.artifacts\
- name: Prepare ccache files for saving
id: prepare-save-ccache
if: always()
shell: bash
run: |
ccache --recompress 10
echo "CCACHE_TIMESTAMP=$(date -u +"%F-%T")" | tee -a $GITHUB_OUTPUT
- name: Save ccache files
if: always()
uses: actions/cache/save@v5
with:
key: ${{ steps.restore-ccache.outputs.cache-primary-key }}${{ steps.prepare-save-ccache.outputs.CCACHE_TIMESTAMP }}
path: ${{ github.workspace }}/.ccache
# windows_sign_test:
# if: github.event_name != 'workflow_dispatch' || contains(inputs.platforms, 'sign_test')
# runs-on: windows-2025
# steps:
# - name: Clone repository
# uses: actions/checkout@v6
# - name: Sign test
# shell: cmd
# run: |
# IF ${{ secrets.WIN_SIGN_S3_SECRET != 0 }} == true ( SET S_S=${{ secrets.WIN_SIGN_S3_SECRET }} ) ELSE ( SET S_S="''" )
# IF ${{ secrets.WIN_SIGN_S3_KEY != 0 }} == true ( SET S_K=${{ secrets.WIN_SIGN_S3_KEY }} ) ELSE ( SET S_P="''" )
# buildscripts\ci\windows\sign_test.bat --secret %S_S% --key %S_K%