Skip to content

Commit

Permalink
[DAPHNE-daphne-eu#452] Release script feature parameter
Browse files Browse the repository at this point in the history
This commit adds the --feature parameter to the release scripts which enables packaging a release with a specified feature compiled. This is a workaround for release 0.1 to fix a binary dependency on CUDA libraries.

Closes daphne-eu#452
  • Loading branch information
corepointer committed Oct 21, 2022
1 parent 24411b0 commit cace18a
Show file tree
Hide file tree
Showing 3 changed files with 82 additions and 21 deletions.
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,14 @@ thirdparty/*

# Python
__pycache__/
/venv

# Jetbrains IDE
.idea/
cmake-*/

tmpdaphne.daphne
tmpdaphne.daphne

# release scripts output
/artifacts

63 changes: 52 additions & 11 deletions pack.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ set -e

function exit_with_usage {
cat << EOF
usage: $0 --version VERSION
usage: pack.sh --version VERSION --feature FEATURE
--feature FEATURE......a feature flag like --cuda, --arrow, etc (omit or "none" for plain Daphne)
EOF
exit 1
}
Expand All @@ -29,8 +29,8 @@ if [ $# -eq 0 ]; then
exit_with_usage
fi

DAPHNE_FEATURES=("--arrow" "--cuda")
DAPHNE_VERSION=-1
FEATURE=

while [[ $# -gt 0 ]]; do
key=$1
Expand All @@ -43,6 +43,11 @@ while [[ $# -gt 0 ]]; do
DAPHNE_VERSION=$1
shift
;;
--feature)
# shellcheck disable=SC2001
FEATURE=$(echo "$1" | sed 's/ *$//g')
shift
;;
*)
unknown_options="${unknown_options} ${key}"
;;
Expand All @@ -59,9 +64,43 @@ if [[ "$DAPHNE_VERSION" == "-1" ]]; then
exit_with_usage
fi

export PACK_ROOT=daphne-$DAPHNE_VERSION-bin
# shellcheck disable=SC2254
case "$FEATURE" in
arrow) ;&
cuda) ;&
debug) ;&
fpgaopencl)
echo "Using feature $FEATURE"
FEATURE="--$FEATURE"
;;
(none) ;&
("")
echo "Building plain Daphne"
FEATURE=
;;
(*)
echo "Warning: Unsupported feature $FEATURE ignored!"
sleep 3
FEATURE=
;;
esac

source build.sh ${DAPHNE_FEATURES[@]} --target all
export PACK_ROOT=daphne$FEATURE-$DAPHNE_VERSION-bin
#echo "You have 10 seconds to abort (press Ctrl-c)"
#sleep 10
echo "Directories bin, build and lib will be removed before compiling."
read -p "Are you sure? [y/n] " -n 1 -r
echo ""
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
echo -e "\nDid not receive a \"y\". \tAborting.\n"
git checkout -
exit 1
fi
rm -rf bin build lib

# shellcheck disable=SC2086
source build.sh $FEATURE --target all

# shellcheck disable=SC2154
if [ -d "$daphneBuildDir"/venv ]; then
Expand All @@ -81,17 +120,19 @@ fi

# shellcheck disable=SC2154
cd "$projectRoot"
source test.sh ${DAPHNE_FEATURES[@]}

# shellcheck disable=SC2086
source test.sh $FEATURE

# shellcheck disable=SC2181
if [[ $? == 0 ]];then
cd "$daphneBuildDir"
mkdir -p $PACK_ROOT/conf
mkdir -p "$PACK_ROOT/conf"
# shellcheck disable=SC2154
cp -a "$projectRoot"/{bin,deploy,doc,lib,scripts} $PACK_ROOT
cp "$projectRoot"/UserConfig.json $PACK_ROOT/
cp "$projectRoot"/{CONTRIBUTING.md,LICENSE.txt,README.md} $PACK_ROOT/
tar czf $PACK_ROOT.tgz $PACK_ROOT
cp -a "$projectRoot"/{bin,deploy,doc,lib,scripts} "$PACK_ROOT"
cp "$projectRoot"/UserConfig.json "$PACK_ROOT"
cp "$projectRoot"/{CONTRIBUTING.md,LICENSE.txt,README.md} "$PACK_ROOT"
tar czf "$PACK_ROOT".tgz "$PACK_ROOT"
cd - > /dev/null
else
echo "test.sh did not succeed - aborting $0"
Expand Down
33 changes: 24 additions & 9 deletions release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,14 @@ set -e

