From af23778655b1e7a3b9d0bfda441895ce7d0ba4ad Mon Sep 17 00:00:00 2001 From: Roman Gershman Date: Thu, 18 Jan 2024 16:52:19 +0200 Subject: [PATCH] fix: release pipeline (#2439) We had a place in tools/packaging/generate_debian_package.sh that relied on the existence of build-opt, moreover, if it did not exist the script deadlocked. 1. Added more loggings 2. Removed the loop 3. Removed unnecessary dependency in the script on the build-dir name. Signed-off-by: Roman Gershman --- .github/workflows/release.yml | 1 + Makefile | 7 ++--- tools/packaging/generate_debian_package.sh | 30 +++++++++++----------- tools/release.sh | 6 ++++- 4 files changed, 25 insertions(+), 19 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3d2491745..3cf69afc9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -120,6 +120,7 @@ jobs: dnf install -y rpm-build libstdc++-static fi - name: Build artifacts + timeout-minutes: 25 run: | # Work around https://github.com/actions/checkout/issues/766 git config --global --add safe.directory "$GITHUB_WORKSPACE" diff --git a/Makefile b/Makefile index d03926cc6..903c47acc 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,7 @@ HELIO_USE_STATIC_LIBS = ON HELIO_OPENSSL_USE_STATIC_LIBS = ON HELIO_ENABLE_GIT_VERSION = ON HELIO_WITH_UNWIND = OFF +RELEASE_DIR=build-release # Some distributions (old fedora) have incorrect dependencies for crypto # so we add -lz for them. @@ -29,14 +30,14 @@ HELIO_FLAGS = -DHELIO_RELEASE_FLAGS="-g" \ .PHONY: default configure: - cmake -L -B build-release -DCMAKE_BUILD_TYPE=Release -GNinja $(HELIO_FLAGS) + cmake -L -B $(RELEASE_DIR) -DCMAKE_BUILD_TYPE=Release -GNinja $(HELIO_FLAGS) build: - cd build-release; \ + cd $(RELEASE_DIR); \ ninja dragonfly && ldd dragonfly package: - cd build-release; \ + cd $(RELEASE_DIR); \ objcopy \ --remove-section=".debug_*" \ --remove-section="!.debug_line" \ diff --git a/tools/packaging/generate_debian_package.sh b/tools/packaging/generate_debian_package.sh index 2ad8f9a2a..37284b857 100755 --- a/tools/packaging/generate_debian_package.sh +++ b/tools/packaging/generate_debian_package.sh @@ -19,13 +19,24 @@ set -eu + +if [ $# -ge 1 ]; then + VERSION_FILE=$1 + if ! [ -f ${VERSION_FILE} ]; then + echo "binary file ${VERSION_FILE} does not exist" + exit 1 + fi + +else + echo "no binary file provided" + exit 1 +fi + SCRIPT_ABS_PATH=$(realpath $0) SCRIPT_PATH=$(dirname ${SCRIPT_ABS_PATH}) PACKAGES_PATH=${SCRIPT_PATH}/debian CHANGELOG_SCRIPT=generate_changelog.sh -BUILD_DIR=build-opt -ROOT_ABS_PATH=$(cd ${SCRIPT_PATH}; while [ ! -d ${BUILD_DIR} ]; do cd ..; done ; pwd) -REPO_PATH=${ROOT_ABS_PATH} +ROOT_ABS_PATH=$(realpath $SCRIPT_PATH/../..) TEMP_WORK_DIR=$(mktemp -d) BASE_DIR=${TEMP_WORK_DIR}/packages BASE_PATH=${BASE_DIR}/dragonfly @@ -37,16 +48,6 @@ function cleanup { exit 1 } -if [ $# -ge 1 ]; then - VERSION_FILE=$1 -else - if ! [ -f ${ROOT_ABS_PATH}/${BUILD_DIR}/dragonfly ]; then - cleanup "no dragonfly binary found at ${ROOT_ABS_PATH}/${BUILD_DIR}" - else - VERSION_FILE=${ROOT_ABS_PATH}/${BUILD_DIR}/dragonfly - fi -fi - mkdir -p ${BASE_PATH} || cleanup "failed to create working directory for building the package" cp -r ${PACKAGES_PATH} ${BASE_PATH} || cleanup "failed to copy required files for the package build from ${PACKAGES_PATH}" @@ -57,7 +58,7 @@ mkdir -p ${BINARY_TARGET_DIR} || cleanup "failed to create install directory for cp ${VERSION_FILE} ${BINARY_TARGET_DIR}/dragonfly || cleanup "failed to copy binary to target dir" -${BASE_PATH}/${CHANGELOG_SCRIPT} ${REPO_PATH} || cleanup "failed to generate changelog for package" +${BASE_PATH}/${CHANGELOG_SCRIPT} ${ROOT_ABS_PATH} || cleanup "failed to generate changelog for package" MY_DIR=${PWD} cd ${BASE_PATH} @@ -77,4 +78,3 @@ cd ${MY_DIR} RESULT_FILE=$(ls *.deb 2>/dev/null) echo "successfully built the install package at ${MY_DIR}/${RESULT_FILE}" rm -rf ${TEMP_WORK_DIR} -exit 0 diff --git a/tools/release.sh b/tools/release.sh index 0b399a811..b0657f927 100755 --- a/tools/release.sh +++ b/tools/release.sh @@ -1,6 +1,7 @@ #!/usr/bin/env sh -APP_PATH=build-release/dragonfly +RELEASE_DIR=build-release +APP_PATH=$RELEASE_DIR/dragonfly set -e @@ -22,6 +23,7 @@ if ! [ -f ${APP_PATH} ]; then exit 1 fi +echo "Running ${APP_PATH} --version" ${APP_PATH} --version if readelf -a ${APP_PATH} | grep GLIBC_PRIVATE >/dev/null 2>&1 ; then @@ -31,3 +33,5 @@ if readelf -a ${APP_PATH} | grep GLIBC_PRIVATE >/dev/null 2>&1 ; then fi make package +echo "Release package created: " +ls -lh $RELEASE_DIR/