Skip to content

Commit c949f8b

Browse files
mikekirinEism
andauthored
backend arm (#31126)
Co-authored-by: Eism <[email protected]>
1 parent 78af601 commit c949f8b

File tree

8 files changed

+191
-96
lines changed

8 files changed

+191
-96
lines changed

.github/workflows/build_backend.yml

Lines changed: 116 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ on:
66

77
workflow_dispatch:
88
inputs:
9+
platforms:
10+
description: 'Platforms to build:'
11+
default: 'linux_x64 linux_arm64'
12+
required: true
913
build_mode:
1014
description: 'Build mode: devel, testing, stable'
1115
default: 'devel'
@@ -24,6 +28,11 @@ on:
2428
required: false
2529
workflow_call:
2630
inputs:
31+
platforms:
32+
description: 'Platforms to build:'
33+
default: 'linux_x64 linux_arm64'
34+
type: string
35+
required: true
2736
build_mode:
2837
description: 'Build mode: devel, nightly, testing, stable'
2938
default: 'devel'
@@ -50,93 +59,115 @@ env:
5059

5160
jobs:
5261
backend:
53-
runs-on: ubuntu-22.04
5462
if: github.event_name != 'schedule' || github.repository == 'musescore/MuseScore'
63+
runs-on: ${{ matrix.runs-on }}
64+
strategy:
65+
fail-fast: false
66+
matrix:
67+
platform: ${{
68+
(github.event_name != 'workflow_dispatch'
69+
|| (contains(inputs.platforms, 'linux_x64') && contains(inputs.platforms, 'linux_arm64')))
70+
&& fromJson('["linux_x64","linux_arm64"]')
71+
|| (contains(inputs.platforms, 'linux_x64') && fromJson('["linux_x64"]')
72+
|| (contains(inputs.platforms, 'linux_arm64') && fromJson('["linux_arm64"]')
73+
|| fromJson('[]')))
74+
}}
75+
include:
76+
- platform: linux_arm64
77+
arch: aarch64
78+
runs-on: ubuntu-24.04-arm
79+
qt-host: linux_arm64
80+
qt-arch: linux_gcc_arm64
5581
steps:
56-
- name: Cancel Previous Runs
57-
uses: styfle/[email protected]
58-
with:
59-
access_token: ${{ github.token }}
60-
- name: Clone repository
61-
uses: actions/checkout@v4
82+
- name: Cancel Previous Runs
83+
uses: styfle/[email protected]
84+
with:
85+
access_token: ${{ github.token }}
86+
- name: Clone repository
87+
uses: actions/checkout@v5
6288

6389
- name: "Configure workflow"
64-
run: |
65-
bash ./buildscripts/ci/tools/make_build_mode_env.sh -e ${{ github.event_name }} -m ${{ inputs.build_mode }}
66-
BUILD_MODE=$(cat ./build.artifacts/env/build_mode.env)
67-
68-
bash ./buildscripts/ci/tools/make_build_number.sh
69-
BUILD_NUMBER=$(cat ./build.artifacts/env/build_number.env)
70-
71-
DO_PUBLISH='false'
72-
if [ "${{ inputs.publish }}" = "on" ]; then
73-
DO_PUBLISH='true';
74-
if [ -z "${{ secrets.S3_KEY_CONVERTER }}" ]; then
75-
echo "::warning::S3_KEY_CONVERTER is empty; publishing to S3 disabled"
76-
DO_PUBLISH='false'
90+
run: |
91+
bash ./buildscripts/ci/tools/make_build_mode_env.sh -e ${{ github.event_name }} -m ${{ inputs.build_mode }}
92+
BUILD_MODE=$(cat ./build.artifacts/env/build_mode.env)
93+
94+
if [ -n "${{ inputs.build_number }}" ]; then
95+
BUILD_NUMBER="${{ inputs.build_number }}"
96+
bash ./buildscripts/ci/tools/make_build_number.sh "$BUILD_NUMBER"
97+
else
98+
bash ./buildscripts/ci/tools/make_build_number.sh
7799
fi
78-
if [ -z "${{ secrets.S3_SECRET_CONVERTER }}" ]; then
79-
echo "::warning::S3_SECRET_CONVERTER is empty; publishing to S3 disabled"
80-
DO_PUBLISH='false'
100+
BUILD_NUMBER=$(cat ./build.artifacts/env/build_number.env)
101+
102+
DO_PUBLISH='false'
103+
if [ "${{ inputs.publish }}" = "on" ]; then
104+
DO_PUBLISH='true';
105+
if [ -z "${{ secrets.S3_KEY_CONVERTER }}" ]; then
106+
echo "::warning::S3_KEY_CONVERTER is empty; publishing to S3 disabled"
107+
DO_PUBLISH='false'
108+
fi
109+
if [ -z "${{ secrets.S3_SECRET_CONVERTER }}" ]; then
110+
echo "::warning::S3_SECRET_CONVERTER is empty; publishing to S3 disabled"
111+
DO_PUBLISH='false'
112+
fi
81113
fi
82-
fi
83-
84-
DO_DEPLOY='false'
85-
if [ "${{ inputs.deploy }}" = "on" ]; then
86-
DO_DEPLOY='true'
87-
fi
88-
89-
bash ./buildscripts/ci/tools/make_version_env.sh $BUILD_NUMBER
90-
VERSION=$(cat ./build.artifacts/env/build_version.env)
91-
GITHUB_ARTIFACT_NAME="MuseScore-${VERSION}"
92-
93-
VERSION_MAJOR_MINOR=$(echo "$VERSION" | cut -d '.' -f 1,2)
94-
95-
echo "github.repository: ${{ github.repository }}"
96-
echo "BUILD_MODE=$BUILD_MODE" | tee -a $GITHUB_ENV
97-
echo "BUILD_NUMBER=$BUILD_NUMBER" | tee -a $GITHUB_ENV
98-
echo "DO_PUBLISH=$DO_PUBLISH" | tee -a $GITHUB_ENV
99-
echo "DO_DEPLOY=$DO_DEPLOY" | tee -a $GITHUB_ENV
100-
echo "VERSION=$VERSION" | tee -a $GITHUB_ENV
101-
echo "VERSION_MAJOR_MINOR=$VERSION_MAJOR_MINOR" | tee -a $GITHUB_ENV
102-
echo "GITHUB_ARTIFACT_NAME=$GITHUB_ARTIFACT_NAME" | tee -a $GITHUB_ENV
103-
104-
- name: Install Qt
105-
uses: jurplel/install-qt-action@v4
106-
with:
107-
version: ${{ env.USE_QT69 == 'on' && '6.9.2' || '6.2.4' }}
108-
host: 'linux'
109-
target: 'desktop'
110-
arch: ${{ env.USE_QT69 == 'on' && 'linux_gcc_64' || 'gcc_64' }}
111-
modules: 'qt5compat qtnetworkauth qtscxml qtshadertools qtwebsockets'
112-
113-
- name: Setup environment
114-
run: |
115-
bash ./buildscripts/ci/backend/setup.sh
116-
117-
- name: Build
118-
run: |
119-
bash ./buildscripts/ci/backend/build.sh -n ${{ env.BUILD_NUMBER }} --build_videoexport
120-
121-
- name: Package
122-
run: |
123-
bash ./buildscripts/ci/backend/package.sh
124-
125-
- name: Send package to S3
126-
if: env.DO_PUBLISH == 'true'
127-
run: |
128-
bash ./buildscripts/ci/backend/publish_to_s3.sh \
129-
--s3_key ${{ secrets.S3_KEY_CONVERTER }} \
130-
--s3_secret ${{ secrets.S3_SECRET_CONVERTER }}
131114
132-
- name: Build Docker (used package from S3)
133-
if: env.DO_PUBLISH == 'true'
134-
run: |
135-
bash ./buildscripts/ci/backend/build_docker.sh
115+
DO_DEPLOY='false'
116+
if [ "${{ inputs.deploy }}" = "on" ]; then
117+
DO_DEPLOY='true'
118+
fi
136119
137-
- name: Publish to Registry
138-
if: env.DO_PUBLISH == 'true'
139-
run: |
120+
bash ./buildscripts/ci/tools/make_version_env.sh $BUILD_NUMBER
121+
VERSION=$(cat ./build.artifacts/env/build_version.env)
122+
GITHUB_ARTIFACT_NAME="MuseScore-${VERSION}_${{ matrix.arch }}"
123+
124+
VERSION_MAJOR_MINOR=$(echo "$VERSION" | cut -d '.' -f 1,2)
125+
126+
echo "github.repository: ${{ github.repository }}"
127+
echo "BUILD_MODE=$BUILD_MODE" | tee -a $GITHUB_ENV
128+
echo "BUILD_NUMBER=$BUILD_NUMBER" | tee -a $GITHUB_ENV
129+
echo "DO_PUBLISH=$DO_PUBLISH" | tee -a $GITHUB_ENV
130+
echo "DO_DEPLOY=$DO_DEPLOY" | tee -a $GITHUB_ENV
131+
echo "VERSION=$VERSION" | tee -a $GITHUB_ENV
132+
echo "VERSION_MAJOR_MINOR=$VERSION_MAJOR_MINOR" | tee -a $GITHUB_ENV
133+
echo "GITHUB_ARTIFACT_NAME=$GITHUB_ARTIFACT_NAME" | tee -a $GITHUB_ENV
134+
135+
- name: Install Qt
136+
uses: jurplel/install-qt-action@v4
137+
with:
138+
version: 6.10.0
139+
host: ${{ matrix.qt-host }}
140+
target: 'desktop'
141+
arch: ${{ matrix.qt-arch }}
142+
modules: 'qt5compat qtnetworkauth qtscxml qtshadertools qtwebsockets'
143+
144+
- name: Setup environment
145+
run: |
146+
bash ./buildscripts/ci/backend/setup.sh --arch ${{ matrix.arch }}
147+
148+
- name: Build
149+
run: |
150+
bash ./buildscripts/ci/backend/build.sh -n ${{ env.BUILD_NUMBER }} --build_videoexport
151+
152+
- name: Package
153+
run: |
154+
bash ./buildscripts/ci/backend/package.sh --arch ${{ matrix.arch }}
155+
156+
- name: Send package to S3
157+
if: env.DO_PUBLISH == 'true'
158+
run: |
159+
bash ./buildscripts/ci/backend/publish_to_s3.sh \
160+
--s3_key ${{ secrets.S3_KEY_CONVERTER }} \
161+
--s3_secret ${{ secrets.S3_SECRET_CONVERTER }}
162+
163+
- name: Build Docker (used package from S3)
164+
if: env.DO_PUBLISH == 'true'
165+
run: |
166+
bash ./buildscripts/ci/backend/build_docker.sh --arch ${{ matrix.arch }}
167+
168+
- name: Publish to Registry
169+
if: env.DO_PUBLISH == 'true'
170+
run: |
140171
bash ./buildscripts/ci/backend/publish_to_registry.sh --token ${{ secrets.PACKAGES_PAT }}
141172

142173
- name: Deploy to musescore.com
@@ -149,12 +180,9 @@ jobs:
149180
--mu_version ${{ env.VERSION }} \
150181
--mu_version_major_minor ${{ env.VERSION_MAJOR_MINOR }}
151182
152-
pip install jenkinsapi
153-
python3 ./buildscripts/ci/backend/deploy.py --mu_version ${{ env.VERSION_MAJOR_MINOR }} --api_token ${{ secrets.JENKINS_API_TOKEN }}
154-
155-
- name: Upload artifacts on GitHub
156-
if: ${{ always() }}
157-
uses: actions/upload-artifact@v4
158-
with:
159-
name: ${{ env.GITHUB_ARTIFACT_NAME }}
160-
path: ./build.artifacts/
183+
- name: Upload artifacts on GitHub
184+
if: ${{ always() }}
185+
uses: actions/upload-artifact@v5
186+
with:
187+
name: ${{ env.GITHUB_ARTIFACT_NAME }}
188+
path: ./build.artifacts/

buildscripts/ci/backend/build_docker.sh

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,28 @@ ORIGIN_DIR=${PWD}
2525
ARTIFACTS_DIR=build.artifacts
2626
DOCKER_WORK_DIR=$ARTIFACTS_DIR/docker
2727
MU_VERSION=""
28+
PACKARCH="" # architecture (x86_64, aarch64, armv7l)
2829

2930
while [[ "$#" -gt 0 ]]; do
3031
case $1 in
3132
-v|--version) MU_VERSION="$2"; shift ;;
33+
--arch) PACKARCH="$2"; shift ;;
3234
*) echo "Unknown parameter passed: $1"; exit 1 ;;
3335
esac
3436
shift
3537
done
3638

