Skip to content

Commit

Permalink
CI Deploy: Handle differences in openssl output
Browse files Browse the repository at this point in the history
  • Loading branch information
shoogle committed Aug 24, 2024
1 parent ff622e0 commit fd343de
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 13 deletions.
16 changes: 13 additions & 3 deletions .github/workflows/build_all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,17 @@ jobs:
# Dummy build for testing purposes.
dummy:
if: ${{ contains(inputs.platforms, 'dummy') }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
# Expose edge cases like different command versions, CRLF line endings, etc.
# Use same OS versions as used in real build workflows.
os:
- ubuntu-20.04 # linux_x64, backend
- ubuntu-22.04 # linux_arm32, linux_arm64
- macos-latest
- windows-2022 # windows_x64, windows_portable
runs-on: ${{ matrix.os }}
steps:
- name: Clone repository
uses: actions/checkout@v4
Expand Down Expand Up @@ -130,13 +140,13 @@ jobs:
buildscripts/ci/tools/make_release_channel_env.sh -c "${MUSE_APP_BUILD_MODE}"
buildscripts/ci/tools/make_revision_env.sh "$(git rev-parse --short=7 HEAD)"
buildscripts/ci/tools/make_artifact_name_env.sh "MuseScore-Dummy-${BUILD_VERSION}-x86_64.txt"
buildscripts/ci/tools/make_artifact_name_env.sh "MuseScore-Dummy-${BUILD_VERSION}-${{ matrix.os }}-${HOSTTYPE}.txt"
ARTIFACT_NAME="$(<"${ARTIFACTS_DIR}/env/artifact_name.env")"
echo "Hello, world!" >"${ARTIFACTS_DIR}/${ARTIFACT_NAME}"
buildscripts/ci/tools/checksum.sh
UPLOAD_ARTIFACT_NAME="$(tr '":<>|*?/\\’' '_' <<<"MU4_${BUILD_NUMBER}_Dummy_${BUILD_BRANCH}")"
UPLOAD_ARTIFACT_NAME="$(tr '":<>|*?/\\’' '_' <<<"MU4_${BUILD_NUMBER}_Dummy-${{ matrix.os }}_${BUILD_BRANCH}")"
echo "UPLOAD_ARTIFACT_NAME=${UPLOAD_ARTIFACT_NAME}" | tee -a "${GITHUB_ENV}"
- name: Upload artifacts to GitHub
uses: actions/upload-artifact@v4
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
inputs:
platforms:
description: 'Platforms to build:'
default: 'linux_arm32 linux_arm64 linux_x64 macos windows_x64 windows_portable' # TODO: backend
default: 'backend linux_arm32 linux_arm64 linux_x64 macos windows_x64 windows_portable'
required: true
release_type:
description: 'Release type: alpha,beta,rc,stable, or any label with chars A-Za-z0-9._ for testing'
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/update_learn_playlists.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,15 @@ defaults:

jobs:
update_playlists:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
playlist:
- filename: started_playlist
id: PLTYuWi2LmaPEhcwZJwFZqoyQ2xXx_maPa
# - filename: advanced_playlist # old playlist no longer used
# id: PL24C760637A625BB6
runs-on: ubuntu-latest
environment:
name: ${{ inputs.environment }} # can be empty/blank (if so, URL will not be shown)
url: https://www.youtube.com/playlist?list=${{ matrix.playlist.id }} # show on run page
Expand Down
16 changes: 8 additions & 8 deletions buildscripts/ci/release/collate_release_binaries.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@ 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
if [[ ! "${line}" =~ ^SHA256\(.*\)=\ [0-9a-f]{64}$ ]]; then
# 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
checksum="${line##*)= }"
filename="${line%)= *}"
filename="${filename#SHA256(}"
filename="$(basename "${filename}")"
filename="$(basename "${BASH_REMATCH[2]}")"
checksum="${BASH_REMATCH[3]}"
old_checksums["${filename}"]="${checksum}"
done <"${path}"
done
Expand All @@ -74,12 +74,12 @@ echo >&2
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
if [[ ! "${line}" =~ ^([0-9a-f]{64})\ [\ *]([^/]+)$ ]]; then
echo >&2 "$o: Error: sha256sum line is badly formed: ${line}"
exit 1
fi
checksum="${line%% *}"
filename="${line#* ?}"
checksum="${BASH_REMATCH[1]}"
filename="${BASH_REMATCH[2]}"
new_checksums["${filename}"]="${checksum}"
done <"${CHECKSUMS_FILE}"

Expand Down

0 comments on commit fd343de

Please sign in to comment.