Skip to content

Added wasm workflow to CI #28308

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 92 additions & 0 deletions .github/workflows/build_wasm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: 'Build: Wasm'

on:
# pull_request: At the moment disabled for pull_request
workflow_dispatch:
inputs:
build_mode:
description: 'Build mode: devel, nightly, testing, stable'
default: 'devel'
required: true
workflow_call:
inputs:
build_mode:
description: 'Build mode: devel, nightly, testing, stable'
default: 'devel'
type: string
required: true

jobs:
build:
runs-on: ubuntu-24.04
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
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)

bash ./buildscripts/ci/tools/make_build_number.sh
BUILD_NUMBER=$(cat ./build.artifacts/env/build_number.env)

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}_Wasm${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 "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: wasm-ccache-${{ env.CCACHE_TIMESTAMP }}
restore-keys: wasm-ccache-
- name: Setup ccache
run: |
sudo apt-get update && sudo apt-get install -y ccache
bash ./buildscripts/ci/tools/setup_ccache_config.sh

- name: Register gcc problem matcher
run: echo "::add-matcher::.github/problem_matchers/gcc.json"

- name: Install Qt
uses: jurplel/install-qt-action@v4
with:
version: '6.9.1'
host: all_os
target: 'wasm'
arch: wasm_singlethread
modules: 'qt5compat qtscxml qtshadertools'

- name: Setup environment
run: |
bash ./buildscripts/ci/linux/setup.sh --arch wasm
- name: Build
env:
CMAKE_PREFIX_PATH: ${{env.QT_ROOT_DIR}}
run: |
bash ./buildscripts/ci/wasm/build.sh -n ${{ env.BUILD_NUMBER }}
echo "============== ccache ==============="
ccache -sv
- name: Package
run: |
bash ./buildscripts/ci/wasm/package.sh
- name: Upload artifacts on GitHub
uses: actions/upload-artifact@v4
with:
name: ${{ env.UPLOAD_ARTIFACT_NAME }}
path: ./build.artifacts/
1 change: 1 addition & 0 deletions .github/workflows/build_without_qt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: 'Build: Without Qt'

on:
pull_request:
workflow_dispatch:

jobs:
run_tests:
Expand Down
1 change: 1 addition & 0 deletions buildscripts/ci/linux/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ df -h .
BUILD_TOOLS=$HOME/build_tools
ARTIFACTS_DIR=build.artifacts
CRASH_REPORT_URL=""
BUILD_NUMBER=""
BUILD_MODE=""
SUFFIX="" # appended to `mscore` command name to avoid conflicts (e.g. `mscoredev`)

Expand Down
18 changes: 15 additions & 3 deletions buildscripts/ci/linux/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ df -h .

BUILD_TOOLS=$HOME/build_tools
ENV_FILE=$BUILD_TOOLS/environment.sh
PACKARCH="x86_64" # x86_64, armv7l, aarch64
PACKARCH="x86_64" # x86_64, armv7l, aarch64, wasm
COMPILER="gcc" # gcc, clang
EMSDK_VERSION="3.1.70" # for Qt 6.9

while [[ "$#" -gt 0 ]]; do
case $1 in
Expand Down Expand Up @@ -164,7 +165,7 @@ fi
# CMAKE
# Get newer CMake (only used cached version if it is the same)
case "$PACKARCH" in
x86_64)
x86_64 | wasm)
cmake_version="3.24.0"
cmake_dir="$BUILD_TOOLS/cmake/${cmake_version}"
if [[ ! -d "$cmake_dir" ]]; then
Expand All @@ -183,7 +184,7 @@ cmake --version

# Ninja
case "$PACKARCH" in
x86_64)
x86_64 | wasm)
echo "Get Ninja"
ninja_dir=$BUILD_TOOLS/Ninja
if [[ ! -d "$ninja_dir" ]]; then
Expand All @@ -201,6 +202,17 @@ esac
echo "ninja version"
ninja --version

if [[ "$PACKARCH" == "wasm" ]]; then
git clone https://github.com/emscripten-core/emsdk.git $BUILD_TOOLS/emsdk
origin_dir=$(pwd)
cd $BUILD_TOOLS/emsdk
git pull
./emsdk install $EMSDK_VERSION
./emsdk activate $EMSDK_VERSION
echo "source $BUILD_TOOLS/emsdk/emsdk_env.sh" >> ${ENV_FILE}
cd $origin_dir
fi

##########################################################################
# POST INSTALL
##########################################################################
Expand Down
78 changes: 78 additions & 0 deletions buildscripts/ci/wasm/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: GPL-3.0-only
# MuseScore-Studio-CLA-applies
#
# MuseScore Studio
# Music Composition & Notation
#
# Copyright (C) 2025 MuseScore Limited
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.