function exit_with_usage {
cat << EOF
usage: $0 --version VERSION --githash GIT_HASH [ --gpgkey GPG_KEY ] [ --artifact PATH_TO_FILE ]
usage: $0 --version VERSION --githash GIT_HASH [ --gpgkey GPG_KEY ] [ --artifact PATH_TO_FILE ] [ --feature FEATURE ]
--gpgkey: The key ID to use for signing. If supplied, an attempt to sign the artifact will be made.
Consider setting GNUPGHOME to point to your GPG keyring.
--artifact: If supplied, building the release artifact will be skipped and the script will only perform
checksumming and optional signing.
--feature FEATURE......a feature flag like --cuda, --arrow, etc (omit or "none" for plain Daphne)
EOF
exit 1
}
Expand All @@ -47,7 +48,7 @@ ARTIFACT_PATH=""
DAPHNE_REPO_URL="git@github.com:corepointer/daphne.git"
#real URL:
#DAPHNE_REPO_URL="git@github.com:daphne-eu/daphne.git"

FEATURE="--feature "
while [[ $# -gt 0 ]]; do
key=$1
shift
Expand All @@ -59,6 +60,10 @@ while [[ $# -gt 0 ]]; do
DAPHNE_VERSION=$1
shift
;;
--feature)
FEATURE=$FEATURE$1
shift
;;
--githash)
GIT_HASH=$1
shift
Expand All @@ -74,7 +79,7 @@ while [[ $# -gt 0 ]]; do
;;
--no-dryrun)
echo "no-dryrun selected! Release will be tagged on Github($DAPHNE_REPO_URL)"
echo "You have 10 seconds to abort"
echo "You have 10 seconds to abort (press Ctrl-c)"
sleep 10
DRY_RUN=0
;;
Expand All @@ -95,18 +100,27 @@ if [ $BUILD -eq 1 ]; then
exit_with_usage
fi

if [[ "$FEATURE" == "--feature " ]]; then
# echo "Clearing FEATURE= variable"
FEATURE=
fi

echo "Building Daphne $DAPHNE_VERSION release from git commit $GIT_HASH"

# set the requested commit to build Daphne
git checkout "$GIT_HASH"
source pack.sh --version "$DAPHNE_VERSION"
# shellcheck disable=SC2086
source pack.sh --version "$DAPHNE_VERSION" $FEATURE
# return to the previous branch
git checkout -

cd "$daphneBuildDir"
echo $GIT_HASH > $PACK_ROOT.githash
sha512sum "$PACK_ROOT".tgz > "$PACK_ROOT.tgz.sha512sum"
sha512sum -c "$PACK_ROOT".tgz.sha512sum
mkdir -p artifacts
cd artifacts
echo "$GIT_HASH" > "$PACK_ROOT.githash"
# shellcheck disable=SC2154
mv "$daphneBuildDir/$PACK_ROOT.tgz" .
sha512sum "$PACK_ROOT.tgz" > "$PACK_ROOT.tgz.sha512sum"
sha512sum -c "$PACK_ROOT.tgz.sha512sum"
echo
cd - > /dev/null

Expand Down Expand Up @@ -135,12 +149,13 @@ else
gpg --detach-sign --armor --default-key "$GPG_KEY" "$ARTIFACT_PATH"
else
echo "No GPG Key given - don't forget to sign the artifact manually"
GPG_KEY="<GPG_KEY>"
fi

echo "Now go to your git working copy of Daphne source and issue these commands (GPG key needed) before completing"
echo "the release in the Github web interface."
echo
echo "git tag -a -u <GPG_KEY> <DAPHNE_VERSION> <GIT_HASH>"
echo "git tag -a -u $GPG_KEY $DAPHNE_VERSION $GIT_HASH"
echo "git push $DAPHNE_REPO_URL --tags"
fi

Expand Down

0 comments on commit cace18a

Please sign in to comment.