diff --git a/.github/workflows/build_all.yml b/.github/workflows/build_all.yml index c1fbfa33e63e..3a1aa4bc6a0e 100644 --- a/.github/workflows/build_all.yml +++ b/.github/workflows/build_all.yml @@ -184,7 +184,7 @@ jobs: ARTIFACT_NAME="$(<"${ARTIFACTS_DIR}/env/artifact_name.env")" echo "Hello, world!" >"${ARTIFACTS_DIR}/${ARTIFACT_NAME}" - buildscripts/ci/tools/checksum.sh + muse/buildscripts/ci/tools/checksum.sh UPLOAD_ARTIFACT_NAME="$(tr '":<>|*?/\\’' '_' <<<"MU4_${BUILD_NUMBER}_Dummy-${{ matrix.os }}_${BUILD_BRANCH}")" echo "UPLOAD_ARTIFACT_NAME=${UPLOAD_ARTIFACT_NAME}" | tee -a "${GITHUB_ENV}" diff --git a/.github/workflows/build_linux.yml b/.github/workflows/build_linux.yml index 436fbb92c292..0a162a3f2ffe 100644 --- a/.github/workflows/build_linux.yml +++ b/.github/workflows/build_linux.yml @@ -280,7 +280,7 @@ jobs: bash ./buildscripts/ci/linux/package.sh --arch ${{ matrix.arch }} --build-pipewire - name: Checksum run: | - bash ./buildscripts/ci/tools/checksum.sh + bash ./muse/buildscripts/ci/tools/checksum.sh - name: Publish to OSUOSL if: env.DO_PUBLISH == 'true' diff --git a/.github/workflows/build_macos.yml b/.github/workflows/build_macos.yml index 43a620fef5ef..cb4e270c00ad 100644 --- a/.github/workflows/build_macos.yml +++ b/.github/workflows/build_macos.yml @@ -305,7 +305,7 @@ jobs: - name: Checksum run: | - bash ./buildscripts/ci/tools/checksum.sh + bash ./muse/buildscripts/ci/tools/checksum.sh - name: Publish to OSUOSL if: env.DO_PUBLISH == 'true' diff --git a/.github/workflows/build_windows.yml b/.github/workflows/build_windows.yml index 04debe0e50f6..f96a2709ce56 100644 --- a/.github/workflows/build_windows.yml +++ b/.github/workflows/build_windows.yml @@ -273,7 +273,7 @@ jobs: buildscripts\ci\windows\package.bat --signsecret "%WIN_SIGN_S3_SECRET%" --signkey "%WIN_SIGN_S3_KEY%" --guid %WIN_MSI_GUID% - name: Checksum run: | - bash ./buildscripts/ci/tools/checksum.sh + bash ./muse/buildscripts/ci/tools/checksum.sh - name: Publish to OSUOSL if: env.DO_PUBLISH == 'true' @@ -451,7 +451,7 @@ jobs: buildscripts\ci\windows\package.bat --portable ON --signsecret "%WIN_SIGN_S3_SECRET%" --signkey "%WIN_SIGN_S3_KEY%" - name: Checksum run: | - bash ./buildscripts/ci/tools/checksum.sh + bash ./muse/buildscripts/ci/tools/checksum.sh - name: Publish to OSUOSL if: env.DO_PUBLISH == 'true' shell: bash diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 6a4379e0ac58..0ab2b791823f 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -46,7 +46,7 @@ jobs: sudo apt-get update sudo apt-get install cmake - buildscripts/ci/release/make_tag_name.sh | tee -a "${GITHUB_OUTPUT}" + muse/buildscripts/ci/release/make_tag_name.sh | tee -a "${GITHUB_OUTPUT}" echo "${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/commit/${GITHUB_SHA}" echo ========== # https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions @@ -99,7 +99,7 @@ jobs: path: build.artifacts - name: Collate release binaries run: | - buildscripts/ci/release/collate_release_binaries.sh + muse/buildscripts/ci/release/collate_release_binaries.sh - name: Create tag # do this as late as possible so we're not left with a useless tag if something fails env: TAG_NAME: ${{ needs.plan.outputs.tag_name }} diff --git a/buildscripts/ci/release/collate_release_binaries.sh b/buildscripts/ci/release/collate_release_binaries.sh deleted file mode 100755 index 61fb48fb3105..000000000000 --- a/buildscripts/ci/release/collate_release_binaries.sh +++ /dev/null @@ -1,102 +0,0 @@ -#!/usr/bin/env bash -# SPDX-License-Identifier: GPL-3.0-only -# MuseScore-Studio-CLA-applies -# -# MuseScore Studio -# Music Composition & Notation -# -# Copyright (C) 2024 MuseScore Limited and others -# -# 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 . - -o="$(basename "$0")" # script name - -((${BASH_VERSION%%.*} >= 4)) || { echo >&2 "$o: Error: Please upgrade Bash."; exit 1; } - -set -euo pipefail # exit on error, error on unset variable, preserve errors in pipelines - -ARTIFACTS_DIR=build.artifacts -RELEASE_DIR=release -CHECKSUMS_FILE=checksums.sha256.txt - -mkdir "${RELEASE_DIR}" # error if it already exists (need it to be empty) - -# Move artifacts into release directory. -for path in "${ARTIFACTS_DIR}/"*"/env/artifact_name.env"; do - artifact_dir="$(dirname "$(dirname "${path}")")" - artifact_name="$(<"${path}")" - artifact_path="${artifact_dir}/${artifact_name}" - - mv -v "${artifact_path}" "${RELEASE_DIR}/" - if [[ -f "${artifact_path}.zsync" ]]; then - mv -v "${artifact_path}.zsync" "${RELEASE_DIR}/" - fi -done - -declare -A old_checksums new_checksums # associative arrays (i.e. maps / dictionaries) - -# Read old checksums calculated during the build. -echo >&2 -echo >&2 "Old checksums (openssl sha256):" -for path in "${ARTIFACTS_DIR}/"*"/checksum.txt"; do - while read -r line; do - line="${line%$'\r'}" # openssl output has CRLF line endings on Windows - printf '%s\n' "${line}" >&2 - # Some versions of openssl output 'SHA2-256' instead of 'SHA256'. - if [[ ! "${line}" =~ ^SHA(2-)?256\((.*)\)=\ ([0-9a-f]{64})$ ]]; then - echo >&2 "$o: Error: openssl line is badly formed: ${line}" - exit 1 - fi - filename="$(basename "${BASH_REMATCH[2]}")" - checksum="${BASH_REMATCH[3]}" - old_checksums["${filename}"]="${checksum}" - done <"${path}" -done - -# Calculate new checksums to be uploaded with the release. -echo >&2 -cd "${RELEASE_DIR}/" -echo >&2 "New checksums (sha256sum):" -sha256sum * | tee "${CHECKSUMS_FILE}" >&2 -echo >&2 - -# Read new checksums. -while read -r line; do - # sha256sum prepends filenames with space ( ) if opened in text mode - # or asterisk (*) if opened in binary mode. - if [[ ! "${line}" =~ ^([0-9a-f]{64})\ [\ *]([^/]+)$ ]]; then - echo >&2 "$o: Error: sha256sum line is badly formed: ${line}" - exit 1 - fi - checksum="${BASH_REMATCH[1]}" - filename="${BASH_REMATCH[2]}" - new_checksums["${filename}"]="${checksum}" -done <"${CHECKSUMS_FILE}" - -# Compare old and new checksums. -# Loop over old ones because there's no old checksum for .zsync files. -status=0 -for filename in "${!old_checksums[@]}"; do - old_checksum="${old_checksums["${filename}"]}" - new_checksum="${new_checksums["${filename}"]}" - if [[ "${old_checksum}" != "${new_checksum}" ]]; then - echo >&2 "$o: Error: Checksum mismatch: ${filename}" - status=1 - fi -done - -if ((status == 0)); then - echo >&2 "All checksums match!" -fi - -exit ${status} diff --git a/buildscripts/ci/release/make_tag_name.sh b/buildscripts/ci/release/make_tag_name.sh deleted file mode 100755 index 0e6ad1087dfd..000000000000 --- a/buildscripts/ci/release/make_tag_name.sh +++ /dev/null @@ -1,155 +0,0 @@ -#!/usr/bin/env bash -# SPDX-License-Identifier: GPL-3.0-only -# MuseScore-Studio-CLA-applies -# -# MuseScore Studio -# Music Composition & Notation -# -# Copyright (C) 2024 MuseScore Limited and others -# -# 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 . - -o="$(basename "$0")" # script name - -((${BASH_VERSION%%.*} >= 4)) || { echo >&2 "$o: Error: Please upgrade Bash."; exit 1; } - -set -euo pipefail # exit on error, error on unset variable, preserve errors in pipelines - -function tag_exists() -{ - local tags="$(git tag --list -- "$@")" - if [[ "${tags}" ]]; then - # printf '%s\n' "${tags}" - return 0 - fi - return 1 -} - -function version_exists() -{ - local version="$1" label="${2-}" # label is optional - local suffix="${label:+-${label}}" # prepend hyphen if label not empty - version="${version%.0}" # strip patch number if it's zero - version="${version%.0}" # strip minor number if it's zero - tag_exists "v${version}${suffix}" "v${version}.0${suffix}" "v${version}.0.0${suffix}" -} - -if [[ "${CREATE_TAG}" == 'true' ]]; then - types="alpha|beta|rc|stable" - if [[ ! "${RELEASE_TYPE}" =~ ^(${types})$ ]]; then - echo >&2 "$o: Error: Creating tag with RELEASE_TYPE '${RELEASE_TYPE}'." - echo >&2 "Allowed release types for tags are: ${types//|/, }." - exit 1 - fi -else - pattern="^[A-Za-z][A-Za-z0-9._]*[A-Za-z0-9]$" - if [[ ! "${RELEASE_TYPE}" =~ ${pattern} ]]; then - echo >&2 "$o: Error: Invalid RELEASE_TYPE '${RELEASE_TYPE}'." - echo >&2 "Allowed characters are ASCII letters, numbers, dot '.' and underscore '_'." - echo >&2 "It must start with a letter and end with a letter or number." - echo >&2 "Regex: ${pattern}" - exit 1 - fi -fi - -VERSION="$(cmake -P version.cmake | sed -n "s|^-- MUSE_APP_VERSION ||p")" -int="(0|[1-9][0-9]*)" - -if [[ ! "${VERSION}" =~ ^${int}\.${int}\.${int}$ ]]; then - echo >&2 "$o: Badly formed version from version.cmake: ${VERSION}" - exit 1 -elif version_exists "${VERSION}"; then - if [[ "${RELEASE_TYPE}" == 'stable' ]]; then - echo >&2 "$o: Error: Stable tag already exists for version ${VERSION}." - else - echo >&2 "$o: Error: Creating pre-release for v${VERSION}, which already has a stable tag." - fi - echo >&2 "You need to bump the version numbers in version.cmake (e.g. increase PATCH by 1)." - exit 1 -elif [[ "${RELEASE_TYPE}" =~ ^(beta|alpha)$ ]] && version_exists "${VERSION}" 'rc*'; then - echo >&2 "$o: Error: Release type is '${RELEASE_TYPE}' but v${VERSION} already has a Release Candidate tag." - echo >&2 "Please change the release type to 'rc' or bump the version numbers in version.cmake." - exit 1 -elif [[ "${RELEASE_TYPE}" == 'alpha' ]] && version_exists "${VERSION}" 'beta*'; then - echo >&2 "$o: Error: Release type is '${RELEASE_TYPE}' but v${VERSION} already has a Beta tag." - echo >&2 "Please change the release type to 'beta' or 'rc', or bump the version numbers in version.cmake." - exit 1 -fi - -MAJOR="${VERSION%%.*}" -MINOR="${VERSION#*.}" -MINOR="${MINOR%%.*}" -PATCH="${VERSION#*.*.}" - -if ((PATCH > 0)); then - older_version="${MAJOR}.${MINOR}.$((PATCH - 1))" -elif ((MINOR > 0)); then - older_version="${MAJOR}.$((MINOR - 1)).0" -elif ((MAJOR > 0)); then - older_version="$((MAJOR - 1)).0.0" -else - echo >&2 "$o: Error: Can't release version '0.0.0'. Please check version.cmake." - exit 1 -fi - -if ! version_exists "${older_version}"; then - # Assume VERSION isn't the very first release. - echo >&2 "$o: Error: Version is ${VERSION} but no tag exists for ${older_version}." - echo >&2 "You need to reduce the version numbers in version.cmake to avoid skipping releases." - exit 1 -fi - -RELEASE_TYPE_COUNT=1 - -if [[ "${RELEASE_TYPE}" == 'stable' ]]; then - VERSION_LABEL="" -else - label="${RELEASE_TYPE}" - if version_exists "${VERSION}" "${label}" || version_exists "${VERSION}" "${label}.1"; then - while true; do - label="${RELEASE_TYPE}.$((++RELEASE_TYPE_COUNT))" - version_exists "${VERSION}" "${label}" || break - done - fi - VERSION_LABEL="${label}" -fi - -PRETTY_VERSION="${MAJOR}.${MINOR}.${PATCH}" # e.g. '4.0.0' -TAG_NAME="v${PRETTY_VERSION}" # e.g. 'v4.0.0' - -if [[ "${VERSION_LABEL}" ]]; then - TAG_NAME="${TAG_NAME}-${VERSION_LABEL}" # e.g. 'v4.0.0-rc.2' -fi - -if tag_exists "${TAG_NAME}"; then - echo >&2 "$o: Error: '${TAG_NAME}' tag already exists." - echo >&2 "This shouldn't happen. Check for bugs in the script code." - exit 1 -fi - -case "${RELEASE_TYPE}" in -stable) PRETTY_RELEASE_TYPE="Release";; -rc) PRETTY_RELEASE_TYPE="Release Candidate";; -beta) PRETTY_RELEASE_TYPE="Beta";; -alpha) PRETTY_RELEASE_TYPE="Alpha";; -*) PRETTY_RELEASE_TYPE="${RELEASE_TYPE}";; -esac - -RELEASE_LABEL="${PRETTY_RELEASE_TYPE}" - -if ((RELEASE_TYPE_COUNT > 1)); then - RELEASE_LABEL="${RELEASE_LABEL} ${RELEASE_TYPE_COUNT}" -fi - -echo "TAG_NAME=${TAG_NAME}" -echo "RELEASE_NAME=MuseScore Studio ${PRETTY_VERSION} ${RELEASE_LABEL}" diff --git a/buildscripts/ci/tools/checksum.sh b/buildscripts/ci/tools/checksum.sh deleted file mode 100755 index ce8634b7caab..000000000000 --- a/buildscripts/ci/tools/checksum.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/env bash -# SPDX-License-Identifier: GPL-3.0-only -# MuseScore-Studio-CLA-applies -# -# MuseScore Studio -# Music Composition & Notation -# -# Copyright (C) 2021 MuseScore Limited and others -# -# 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 . -echo "Checksum" - -ARTIFACTS_DIR=build.artifacts - -while [[ "$#" -gt 0 ]]; do - case $1 in - -a|--artifact) ARTIFACT_PATH="$2"; shift ;; - *) echo "Unknown parameter passed: $1"; exit 1 ;; - esac - shift -done - -if [ -z "$ARTIFACT_PATH" ]; then - ARTIFACT_NAME="$(cat $ARTIFACTS_DIR/env/artifact_name.env)"; - if [ -z "$ARTIFACT_NAME" ]; then echo "error: not set ARTIFACT_NAME"; exit 1; fi - ARTIFACT_PATH=$ARTIFACTS_DIR/$ARTIFACT_NAME -fi - -if [ -z "$ARTIFACT_PATH" ]; then echo "error: not set ARTIFACT_PATH"; exit 1; fi - -echo "ARTIFACT_PATH: $ARTIFACT_PATH" - -openssl sha256 $ARTIFACT_PATH > $ARTIFACTS_DIR/checksum.txt \ No newline at end of file