Skip to content

Commit 9041969

Browse files
committed
backend arm
1 parent 8379df9 commit 9041969

File tree

8 files changed

+191
-98
lines changed

8 files changed

+191
-98
lines changed

.github/workflows/build_backend.yml

Lines changed: 116 additions & 90 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'
@@ -20,6 +24,11 @@ on:
2024
required: false
2125
workflow_call:
2226
inputs:
27+
platforms:
28+
description: 'Platforms to build:'
29+
default: 'linux_x64 linux_arm64'
30+
type: string
31+
required: true
2332
build_mode:
2433
description: 'Build mode: devel, nightly, testing, stable'
2534
default: 'devel'
@@ -43,98 +52,115 @@ on:
4352

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

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

140166
- name: Check and update config on S3
@@ -148,9 +174,9 @@ jobs:
148174
--mu_version ${{ env.VERSION }} \
149175
--mu_version_major_minor ${{ env.VERSION_MAJOR_MINOR }}
150176
151-
- name: Upload artifacts on GitHub
152-
if: ${{ always() }}
153-
uses: actions/upload-artifact@v5
154-
with:
155-
name: ${{ env.GITHUB_ARTIFACT_NAME }}
156-
path: ./build.artifacts/
177+
- name: Upload artifacts on GitHub
178+
if: ${{ always() }}
179+
uses: actions/upload-artifact@v5
180+
with:
181+
name: ${{ env.GITHUB_ARTIFACT_NAME }}
182+
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)