Skip to content

CI_Windows

CI_Windows #1525

name: CI_Windows
on:
pull_request:
branches:
- master
schedule:
- cron: '0 3 */1 */1 *' # At 03:00 on every day-of-month for master
- cron: '0 5 */1 */1 *' # At 05:00 on every day-of-month for current release branch
workflow_dispatch:
inputs:
build_mode:
description: 'Build mode: devel_build, nightly_build, testing_build, stable_build'
required: true
default: 'devel_build'
publish:
description: 'Publish to FTP: on - publish'
required: false
default: 'off'
sentry_project:
description: 'Upload symbols and dumps to Sentry (choose a project): mu4(default for stable build), sandbox'
required: false
default: ''
env:
CURRENT_RELEASE_BRANCH: 4.2.1
jobs:
build_mu4_x64:
runs-on: windows-2022
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Clone repository (default)
uses: actions/checkout@v4
if: ${{ github.event_name != 'schedule' || github.event.schedule == '0 3 */1 */1 *' }}
with:
fetch-depth: 3
- name: Clone repository (${{ env.CURRENT_RELEASE_BRANCH }})
uses: actions/checkout@v4
if: ${{ github.event_name == 'schedule' && github.event.schedule == '0 5 */1 */1 *' }}
with:
fetch-depth: 3
ref: ${{ env.CURRENT_RELEASE_BRANCH }}
- name: Fetch submodules
run: |
git submodule update --init --recursive
- name: "Configure workflow"
shell: bash
env:
pull_request_title: ${{ github.event.pull_request.title }}
run: |
bash ./build/ci/tools/make_build_mode_env.sh -e ${{ github.event_name }} -m ${{ github.event.inputs.build_mode }}
BUILD_MODE=$(cat ./build.artifacts/env/build_mode.env)
bash ./build/ci/tools/make_build_number.sh
BUILD_NUMBER=$(cat ./build.artifacts/env/build_number.env)
DO_PUBLISH='false'
if [[ "${{ github.event.inputs.publish }}" == "on" || "$BUILD_MODE" == "nightly_build" ]]; then
DO_PUBLISH='true'
if [ -z "${{ secrets.OSUOSL_SSH_ENCRYPT_SECRET }}" ]; then
echo "warning: not set OSUOSL_SSH_ENCRYPT_SECRET, publish disabled"
DO_PUBLISH='false'
fi
fi
DO_BUILD='true'
if [ "$BUILD_MODE" == "nightly_build" ]; then
if [ "${{ github.repository }}" != "musescore/MuseScore" ]; then
DO_BUILD='false'
fi
fi
DO_UPDATE_TS='false'
if [[ "$BUILD_MODE" == "testing_build" || "$BUILD_MODE" == "stable_build" ]]; then
DO_UPDATE_TS='true'
if [ -z "${{ secrets.TRANSIFEX_API_TOKEN }}" ]; then
echo "warning: not set TRANSIFEX_API_TOKEN, update .ts disabled"
DO_UPDATE_TS='false'
fi
fi
DO_PLACEHOLDER_TRANSLATIONS='false'
if [[ "$DO_BUILD" == "true" ]]; then
if [[ "$BUILD_MODE" == "nightly_build" || "$BUILD_MODE" == "devel_build" ]]; then
DO_PLACEHOLDER_TRANSLATIONS='true'
fi
fi
DO_UPLOAD_SYMBOLS='false'
SENTRY_PROJECT=${{ github.event.inputs.sentry_project }}
SENTRY_URL=""
if [ ${{ secrets.SENTRY_SERVER_MU4_KEY }} != 0 ]; then
if [ -z "$SENTRY_PROJECT" ] && [ "$BUILD_MODE" == "stable_build" ]; 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=${{ secrets.SENTRY_SERVER_MU4_KEY }}
fi
fi
if [ "$SENTRY_PROJECT" == "sandbox" ] && [ ${{ secrets.SENTRY_SERVER_SANDBOX_KEY }} != 0 ]; then
DO_UPLOAD_SYMBOLS='true'
SENTRY_URL=https://sentry.musescore.org/api/3/minidump/?sentry_key=${{ secrets.SENTRY_SERVER_SANDBOX_KEY }}
fi
if [ $DO_BUILD == 'false' ]; then
DO_PUBLISH='false'
DO_UPDATE_TS='false'
DO_PLACEHOLDER_TRANSLATIONS='false'
DO_UPLOAD_SYMBOLS='false'
fi
ADD_INFO="_${GITHUB_REF#refs/heads/}"
if [ "${{ github.event_name }}" == "schedule" ] && [ "${{ github.event.schedule }}" == "0 5 */1 */1 *" ]; then ADD_INFO="_${CURRENT_RELEASE_BRANCH}"; fi
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" >> $GITHUB_ENV
echo "BUILD_MODE: $BUILD_MODE"
echo "BUILD_NUMBER=$BUILD_NUMBER" >> $GITHUB_ENV
echo "BUILD_NUMBER: $BUILD_NUMBER"
echo "DO_BUILD=$DO_BUILD" >> $GITHUB_ENV
echo "DO_BUILD: $DO_BUILD"
echo "DO_UPDATE_TS=$DO_UPDATE_TS" >> $GITHUB_ENV
echo "DO_UPDATE_TS: $DO_UPDATE_TS"
echo "DO_PLACEHOLDER_TRANSLATIONS=$DO_PLACEHOLDER_TRANSLATIONS" >> $GITHUB_ENV
echo "DO_PLACEHOLDER_TRANSLATIONS: $DO_PLACEHOLDER_TRANSLATIONS"
echo "DO_PUBLISH=$DO_PUBLISH" >> $GITHUB_ENV
echo "DO_PUBLISH: $DO_PUBLISH"
echo "DO_UPLOAD_SYMBOLS=$DO_UPLOAD_SYMBOLS" >> $GITHUB_ENV
echo "DO_UPLOAD_SYMBOLS: $DO_UPLOAD_SYMBOLS"
echo "SENTRY_PROJECT=$SENTRY_PROJECT" >> $GITHUB_ENV
echo "SENTRY_PROJECT: $SENTRY_PROJECT"
echo "SENTRY_URL=$SENTRY_URL" >> $GITHUB_ENV
echo "SENTRY_URL: $SENTRY_URL"
echo "UPLOAD_ARTIFACT_NAME=$UPLOAD_ARTIFACT_NAME" >> $GITHUB_ENV
echo "UPLOAD_ARTIFACT_NAME: $UPLOAD_ARTIFACT_NAME"
- name: Setup environment
if: env.DO_BUILD == 'true'
run: |
build\ci\windows\setup.bat
- name: Make environment file
if: env.DO_BUILD == 'true'
shell: bash
run: |
bash ./build/ci/windows/make_environment.sh
- name: Generate _en.ts files
if: env.DO_BUILD == 'true'
shell: bash
run: |
bash ./build/ci/translation/run_lupdate.sh
- name: Update .ts files
if: env.DO_UPDATE_TS == 'true'
shell: bash
run: |
bash ./build/ci/translation/tx_install.sh -t ${{ secrets.TRANSIFEX_API_TOKEN }} -s windows
bash ./build/ci/translation/tx_pull.sh
- name: Generate placeholder.ts files
if: env.DO_PLACEHOLDER_TRANSLATIONS == 'true'
shell: bash
run: |
python3 -X utf8 ./tools/translations/placeholder_translations.py --warn-only
- name: Build
if: env.DO_BUILD == 'true'
shell: cmd
run: |
IF ${{ env.SENTRY_URL != 0 }} == true ( SET C_URL="${{ env.SENTRY_URL }}" ) ELSE ( SET C_URL="" )
IF ${{ secrets.YOUTUBE_API_KEY != 0 }} == true ( SET YT_API_KEY=${{ secrets.YOUTUBE_API_KEY }} ) ELSE ( SET YT_API_KEY="" )
build\ci\windows\build.bat -n ${{ env.BUILD_NUMBER }} --youtube_api_key %YT_API_KEY% --crash_log_url %C_URL%
- name: Generate dump symbols
if: env.DO_BUILD == 'true'
shell: bash
run: |
bash ./build/ci/windows/dumpsyms.sh
- name: Package
if: env.DO_BUILD == 'true'
shell: cmd
run: |
IF ${{ secrets.WIN_SIGN_CERTIFICATE_ENCRYPT_SECRET != 0 }} == true ( SET S_S=${{ secrets.WIN_SIGN_CERTIFICATE_ENCRYPT_SECRET }} ) ELSE ( SET S_S="''" )
IF ${{ secrets.WIN_SIGN_CERTIFICATE_PASSWORD != 0 }} == true ( SET S_P=${{ secrets.WIN_SIGN_CERTIFICATE_PASSWORD }} ) ELSE ( SET S_P="''" )
IF ${{ env.BUILD_MODE }} == stable_build ( SET GUID=${{ secrets.WIN_MSI_STABLE_MU4_GUID }} ) ELSE ( SET GUID=${{ secrets.WIN_MSI_TESTING_MU4_GUID }} )
build\ci\windows\package.bat --signsecret %S_S% --signpass %S_P% --guid %GUID%
- name: Checksum
if: env.DO_BUILD == 'true'
run: |
bash ./build/ci/tools/checksum.sh
- name: Upload dump symbols
if: env.DO_UPLOAD_SYMBOLS == 'true'
shell: bash
run: |
bash ./build/ci/tools/sentry_syms_upload.sh -t ${{ secrets.SENTRY_AUTH_TOKEN }} -p ${SENTRY_PROJECT}
- name: Publish package
if: env.DO_PUBLISH == 'true'
shell: bash
run: |
bash ./build/ci/tools/osuosl/publish.sh -s ${{ secrets.OSUOSL_SSH_ENCRYPT_SECRET }} --os windows -v 4
- name: AppCast
if: env.DO_BUILD == 'true'
shell: bash
run: |
bash ./build/ci/tools/sparkle_appcast_gen.sh -p windows
- name: Upload artifacts on GitHub
if: ${{ always() }}
uses: actions/upload-artifact@v3
with:
name: ${{ env.UPLOAD_ARTIFACT_NAME }}
path: build.artifacts\
build_portable:
runs-on: windows-2022
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- name: Clone repository (default)
uses: actions/checkout@v4
if: ${{ github.event_name != 'schedule' || github.event.schedule == '0 3 */1 */1 *' }}
with:
fetch-depth: 3
- name: Clone repository (${{ env.CURRENT_RELEASE_BRANCH }})
uses: actions/checkout@v4
if: ${{ github.event_name == 'schedule' && github.event.schedule == '0 5 */1 */1 *' }}
with:
fetch-depth: 3
ref: ${{ env.CURRENT_RELEASE_BRANCH }}
- name: Fetch submodules
run: |
git submodule update --init --recursive
- name: "Configure workflow"
shell: bash
env:
pull_request_title: ${{ github.event.pull_request.title }}
run: |
bash ./build/ci/tools/make_build_mode_env.sh -e ${{ github.event_name }} -m ${{ github.event.inputs.build_mode }}
BUILD_MODE=$(cat ./build.artifacts/env/build_mode.env)
bash ./build/ci/tools/make_build_number.sh
BUILD_NUMBER=$(cat ./build.artifacts/env/build_number.env)
DO_BUILD='false'
if [[ "$BUILD_MODE" == "testing_build" || "$BUILD_MODE" == "stable_build" ]]; then
DO_BUILD='true'
fi
if [[ "$BUILD_MODE" == "nightly_build" && "${{ github.repository }}" == "musescore/MuseScore" ]]; then
DO_BUILD='true'
fi
DO_PUBLISH='false'
if [[ "${{ github.event.inputs.publish }}" == "on" || "$BUILD_MODE" == "nightly_build" ]]; then
DO_PUBLISH='true'
if [ -z "${{ secrets.OSUOSL_SSH_ENCRYPT_SECRET }}" ]; then
echo "warning: not set OSUOSL_SSH_ENCRYPT_SECRET, publish disabled"
DO_PUBLISH='false'
fi
fi
DO_UPDATE_TS='false'
if [[ "$BUILD_MODE" == "testing_build" || "$BUILD_MODE" == "stable_build" ]]; then
DO_UPDATE_TS='true'
if [ -z "${{ secrets.TRANSIFEX_API_TOKEN }}" ]; then
echo "warning: not set TRANSIFEX_API_TOKEN, update .ts disabled"
DO_UPDATE_TS='false'
fi
fi
if [ $DO_BUILD == 'false' ]; then
DO_PUBLISH='false'
DO_UPDATE_TS='false'
fi
ADD_INFO="_${GITHUB_REF#refs/heads/}"
if [ "${{ github.event_name }}" == "schedule" ] && [ "${{ github.event.schedule }}" == "0 5 */1 */1 *" ]; then ADD_INFO="_${CURRENT_RELEASE_BRANCH}"; fi
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" >> $GITHUB_ENV
echo "BUILD_MODE: $BUILD_MODE"
echo "BUILD_NUMBER=$BUILD_NUMBER" >> $GITHUB_ENV
echo "BUILD_NUMBER: $BUILD_NUMBER"
echo "DO_BUILD=$DO_BUILD" >> $GITHUB_ENV
echo "DO_BUILD: $DO_BUILD"
echo "DO_UPDATE_TS=$DO_UPDATE_TS" >> $GITHUB_ENV
echo "DO_UPDATE_TS: $DO_UPDATE_TS"
echo "DO_PUBLISH=$DO_PUBLISH" >> $GITHUB_ENV
echo "DO_PUBLISH: $DO_PUBLISH"
echo "UPLOAD_ARTIFACT_NAME=$UPLOAD_ARTIFACT_NAME" >> $GITHUB_ENV
echo "UPLOAD_ARTIFACT_NAME: $UPLOAD_ARTIFACT_NAME"
- name: Setup environment
if: env.DO_BUILD == 'true'
run: |
build\ci\windows\setup.bat --portable ON
- name: Make environment file
if: env.DO_BUILD == 'true'
shell: bash
run: |
bash ./build/ci/windows/make_environment.sh
- name: Update .ts files
if: env.DO_UPDATE_TS == 'true'
shell: bash
run: |
bash ./build/ci/translation/tx_install.sh -t ${{ secrets.TRANSIFEX_API_TOKEN }} -s windows
bash ./build/ci/translation/tx_pull.sh
- name: Build
if: env.DO_BUILD == 'true'
shell: cmd
run: |
IF ${{ env.SENTRY_URL != 0 }} == true ( SET C_URL="${{ env.SENTRY_URL }}" ) ELSE ( SET C_URL="" )
IF ${{ secrets.YOUTUBE_API_KEY != 0 }} == true ( SET YT_API_KEY=${{ secrets.YOUTUBE_API_KEY }} ) ELSE ( SET YT_API_KEY="" )
build\ci\windows\build.bat --portable ON -n ${{ env.BUILD_NUMBER }} --youtube_api_key %YT_API_KEY% --crash_log_url %C_URL%
- name: Package
if: env.DO_BUILD == 'true'
shell: cmd
run: |
IF ${{ secrets.WIN_SIGN_CERTIFICATE_ENCRYPT_SECRET != 0 }} == true ( SET S_S=${{ secrets.WIN_SIGN_CERTIFICATE_ENCRYPT_SECRET }} ) ELSE ( SET S_S="''" )
IF ${{ secrets.WIN_SIGN_CERTIFICATE_PASSWORD != 0 }} == true ( SET S_P=${{ secrets.WIN_SIGN_CERTIFICATE_PASSWORD }} ) ELSE ( SET S_P="''" )
build\ci\windows\package.bat --portable ON --signsecret %S_S% --signpass %S_P%
- name: Checksum
if: env.DO_BUILD == 'true'
run: |
bash ./build/ci/tools/checksum.sh
- name: Publish package
if: env.DO_PUBLISH == 'true'
shell: bash
run: |
bash ./build/ci/tools/osuosl/publish.sh -s ${{ secrets.OSUOSL_SSH_ENCRYPT_SECRET }} --os windows -v 4 --arch x86_64-portable
- name: Upload artifacts on GitHub
if: env.DO_BUILD == 'true'
uses: actions/upload-artifact@v3
with:
name: ${{ env.UPLOAD_ARTIFACT_NAME }}
path: build.artifacts\