39+
if [ -z "$PACKARCH" ]; then
40+
PACKARCH="x86_64"
41+
fi
42+
43+
case "$PACKARCH" in
44+
aarch64|arm64) DOCKER_PLATFORM="linux/arm64" ;;
45+
x86_64|amd64) DOCKER_PLATFORM="linux/amd64" ;;
46+
armv7l|armhf) DOCKER_PLATFORM="linux/arm/v7" ;;
47+
*) echo "Unknown architecture: $PACKARCH"; exit 1 ;;
48+
esac
49+
3750
if [ -z "$MU_VERSION" ]; then MU_VERSION=$(cat $ARTIFACTS_DIR/env/build_version.env); fi
3851

3952
if [ -z "$MU_VERSION" ]; then echo "Error: Version not set"; exit 1; fi
@@ -51,7 +64,15 @@ sed -i 's|x.x.x.xxxxxx|'${MU_VERSION}'|' $DOCKER_WORK_DIR/install_mu.sh
5164

5265
cd $DOCKER_WORK_DIR
5366
echo "Build Docker"
54-
docker build -t ghcr.io/musescore/converter_4:${MU_VERSION} .
67+
68+
# Enable buildx
69+
docker buildx create --use >/dev/null 2>&1 || true
70+
71+
docker buildx build \
72+
--platform ${DOCKER_PLATFORM} \
73+
-t ghcr.io/musescore/converter_4:${MU_VERSION} \
74+
--load .
75+
5576
cd $ORIGIN_DIR
5677

