Corrections after release 2.0.16 (#1694)

* Updates on building a release

* Fixes

* Correct non arm64 identification

* Show download bar

* reset all units with failed status

* Reload systemd daemon after updates

* Force Qt5 for armv6 packages

---------

Co-authored-by: Paulchen-Panther <16664240+Paulchen-Panther@users.noreply.github.com>
This commit is contained in:
LordGrey 2024-02-04 15:42:57 +01:00 committed by GitHub
parent 3ae17bb425
commit 716d87d4e6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 89 additions and 59 deletions

View File

@ -28,7 +28,7 @@ jobs:
qt_version: ${{ matrix.qt_version }} qt_version: ${{ matrix.qt_version }}
event_name: ${{ github.event_name }} event_name: ${{ github.event_name }}
pull_request_number: ${{ github.event.pull_request.number }} pull_request_number: ${{ github.event.pull_request.number }}
publish: ${{ startsWith(github.event.ref, 'refs/tags') }} publish: ${{ startsWith(github.event.ref, 'refs/tags') && matrix.qt_version == '5' }}
# Build DEB/RPM Packages for APT/DNF Repository (runs only on tagged commits) # Build DEB/RPM Packages for APT/DNF Repository (runs only on tagged commits)
repo_build: repo_build:
@ -44,6 +44,6 @@ jobs:
repository: hyperion-project/hyperion.releases-ci repository: hyperion-project/hyperion.releases-ci
token: ${{ secrets.HYPERION_BOT_TOKEN }} token: ${{ secrets.HYPERION_BOT_TOKEN }}
event-type: releases_repo_build event-type: releases_repo_build
client-payload: '{ "head_sha": "${{ github.sha }}" }' client-payload: '{ "head_sha": "${{ github.sha }}", "repo_checkout": "hyperion-project/hyperion.ng" }'
env: env:
SECRET_HYPERION_BOT_TOKEN: ${{ secrets.HYPERION_BOT_TOKEN }} SECRET_HYPERION_BOT_TOKEN: ${{ secrets.HYPERION_BOT_TOKEN }}

View File

@ -86,7 +86,7 @@ jobs:
if: ${{ inputs.publish || inputs.event_name == 'pull_request' }} if: ${{ inputs.publish || inputs.event_name == 'pull_request' }}
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: ${{ inputs.event_name == 'pull_request' && env.NAME || 'artifact' }} name: ${{ inputs.event_name == 'pull_request' && env.NAME || format('artifact-{0}', env.NAME) }}
path: ${{ inputs.event_name == 'pull_request' && 'deploy/*.tar.gz' || 'deploy/Hyperion-*' }} path: ${{ inputs.event_name == 'pull_request' && 'deploy/*.tar.gz' || 'deploy/Hyperion-*' }}
env: env:
NAME: ${{ format('{0}_{1}_{2}{3}', matrix.os.distribution, matrix.os.codename, matrix.os.architecture[0], inputs.qt_version == '6' && '_qt6' || '') }} NAME: ${{ format('{0}_{1}_{2}{3}', matrix.os.distribution, matrix.os.codename, matrix.os.architecture[0], inputs.qt_version == '6' && '_qt6' || '') }}
@ -130,7 +130,7 @@ jobs:
if: ${{ inputs.publish || inputs.event_name == 'pull_request' }} if: ${{ inputs.publish || inputs.event_name == 'pull_request' }}
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: ${{ inputs.event_name == 'pull_request' && env.NAME || 'artifact' }} name: ${{ inputs.event_name == 'pull_request' && env.NAME || format('artifact-{0}', env.NAME) }}
path: 'build/Hyperion-*' path: 'build/Hyperion-*'
env: env:
NAME: ${{ inputs.qt_version == '6' && 'macOS_x64_qt6' || 'macOS_x64' }} NAME: ${{ inputs.qt_version == '6' && 'macOS_x64_qt6' || 'macOS_x64' }}
@ -200,7 +200,7 @@ jobs:
if: ${{ inputs.publish || inputs.event_name == 'pull_request' }} if: ${{ inputs.publish || inputs.event_name == 'pull_request' }}
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: ${{ inputs.event_name == 'pull_request' && env.NAME || 'artifact' }} name: ${{ inputs.event_name == 'pull_request' && env.NAME || format('artifact-{0}', env.NAME) }}
path: ${{ inputs.event_name == 'pull_request' && 'build/*.exe' || 'build/Hyperion-*' }} path: ${{ inputs.event_name == 'pull_request' && 'build/*.exe' || 'build/Hyperion-*' }}
env: env:
NAME: ${{ inputs.qt_version == '6' && 'windows_x64_qt6' || 'windows_x64' }} NAME: ${{ inputs.qt_version == '6' && 'windows_x64_qt6' || 'windows_x64' }}
@ -228,14 +228,15 @@ jobs:
- name: 💾 Artifact download - name: 💾 Artifact download
uses: actions/download-artifact@v4.1.1 uses: actions/download-artifact@v4.1.1
with: with:
path: artifacts pattern: artifact-*
path: all-artifacts
- name: 📦 Upload - name: 📦 Upload
uses: softprops/action-gh-release@v1 uses: softprops/action-gh-release@v1
with: with:
name: Hyperion ${{ env.VERSION }} name: Hyperion ${{ env.VERSION }}
tag_name: ${{ env.TAG }} tag_name: ${{ env.TAG }}
files: "artifacts/**" files: "all-artifacts/**"
draft: true draft: true
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@ -3,13 +3,13 @@
# Fixed variables # Fixed variables
api_url="https://api.github.com/repos/hyperion-project/hyperion.ng" api_url="https://api.github.com/repos/hyperion-project/hyperion.ng"
type wget > /dev/null 2> /dev/null type wget >/dev/null 2>/dev/null
hasWget=$? hasWget=$?
type curl > /dev/null 2> /dev/null type curl >/dev/null 2>/dev/null
hasCurl=$? hasCurl=$?
type python3 > /dev/null 2> /dev/null type python3 >/dev/null 2>/dev/null
hasPython3=$? hasPython3=$?
type python > /dev/null 2> /dev/null type python >/dev/null 2>/dev/null
hasPython2=$? hasPython2=$?
DISTRIBUTION="debian" DISTRIBUTION="debian"
@ -17,7 +17,7 @@ CODENAME="bullseye"
ARCHITECTURE="" ARCHITECTURE=""
WITH_QT5=false WITH_QT5=false
BASE_PATH='.'; BASE_PATH='.'
if [[ "${hasWget}" -ne 0 ]] && [[ "${hasCurl}" -ne 0 ]]; then if [[ "${hasWget}" -ne 0 ]] && [[ "${hasCurl}" -ne 0 ]]; then
echo '---> Critical Error: wget or curl required to download pull request artifacts' echo '---> Critical Error: wget or curl required to download pull request artifacts'
@ -25,12 +25,12 @@ if [[ "${hasWget}" -ne 0 ]] && [[ "${hasCurl}" -ne 0 ]]; then
fi fi
if [[ "${hasPython3}" -eq 0 ]]; then if [[ "${hasPython3}" -eq 0 ]]; then
pythonCmd="python3" pythonCmd="python3"
else else
if [[ "${hasPython2}" -eq 0 ]]; then if [[ "${hasPython2}" -eq 0 ]]; then
pythonCmd="python" pythonCmd="python"
else else
echo '---> Critical Error: python3 or python2 required to download pull request artifacts' echo '---> Critical Error: python3 or python2 required to download pull request artifacts'
fi fi
exit 1 exit 1
fi fi
@ -44,15 +44,15 @@ function request_call() {
} }
while getopts ":a:c:r:t:5" opt; do while getopts ":a:c:r:t:5" opt; do
case "$opt" in case "$opt" in
a) ARCHITECTURE=$OPTARG ;; a) ARCHITECTURE=$OPTARG ;;
c) CONFIGDIR=$OPTARG ;; c) CONFIGDIR=$OPTARG ;;
r) run_id=$OPTARG ;; r) run_id=$OPTARG ;;
t) PR_TOKEN=$OPTARG ;; t) PR_TOKEN=$OPTARG ;;
5) WITH_QT5=true ;; 5) WITH_QT5=true ;;
esac esac
done done
shift $(( OPTIND - 1 )) shift $((OPTIND - 1))
# Check for a command line argument (PR number) # Check for a command line argument (PR number)
if [ "$1" == "" ] || [ $# -gt 1 ] || [ -z ${PR_TOKEN} ]; then if [ "$1" == "" ] || [ $# -gt 1 ] || [ -z ${PR_TOKEN} ]; then
@ -70,43 +70,52 @@ echo '**************************************************************************
# Determine the architecture, if not given # Determine the architecture, if not given
if [[ -z ${ARCHITECTURE} ]]; then if [[ -z ${ARCHITECTURE} ]]; then
ARCHITECTURE=`uname -m` ARCHITECTURE=$(uname -m)
fi fi
#Test if multiarchitecture setup, i.e. user-space is 32bit #Test if multiarchitecture setup, i.e. user-space is 32bit
if [[ "${ARCHITECTURE}" == "aarch64" || "${ARCHITECTURE}" == "arm64" ]]; then if [[ "${ARCHITECTURE}" == "aarch64" ]]; then
ARCHITECTURE="arm64" ARCHITECTURE="arm64"
USER_ARCHITECTURE=$ARCHITECTURE USER_ARCHITECTURE=$ARCHITECTURE
IS_V7L=`cat /proc/$$/maps |grep -m1 -c v7l` IS_ARMHF=$(grep -m1 -c armhf /proc/$$/maps)
if [ $IS_V7L -ne 0 ]; then if [ $IS_ARMHF -ne 0 ]; then
USER_ARCHITECTURE="armv7" USER_ARCHITECTURE="armv7"
else else
IS_V6L=`cat /proc/$$/maps |grep -m1 -c v6l` IS_ARMEL=$(grep -m1 -c armel /proc/$$/maps)
if [ $IS_V6L -ne 0 ]; then if [ $IS_ARMEL -ne 0 ]; then
USER_ARCHITECTURE="armv6" USER_ARCHITECTURE="armv6"
fi fi
fi
if [ $ARCHITECTURE != $USER_ARCHITECTURE ]; then
echo "---> Identified user space target architecture: $USER_ARCHITECTURE"
ARCHITECTURE=$USER_ARCHITECTURE
fi fi
if [ $ARCHITECTURE != $USER_ARCHITECTURE ]; then
echo "---> Identified user space target architecture: $USER_ARCHITECTURE"
ARCHITECTURE=$USER_ARCHITECTURE
fi
else else
# Change x86_xx to amdxx
ARCHITECTURE=${ARCHITECTURE//x86_/amd} ARCHITECTURE=${ARCHITECTURE//x86_/amd}
# Remove 'l' from armv6l, armv7l
ARCHITECTURE=${ARCHITECTURE//l/}
fi fi
echo 'armv6l armv7l arm64 amd64' | grep -qw ${ARCHITECTURE} echo 'armv6 armv7 arm64 amd64' | grep -qw ${ARCHITECTURE}
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "---> Critical Error: Target architecture $ARCHITECTURE is unknown -> abort" echo "---> Critical Error: Target architecture $ARCHITECTURE is unknown -> abort"
exit 1 exit 1
else else
PACKAGE="${ARCHITECTURE}" PACKAGE="${ARCHITECTURE}"
# armv6 has no Qt6 support yet
if [[ "${PACKAGE}" == "armv6" ]]; then
WITH_QT5=true
fi
QTVERSION="5" QTVERSION="5"
if [ ${WITH_QT5} == false ]; then if [ ${WITH_QT5} == false ]; then
QTVERSION="6" QTVERSION="6"
PACKAGE="${PACKAGE}_qt6" PACKAGE="${PACKAGE}_qt6"
fi fi
echo "---> Download package for identified runtime architecture: $ARCHITECTURE and Qt$QTVERSION" echo "---> Download package for identified runtime architecture: $ARCHITECTURE and Qt$QTVERSION"
fi fi
# Determine if PR number exists # Determine if PR number exists
@ -146,9 +155,9 @@ if [ -z "$head_sha" ]; then
fi fi
if [ -z "$run_id" ]; then if [ -z "$run_id" ]; then
# Determine run_id from head_sha # Determine run_id from head_sha
runs=$(request_call "$api_url/actions/runs?head_sha=$head_sha") runs=$(request_call "$api_url/actions/runs?head_sha=$head_sha")
run_id=$(echo "$runs" | tr '\r\n' ' ' | ${pythonCmd} -c """ run_id=$(echo "$runs" | tr '\r\n' ' ' | ${pythonCmd} -c """
import json,sys,os import json,sys,os
data = json.load(sys.stdin) data = json.load(sys.stdin)
@ -199,9 +208,9 @@ fi
# Download packed PR artifact # Download packed PR artifact
echo "---> Downloading Pull Request #$pr_number, package: $PACKAGE_NAME" echo "---> Downloading Pull Request #$pr_number, package: $PACKAGE_NAME"
if [ $hasCurl -eq 0 ]; then if [ $hasCurl -eq 0 ]; then
curl -skH "Authorization: token ${PR_TOKEN}" -o $BASE_PATH/temp.zip -L --get $archive_download_url curl -# -kH "Authorization: token ${PR_TOKEN}" -o $BASE_PATH/temp.zip -L --get $archive_download_url
elif [ $hasWget -eq 0 ]; then elif [ $hasWget -eq 0 ]; then
echo "wget" echo "wget"
wget --quiet --header="Authorization: token ${PR_TOKEN}" -O $BASE_PATH/temp.zip $archive_download_url wget --quiet --header="Authorization: token ${PR_TOKEN}" -O $BASE_PATH/temp.zip $archive_download_url
fi fi
@ -216,44 +225,59 @@ rm $BASE_PATH/temp.zip 2>/dev/null
# Create the startup script # Create the startup script
echo '---> Create startup script' echo '---> Create startup script'
STARTUP_SCRIPT="#!/bin/bash -e STARTUP_SCRIPT_STOPSRVS=$(
cat <<'EOF'
#!/bin/bash -e
# Stop hyperion service, if it is running # Stop hyperion service, if it is running
"'CURRENT_SERVICE=$(systemctl --type service | { grep -o "hyperion.*\.service" || true; }) CURRENT_SERVICE=$(systemctl --type service | grep -o 'hyperion.*\.service' || true)
if [[ ! -z ${CURRENT_SERVICE} ]]; then if [[ ! -z ${CURRENT_SERVICE} ]]; then
echo "---> Stop current service: ${CURRENT_SERVICE}" echo "---> Stop current service: ${CURRENT_SERVICE}"
STOPCMD="systemctl stop --quiet ${CURRENT_SERVICE} --now" STOPCMD="systemctl stop --quiet ${CURRENT_SERVICE} --now"
USERNAME=${SUDO_USER:-$(whoami)} USERNAME=${SUDO_USER:-$(whoami)}
if [ ${USERNAME} != "root" ]; then if [ ${USERNAME} != "root" ]; then
STOPCMD="sudo ${STOPCMD}" STOPCMD="sudo ${STOPCMD}"
fi fi
${STOPCMD} >/dev/null 2>&1 ${STOPCMD} >/dev/null 2>&1
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "---> Critical Error: Failed to stop service: ${CURRENT_SERVICE}, Hyperion may not be started. Stop Hyperion manually." echo "---> Critical Error: Failed to stop service: ${CURRENT_SERVICE}, Hyperion may not be started. Stop Hyperion manually."
else else
echo "---> Service ${CURRENT_SERVICE} successfully stopped, Hyperion will be started" echo "---> Service ${CURRENT_SERVICE} successfully stopped, Hyperion will be started"
fi fi
fi'"" fi
EOF
)
TARGET_CONFIGDIR="$BASE_PATH/config" TARGET_CONFIGDIR="$BASE_PATH/config"
if [[ ! -z ${CONFIGDIR} ]]; then if [[ ! -z ${CONFIGDIR} ]]; then
STARTUP_SCRIPT+=" STARTUP_SCRIPT_COPYCONFIG="$(
cat <<EOF
# Copy existing configuration file # Copy existing configuration file
"'echo "Copy existing configuration from "'${CONFIGDIR}" echo "Copy existing configuration from ${CONFIGDIR}"
mkdir -p "$TARGET_CONFIGDIR" mkdir -p "$TARGET_CONFIGDIR"
cp -ri "${CONFIGDIR}/*" "$TARGET_CONFIGDIR"" cp -ri "${CONFIGDIR}"/* "$TARGET_CONFIGDIR"
EOF
)"
fi fi
STARTUP_SCRIPT+=" STARTUP_SCRIPT_STARTPR="$(
# Start PR artifact cat <<EOF
cd $BASE_PATH/hyperion_pr$pr_number
./bin/hyperiond -d -u $TARGET_CONFIGDIR" # Start PR artifact
cd "$BASE_PATH/hyperion_pr$pr_number"
./bin/hyperiond -d -u "$TARGET_CONFIGDIR"
EOF
)"
# Place startup script # Place startup script
echo "$STARTUP_SCRIPT" > $BASE_PATH/hyperion_pr$pr_number/$pr_number.sh echo "${STARTUP_SCRIPT_STOPSRVS} ${STARTUP_SCRIPT_COPYCONFIG} ${STARTUP_SCRIPT_STARTPR}" >"$BASE_PATH/hyperion_pr$pr_number/$pr_number.sh"
# Set the executen bit # Set the executen bit
chmod +x -R $BASE_PATH/hyperion_pr$pr_number/$pr_number.sh chmod +x -R $BASE_PATH/hyperion_pr$pr_number/$pr_number.sh

View File

@ -35,6 +35,11 @@ then
# disable user specific symlink # disable user specific symlink
echo "---> Disable service and remove entry" echo "---> Disable service and remove entry"
rm -v /etc/systemd/system/hyperion.service /etc/systemd/system/hyperiond@.service /etc/systemd/system/hyperion@.service 2> /dev/null rm -v /etc/systemd/system/hyperion.service /etc/systemd/system/hyperiond@.service /etc/systemd/system/hyperion@.service 2> /dev/null
# reload daemon after updates
systemctl -q daemon-reload 2> /dev/null
# reset all units with failed status
systemctl -q reset-failed 2> /dev/null
elif [ -e /sbin/initctl ] elif [ -e /sbin/initctl ]
then then