trap 'echo Build failed; exit 1' ERR

BUILD_TOOLS=$HOME/build_tools
ARTIFACTS_DIR=build.artifacts
BUILD_DIR=build.release
BUILD_NUMBER=""
BUILD_MODE=""

while [[ "$#" -gt 0 ]]; do
case $1 in
-n|--number) BUILD_NUMBER="$2"; shift ;;
--build_mode) BUILD_MODE="$2"; shift ;;
*) echo "Unknown parameter passed: $1"; exit 1 ;;
esac
shift
done

if [ -z "$BUILD_NUMBER" ]; then echo "error: not set BUILD_NUMBER"; exit 1; fi
if [ -z "$BUILD_MODE" ]; then BUILD_MODE=$(cat $ARTIFACTS_DIR/env/build_mode.env); fi

MUSE_APP_BUILD_MODE=dev

case "${BUILD_MODE}" in
"devel") MUSE_APP_BUILD_MODE=dev; SUFFIX=dev;;
"nightly") MUSE_APP_BUILD_MODE=dev; SUFFIX=nightly;;
"testing") MUSE_APP_BUILD_MODE=testing; SUFFIX=testing;;
"stable") MUSE_APP_BUILD_MODE=release; SUFFIX="";;
esac

echo "MUSE_APP_BUILD_MODE: $MUSE_APP_BUILD_MODE"
echo "BUILD_MODE: $BUILD_MODE"
echo "BUILD_NUMBER: $BUILD_NUMBER"

echo "=== ENVIRONMENT === "

cat $BUILD_TOOLS/environment.sh
source $BUILD_TOOLS/environment.sh

export CMAKE_TOOLCHAIN_FILE=${QT_ROOT_DIR}/lib/cmake/Qt6/qt.toolchain.cmake

# =========== Build =======================
echo "=== BUILD ==="

MUSESCORE_REVISION=$(git rev-parse --short=7 HEAD)

# Build portable AppImage
MUSE_APP_BUILD_MODE=$MUSE_APP_BUILD_MODE \
MUSESCORE_BUILD_CONFIGURATION="app-web" \
MUSESCORE_BUILD_NUMBER=$BUILD_NUMBER \
MUSESCORE_REVISION=$MUSESCORE_REVISION \
bash ./ninja_build.sh -t release

bash ./buildscripts/ci/tools/make_release_channel_env.sh -c $MUSE_APP_BUILD_MODE
bash ./buildscripts/ci/tools/make_version_env.sh $BUILD_NUMBER
bash ./buildscripts/ci/tools/make_revision_env.sh $MUSESCORE_REVISION
bash ./buildscripts/ci/tools/make_branch_env.sh

28 changes: 28 additions & 0 deletions buildscripts/ci/wasm/package.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash
# SPDX-License-Identifier: GPL-3.0-only
# MuseScore-Studio-CLA-applies
#
# MuseScore Studio
# Music Composition & Notation
#
# Copyright (C) 2025 MuseScore Limited
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
echo "Package MuseScore Wasm"
trap 'echo Package failed; exit 1' ERR

BUILD_TOOLS=$HOME/build_tools
ARTIFACTS_DIR=build.artifacts
BUILD_DIR=build.release

cp -r $BUILD_DIR/public_html $ARTIFACTS_DIR/public_html
7 changes: 5 additions & 2 deletions src/appshell_web/internal/applicationuiactions.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,18 @@
#define MU_APPSHELL_APPLICATIONUIACTIONS_H

#include "ui/iuiactionsmodule.h"
#include "applicationactioncontroller.h"

#include "global/async/asyncable.h"

#include "modularity/ioc.h"
#include "async/asyncable.h"
#include "ui/imainwindow.h"
#include "braille/ibrailleconfiguration.h"
#include "notation/inotationconfiguration.h"
#include "dockwindow/idockwindowprovider.h"
#include "../iappshellconfiguration.h"

#include "../appshelltypes.h"
#include "applicationactioncontroller.h"

namespace mu::appshell {
class ApplicationUiActions : public muse::ui::IUiActionsModule, public muse::Injectable, public muse::async::Asyncable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ void DiagnosticAccessibleModel::init()
#endif
}

#ifdef MUSE_MODULE_ACCESSIBILITY
static void debug_dumpItem(QAccessibleInterface* item, QTextStream& stream, QString& level)
{
QAccessibleInterface* prn = item->parent();
Expand Down Expand Up @@ -87,7 +88,6 @@ static void debug_dumpItem(QAccessibleInterface* item, QTextStream& stream, QStr
level.chop(2);
}

#ifdef MUSE_MODULE_ACCESSIBILITY
static void debug_dumpTree(QAccessibleInterface* item)
{
QString str;
Expand Down
Loading