5778
echo "Done!!"

buildscripts/ci/backend/docker/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM library/ubuntu:22.04
1+
FROM library/ubuntu:24.04
22
ENV TZ=Etc/UTC DEBIAN_FRONTEND=noninteractive
33
COPY setup.sh /setup.sh
44
COPY install_mu.sh /install_mu.sh

buildscripts/ci/backend/docker/install_mu_template.sh

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,22 @@ MU_VERSION=x.x.x.xxxxxx
77
mkdir -p $MU_DIR
88

99
echo "=== Install MuseScore ${MU_VERSION} ==="
10+
echo "=== old"
11+
7zz i | head -5
12+
13+
apt-get remove -y p7zip p7zip-full
14+
apt-get install -y --no-install-recommends 7zip xz-utils
15+
16+
wget https://www.7-zip.org/a/7z2407-linux-arm64.tar.xz -O /tmp/7z.tar.xz
17+
mkdir -p /opt/7zip
18+
tar -xf /tmp/7z.tar.xz -C /opt/7zip
19+
ln -sf /opt/7zip/7zz /usr/local/bin/7zz
20+
21+
echo "=== new"
22+
7zz i | head -5
23+
1024
MU_DISTRO=MuseScore-${MU_VERSION}
1125
wget --show-progress -O $MU_DIR/$MU_DISTRO.7z "$S3_URL/$MU_DISTRO.7z"
12-
7z x -y $MU_DIR/$MU_DISTRO.7z -o"$MU_DIR/"
26+
7zz x -y $MU_DIR/$MU_DISTRO.7z -o"$MU_DIR/"
1327
$MU_DIR/convertor -v
1428

