-
Notifications
You must be signed in to change notification settings - Fork 2.7k
182 lines (166 loc) · 6.82 KB
/
build_linux.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
name: 'Build: Linux'
on:
pull_request:
workflow_dispatch:
inputs:
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), sandbox'
default: ''
required: false
workflow_call:
inputs:
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), sandbox'
default: ''
type: string
required: false
jobs:
linux_x64:
runs-on: ubuntu-20.04
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Clone repository
uses: actions/checkout@v4
- name: Configure workflow
env:
pull_request_title: ${{ github.event.pull_request.title }}
SENTRY_SERVER_MU4_KEY: ${{ secrets.SENTRY_SERVER_MU4_KEY }}
SENTRY_SERVER_SANDBOX_KEY: ${{ secrets.SENTRY_SERVER_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)
bash ./buildscripts/ci/tools/make_build_number.sh
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_SERVER_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.org/api/4/minidump/?sentry_key=$SENTRY_SERVER_MU4_KEY
fi
fi
if [ -z "$SENTRY_PROJECT" ] && [ "$BUILD_MODE" == "nightly" ]; then
SENTRY_PROJECT="sandbox"
fi
if [ "$SENTRY_PROJECT" == "sandbox" ] && [ "$SENTRY_SERVER_SANDBOX_KEY" != "" ]; then
DO_UPLOAD_SYMBOLS='true'
SENTRY_URL=https://sentry.musescore.org/api/3/minidump/?sentry_key=$SENTRY_SERVER_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}_Lin${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
echo "CCACHE_TIMESTAMP=$(date -u +"%F-%T")" | tee -a $GITHUB_ENV
- name: Restore ccache files
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/.ccache
key: ${{github.workflow}}-ccache-${{ env.CCACHE_TIMESTAMP }}
restore-keys: ${{github.workflow}}-ccache-
- name: Setup ccache
run: |
sudo apt-get update && sudo apt-get install -y ccache
bash ./buildscripts/ci/tools/setup_ccache_config.sh
- name: Setup environment
run: |
bash ./buildscripts/ci/linux/setup.sh
- name: Generate _en.ts files
env:
LUPDATE_ARGS: ""
POSTPROCESS_ARGS: ${{ env.DO_PLACEHOLDER_TRANSLATIONS == 'true' && '--generate-placeholder-translations' || '' }}
run: |
bash ./buildscripts/ci/translation/run_lupdate.sh
- name: Update .ts files
if: env.DO_UPDATE_TS == 'true'
run: |
bash ./buildscripts/ci/translation/tx_install.sh -t ${{ secrets.TRANSIFEX_API_TOKEN }} -s linux
bash ./buildscripts/ci/translation/tx_pull.sh
- name: Build
run: |
C_URL=${SENTRY_URL}; if [ -z "$C_URL" ]; then C_URL="''"; fi
bash ./buildscripts/ci/linux/build.sh -n ${{ env.BUILD_NUMBER }} --crash_log_url $C_URL
echo "============== ccache ==============="
ccache -s
- name: Package
run: |
bash ./buildscripts/ci/linux/package.sh
- name: Checksum
run: |
bash ./buildscripts/ci/tools/checksum.sh
- name: Generate and upload dump symbols
if: env.DO_UPLOAD_SYMBOLS == 'true'
run: |
APP_BIN=$(find "$(pwd)/build.release/src/app/" -type f -name "mscore4portable*" -print -quit)
ARCH=x86-64
cmake -DAPP_BIN=${APP_BIN} \
-DARCH=${ARCH} \
-DSENTRY_URL=https://sentry.musescore.org \
-DSENTRY_ORG=musescore \
-DSENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }} \
-DSENTRY_PROJECT=${SENTRY_PROJECT} \
-P buildscripts/ci/crashdumps/ci_generate_and_upload.cmake
- name: Publish to OSUOSL
if: env.DO_PUBLISH == 'true'
run: |
bash ./buildscripts/ci/tools/osuosl/publish.sh -s ${{ secrets.OSUOSL_SSH_ENCRYPT_SECRET }} --os linux -v 4
- name: Upload artifacts on GitHub
uses: actions/upload-artifact@v4
with:
name: ${{ env.UPLOAD_ARTIFACT_NAME }}
path: ./build.artifacts/