buildscripts/ci/backend/docker/setup.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
apt_packages_basic=(
2727
file
2828
software-properties-common
29-
p7zip-full
29+
7zip
3030
unzip
3131
)
3232

@@ -51,7 +51,7 @@ apt_packages_runtime=(
5151
libcups2
5252
libdbus-1-3
5353
libegl1-mesa-dev
54-
libodbc1
54+
libodbc2
5555
libpq-dev
5656
libxcomposite-dev
5757
libxcursor-dev
@@ -103,7 +103,7 @@ cd fonts-main
103103

104104
echo "Installing Google Fonts..."
105105
mkdir -p "$FONTS_DIR"
106-
find . -type f \( -iname "*.ttf" -o -iname "*.otf" \) -print0 | xargs -0 -r mv -n -t "$FONTS_DIR"
106+
find . -type f \( -iname "*.ttf" -o -iname "*.otf" \) -print0 | xargs -0 -r mv -n -t "$FONTS_DIR" || true
107107

108108
echo "Installing Fonts Cache..."
109109
fc-cache -f -v

buildscripts/ci/backend/package.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ while [[ "$#" -gt 0 ]]; do
3333
case $1 in
3434
--build_mode) BUILD_MODE="$2"; shift ;;
3535
-v|--version) BUILD_VERSION="$2"; shift ;;
36+
--arch) PACKARCH="$2"; shift ;;
3637
*) echo "Unknown parameter passed: $1"; exit 1 ;;
3738
esac
3839
shift
@@ -46,12 +47,14 @@ if [ -z "$BUILD_VERSION" ]; then BUILD_VERSION=$(cat $ARTIFACTS_DIR/env/build_ve
4647
if [ -z "$BUILD_MODE" ]; then echo "error: not set BUILD_MODE"; exit 1; fi
4748
if [ -z "$BUILD_VERSION" ]; then echo "error: not set BUILD_VERSION"; exit 1; fi
4849

50+
if [ -z "$PACKARCH" ]; then PACKARCH="x86_64"; fi
4951

5052
MAJOR_VERSION="${BUILD_VERSION%%.*}"
5153

5254
echo "BUILD_MODE: $BUILD_MODE"
5355
echo "BUILD_VERSION: $BUILD_VERSION"
5456
echo "MAJOR_VERSION: $MAJOR_VERSION"
57+
echo "PACKARCH: $PACKARCH"
5558
echo "INSTALL_DIR: $INSTALL_DIR"
5659

5760
# Constants
@@ -63,7 +66,7 @@ APP_IMAGE_NAME=MuseScoreTemporary
6366
ARTIFACT_NAME=MuseScore-${BUILD_VERSION}
6467

6568
# Make AppImage
66-
bash ./buildscripts/ci/linux/tools/make_appimage.sh "${INSTALL_DIR}" "${APP_IMAGE_NAME}.AppImage"
69+
bash ./buildscripts/ci/linux/tools/make_appimage.sh "${INSTALL_DIR}" "${APP_IMAGE_NAME}.AppImage" "${PACKARCH}"
6770
mv "${INSTALL_DIR}/../${APP_IMAGE_NAME}.AppImage" "${ARTIFACTS_DIR}/"
6871

6972
cd $ARTIFACTS_DIR

buildscripts/ci/backend/setup.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@
2020
# along with this program. If not, see <https://www.gnu.org/licenses/>.
2121

2222
HERE="$(cd "$(dirname "$0")" && pwd)"
23-
bash $HERE/../linux/setup.sh
23+
bash $HERE/../linux/setup.sh "$@"

0 commit comments

Comments
 (0)